From c5eb890a8f42ca3a4c6fb580989ebb01131285d1 Mon Sep 17 00:00:00 2001 From: Ken Kroenlein Date: Tue, 14 May 2024 12:31:10 -0600 Subject: [PATCH 1/3] Migrate to common-gh-actions --- .github/actions/initialize/action.yml | 31 ------------------- .github/workflows/build-docs.yml | 43 --------------------------- .github/workflows/deploy-docs.yml | 21 +++++++++++++ .github/workflows/deploy.yml | 14 ++------- .github/workflows/pr-checks.yml | 43 +++------------------------ .github/workflows/pr-tests.yml | 43 +++------------------------ gemd/__version__.py | 2 +- 7 files changed, 33 insertions(+), 164 deletions(-) delete mode 100644 .github/actions/initialize/action.yml delete mode 100644 .github/workflows/build-docs.yml create mode 100644 .github/workflows/deploy-docs.yml diff --git a/.github/actions/initialize/action.yml b/.github/actions/initialize/action.yml deleted file mode 100644 index 716211c..0000000 --- a/.github/actions/initialize/action.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: 'Initialize' -description: 'Checkout repo and install dependencies' -inputs: - latest: - description: 'If true, ignore requirements.txt and the versions pinned there.' - default: 'false' - documentation: - description: 'If true, install documentation build frameworks.' - default: 'false' -runs: - using: "composite" - steps: - - name: Check out repository code - uses: actions/checkout@v4 - - name: Upgrade pip - run: python -m pip install --upgrade pip - shell: bash - - name: Install minimum-version runtime dependencies + GEMD - run: python -m pip install --only-binary ':all:' -r requirements.txt - shell: bash - if: ${{ inputs.latest == 'false' }} - - name: Install test dependencies - run: python -m pip install --only-binary ':all:' -r test_requirements.txt - shell: bash - - name: Install documentation building framework - run: python -m pip install --only-binary ':all:' -r doc_requirements.txt - shell: bash - if: ${{ inputs.documentation == 'true' }} - - name: Install gemd-python, along with the latest version of any outstanding dependencies - run: python -m pip install --only-binary ':all:' -e . - shell: bash diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml deleted file mode 100644 index ea74773..0000000 --- a/.github/workflows/build-docs.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Build and Deploy Docs - -on: - release: - types: [published] - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - -jobs: - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Initialize the environment - uses: ./.github/actions/initialize - with: - documentation: 'true' - - name: Build Docs - run: | - make -C docs/ html - touch docs/_build/html/.nojekyll - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - path: 'docs/_build/html' - - name: Setup Pages - uses: actions/configure-pages@v4 - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 0000000..7d10bdf --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,21 @@ +name: Build and Deploy Docs + +on: + release: + types: [published] + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + deploy-docs: + uses: CitrineInformatics/common-gh-actions/.github/workflows/deploy-docs.yml@v1 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1f00dea..2ff6b15 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -6,14 +6,6 @@ on: jobs: publish: - name: Publish package to PyPI - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v4 - - name: Build - run: python setup.py sdist bdist_wheel - - name: Publish - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} + uses: CitrineInformatics/common-gh-actions/.github/workflows/deploy.yml@v1 + permissions: + id-token: write diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 5c59532..004839f 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -7,42 +7,7 @@ on: - 'release/**' jobs: - check-version: - name: Check version bumped - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Initialize the environment - uses: ./.github/actions/initialize - - name: Check version - run: python scripts/validate_version_bump.py - linting: - name: Run linting with flake8 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Initialize the environment - uses: ./.github/actions/initialize - - name: Lint the source directory - run: flake8 gemd - check-deprecated: - name: Find code marked for removal in this version - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Initialize the environment - uses: ./.github/actions/initialize - - name: Deprecated check - run: derp . gemd/__version__.py - check-docs: - name: Check docs for warnings - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Initialize the environment - uses: ./.github/actions/initialize - with: - documentation: 'true' - - name: Build Docs - continue-on-error: true - run: make -C docs/ html SPHINXOPTS='-W --keep-going' + pr-checks: + uses: CitrineInformatics/common-gh-actions/.github/workflows/repo-checks.yml@v1 + with: + src: gemd diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index 0f190e4..0a46a61 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -7,42 +7,7 @@ on: - 'release/**' jobs: - run-tests: - name: Execute unit tests - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - steps: - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - uses: actions/checkout@v4 - - name: Initialize the environment - uses: ./.github/actions/initialize - - name: Execute unit tests - run: pytest --cov=gemd --cov-report term-missing:skip-covered --cov-config=tox.ini --no-cov-on-fail --cov-fail-under=100 tests/ - run-tests-against-latest: - # These runs are intended to confirm the latest minor version of our dependencies we claim to - # support don't break with our latest changes. Since they're not the versions we directly state - # you should use (i.e. in requirements.txt), they arguably aren't critical, hence not blocking. - name: Non-blocking - Execute unit tests against latest version of dependencies - runs-on: ubuntu-latest - continue-on-error: true - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - steps: - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - uses: actions/checkout@v4 - - name: Initialize the environment - uses: ./.github/actions/initialize - with: - latest: 'true' - - name: Execute unit tests - run: pytest tests/ + pr-tests: + uses: CitrineInformatics/common-gh-actions/.github/workflows/run-tests.yml@v1 + with: + src: gemd diff --git a/gemd/__version__.py b/gemd/__version__.py index df4be5e..0b167e6 100644 --- a/gemd/__version__.py +++ b/gemd/__version__.py @@ -1 +1 @@ -__version__ = "2.1.4" +__version__ = "2.1.5" From 910ccc326fabf04573286ba9c6fe98a85f4ac7ba Mon Sep 17 00:00:00 2001 From: Ken Kroenlein Date: Wed, 15 May 2024 10:27:00 -0600 Subject: [PATCH 2/3] Revert PyPI deploy b/c of permissions issues --- .github/workflows/deploy.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2ff6b15..1f00dea 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -6,6 +6,14 @@ on: jobs: publish: - uses: CitrineInformatics/common-gh-actions/.github/workflows/deploy.yml@v1 - permissions: - id-token: write + name: Publish package to PyPI + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Build + run: python setup.py sdist bdist_wheel + - name: Publish + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} From ca2589aae73c169b8814a4fa6aff5d0dc7e6ae9b Mon Sep 17 00:00:00 2001 From: Ken Kroenlein Date: Wed, 15 May 2024 11:54:36 -0600 Subject: [PATCH 3/3] PR feedback --- .github/workflows/deploy-docs.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 7d10bdf..9d167bd 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -10,12 +10,6 @@ permissions: pages: write id-token: write -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - jobs: deploy-docs: uses: CitrineInformatics/common-gh-actions/.github/workflows/deploy-docs.yml@v1