From 5609372cc93e0e4b81bbb556a4b3fd2309292dac Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sat, 4 Jan 2025 10:57:47 +0100 Subject: [PATCH 1/7] conda and pypi publish workflow --- .github/workflows/ultraplot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ultraplot.yml b/.github/workflows/ultraplot.yml index 07d73287f..38e835b86 100644 --- a/.github/workflows/ultraplot.yml +++ b/.github/workflows/ultraplot.yml @@ -68,7 +68,7 @@ jobs: with: repository-url: https://test.pypi.org/legacy/ - publish: + publish-conda-pypi: needs: [build, publish-test] runs-on: ubuntu-latest if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v') From c2a96554abd87f6814caf84912d2a5bb4bf60a1f Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sat, 4 Jan 2025 11:06:12 +0100 Subject: [PATCH 2/7] separated workflows separated workflows separated workflows --- .github/workflows/buildUltraplot.yml | 34 +++++++++ .../{ultraplot.yml => publish-conda.yml} | 70 +------------------ .github/workflows/publish-pypi.yml | 46 ++++++++++++ 3 files changed, 83 insertions(+), 67 deletions(-) create mode 100644 .github/workflows/buildUltraplot.yml rename .github/workflows/{ultraplot.yml => publish-conda.yml} (64%) create mode 100644 .github/workflows/publish-pypi.yml diff --git a/.github/workflows/buildUltraplot.yml b/.github/workflows/buildUltraplot.yml new file mode 100644 index 000000000..7a696979b --- /dev/null +++ b/.github/workflows/buildUltraplot.yml @@ -0,0 +1,34 @@ +name: Build and Test +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v3 + - uses: mamba-org/setup-micromamba@v2.0.3 + with: + environment-file: ./environment-dev.yml + init-shell: bash + create-args: --verbose + cache-environment: true + cache-downloads: false + + - name: Test Ultraplot + shell: bash -el {0} + run: | + micromamba activate ultraplot-dev + pip install . + python -m pytest + + - name: "Build docs" + shell: bash -el {0} + run: | + micromamba activate ultraplot-dev + cd docs + make html diff --git a/.github/workflows/ultraplot.yml b/.github/workflows/publish-conda.yml similarity index 64% rename from .github/workflows/ultraplot.yml rename to .github/workflows/publish-conda.yml index 38e835b86..8a222ed84 100644 --- a/.github/workflows/ultraplot.yml +++ b/.github/workflows/publish-conda.yml @@ -1,74 +1,10 @@ -name: Build and Test +name: Publish to Conda on: - push: - branches: [main] - tags: ["v*"] - pull_request: - branches: [main] release: types: [published] -jobs: - build: - runs-on: ubuntu-latest - timeout-minutes: 15 - steps: - - uses: actions/checkout@v3 - - uses: mamba-org/setup-micromamba@v2.0.3 - with: - environment-file: ./environment-dev.yml - init-shell: >- - bash - create-args: >- - --verbose - cache-environment: true - cache-downloads: false - - - name: Test Ultraplot - shell: bash -el {0} - run: | - micromamba activate ultraplot-dev - pip install . - python -m pytest - - - name: "Build docs" - shell: bash -el {0} - run: | - micromamba activate ultraplot-dev - cd docs - make html - - publish-test: - needs: build - runs-on: ubuntu-latest - # Run on every push to main/v* branches and pull requests - if: github.event_name == 'push' || github.event_name == 'pull_request' - permissions: - id-token: write - contents: read - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - - name: Install build - run: python -m pip install build - - - name: Build package - run: python -m build - - name: Publish to TestPyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ - - publish-conda-pypi: +jobs: + publish-conda: needs: [build, publish-test] runs-on: ubuntu-latest if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v') diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml new file mode 100644 index 000000000..66aa18b7a --- /dev/null +++ b/.github/workflows/publish-pypi.yml @@ -0,0 +1,46 @@ +name: Publish to PyPI +on: + release: + types: [published] + push: + tags: ["v*"] + +jobs: + publish-pypi-test: + runs-on: ubuntu-latest + if: github.event_name == 'push' + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Build package + run: | + python -m pip install build + python -m build + - name: Publish to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + + publish-prod: + needs: publish-test + runs-on: ubuntu-latest + if: github.event_name == 'release' + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Build package + run: | + python -m pip install build + python -m build + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From 35204ef440372e4f95e1437ce2d54ef9ce3dcd7f Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 5 Jan 2025 18:53:04 +0100 Subject: [PATCH 3/7] renamed yml to ensure consistency --- .github/workflows/{buildUltraplot.yml => build-ultraplot.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{buildUltraplot.yml => build-ultraplot.yml} (100%) diff --git a/.github/workflows/buildUltraplot.yml b/.github/workflows/build-ultraplot.yml similarity index 100% rename from .github/workflows/buildUltraplot.yml rename to .github/workflows/build-ultraplot.yml From 9c75035cbb15fc7654cbde2cf209abe6645cc97e Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Mon, 6 Jan 2025 18:41:50 +0100 Subject: [PATCH 4/7] separate build and test --- .github/workflows/build-docs.yml | 33 +++++++++++++++++++++++++++ .github/workflows/build-ultraplot.yml | 7 ------ 2 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/build-docs.yml diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 000000000..5431f07f0 --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,33 @@ +name: Build and Test +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v3 + - uses: mamba-org/setup-micromamba@v2.0.3 + with: + environment-file: ./environment-dev.yml + init-shell: bash + create-args: --verbose + cache-environment: true + cache-downloads: false + + - name: Test Ultraplot + shell: bash -el {0} + run: | + micromamba activate ultraplot-dev + pip install . + + - name: "Build docs" + shell: bash -el {0} + run: | + micromamba activate ultraplot-dev + cd docs + make html diff --git a/.github/workflows/build-ultraplot.yml b/.github/workflows/build-ultraplot.yml index 7a696979b..6df88c53d 100644 --- a/.github/workflows/build-ultraplot.yml +++ b/.github/workflows/build-ultraplot.yml @@ -25,10 +25,3 @@ jobs: micromamba activate ultraplot-dev pip install . python -m pytest - - - name: "Build docs" - shell: bash -el {0} - run: | - micromamba activate ultraplot-dev - cd docs - make html From 4cf2c9403ffd54782af4fdef111a612a0683f293 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Mon, 6 Jan 2025 18:42:24 +0100 Subject: [PATCH 5/7] # This is a combination of 2 commits. # This is the 1st commit message: added title to build job # This is the commit message #2: fixed removing wrong test --- .github/workflows/build-ultraplot.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-ultraplot.yml b/.github/workflows/build-ultraplot.yml index 6df88c53d..ed10a4e04 100644 --- a/.github/workflows/build-ultraplot.yml +++ b/.github/workflows/build-ultraplot.yml @@ -19,9 +19,10 @@ jobs: cache-environment: true cache-downloads: false - - name: Test Ultraplot + - name: "Build docs" shell: bash -el {0} run: | micromamba activate ultraplot-dev pip install . - python -m pytest + cd docs + make html From defb219ea471ac0612d9dc33216a99310ae7aec9 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Mon, 6 Jan 2025 18:45:05 +0100 Subject: [PATCH 6/7] separate build and test --- .github/workflows/build-docs.yml | 9 ++------- .github/workflows/build-ultraplot.yml | 5 ++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 5431f07f0..627dbc24b 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -1,4 +1,4 @@ -name: Build and Test +name: Build docs on: push: branches: [main] @@ -19,15 +19,10 @@ jobs: cache-environment: true cache-downloads: false - - name: Test Ultraplot - shell: bash -el {0} - run: | - micromamba activate ultraplot-dev - pip install . - - name: "Build docs" shell: bash -el {0} run: | micromamba activate ultraplot-dev + pip install . cd docs make html diff --git a/.github/workflows/build-ultraplot.yml b/.github/workflows/build-ultraplot.yml index ed10a4e04..6df88c53d 100644 --- a/.github/workflows/build-ultraplot.yml +++ b/.github/workflows/build-ultraplot.yml @@ -19,10 +19,9 @@ jobs: cache-environment: true cache-downloads: false - - name: "Build docs" + - name: Test Ultraplot shell: bash -el {0} run: | micromamba activate ultraplot-dev pip install . - cd docs - make html + python -m pytest From fa1f2fcc1c2e49a074d9fde3bc3c507a65d89c19 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Mon, 6 Jan 2025 19:08:12 +0100 Subject: [PATCH 7/7] removed conda recipe --- .github/workflows/publish-conda.yml | 95 ----------------------------- 1 file changed, 95 deletions(-) delete mode 100644 .github/workflows/publish-conda.yml diff --git a/.github/workflows/publish-conda.yml b/.github/workflows/publish-conda.yml deleted file mode 100644 index 8a222ed84..000000000 --- a/.github/workflows/publish-conda.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Publish to Conda -on: - release: - types: [published] - -jobs: - publish-conda: - needs: [build, publish-test] - runs-on: ubuntu-latest - if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v') - permissions: - # Required for trusted publishing to PyPI - id-token: write - contents: read - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - - name: Install build - run: python -m pip install build - - - name: Build package - run: python -m build - - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - - - name: Publish to Anaconda - uses: conda-incubator/setup-miniconda@v3 - with: - auto-activate-base: false - environment-file: environment-dev.yml - - - name: Install conda-build - shell: bash -l {0} - run: | - micromamba activate ultraplot-dev - micromamba install conda-build anaconda-client - - - name: Clone staged-recipes - run: git clone https://github.com/cvanelteren/staged-recipes.git - - - name: Check if recipe exists - run: | - if [ -d "staged-recipes/recipes/ultraplot" ]; then - echo "Recipe already exists. Checking version..." - RECIPE_VERSION=$(grep "version:"staged-recipes/recipes/ultraplot/meta.yaml | awk {print $2}') - PACKAGE_VERSION=$(python setup.py --version) - if [ "$RECIPE_VERSION" == "$PACKAGE_VERSION" ];then - echo "Recipe is up-to-date. Skipping." - exit 0 - fi - fi - - - name: Extract version from pyproject.toml - id: get-version - run: | - pip install tomli - python -c " - import tomli - with open('pyproject.toml', 'rb') as f: - data = tomli.load(f) - print(data['project']['version']) - " > version.txt - - - name: Generate meta.yaml - run: | - mkdir -p staged-recipes/recipes/ultraplot - cat < staged-recipes/recipes/ultraplot/meta.yaml - # Same meta.yaml generation script as above - EOF - - - name: Push changes to fork - run: | - git add staged-recipes/recipes/ultraplot - git commit -m "Update ultraplot recipe to version $(cat version.txt)" - git push origin update-ultraplot-recipe - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v5 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: "Update ultraplot recipe to version $(cat version.txt)" - branch: update-ultraplot-recipe - title: "Update ultraplot recipe" - body: | - This PR updates the ultraplot recipe to version $(cat version.txt).