From 839d820eec0b2828f4cbec4f2458e76d1a64e193 Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Wed, 6 Sep 2023 19:53:33 -0400 Subject: [PATCH 01/14] Add initial release github action --- .github/workflows/release.yaml | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..162850c --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,38 @@ +name: Release + +on: + push: + branches: + - feat/release-github-action + +jobs: + test: + runs-on: ${{ matrix.os }} + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + os: [ "windows-latest", "ubuntu-latest", "macos-latest" ] + python-version: [ "3.9", "3.10", "3.11" ] + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Set up Fortran + uses: awvwgk/setup-fortran@v1 + + - name: Install build frontend + run: python -m pip install --upgrade pip build + + - name: Build wheel + run: python -I -m build --wheel + + - uses: actions/upload-artifact@v3 + with: + path: dist + retention-days: 5 + if-no-files-found: error \ No newline at end of file From e53ea6fdf4660691ad2a458153638a62e492ef11 Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Wed, 6 Sep 2023 19:54:42 -0400 Subject: [PATCH 02/14] Temporarily exclude release action feature branch from test action --- .github/workflows/test.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index cee3b07..170f09c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,6 +1,9 @@ name: Tests -on: [ push ] +on: + push: + branches: + - '!feat/release-github-action' jobs: test: From d646ead0ef8b2b3b6384243c302c1fca521c774e Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Wed, 6 Sep 2023 20:08:47 -0400 Subject: [PATCH 03/14] Set artifact name in release workflow --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 162850c..b1c858b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -33,6 +33,7 @@ jobs: - uses: actions/upload-artifact@v3 with: + name: dist path: dist retention-days: 5 if-no-files-found: error \ No newline at end of file From 1286a068bf009904eeb74dc5fb7d8e59edf78cdd Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Wed, 6 Sep 2023 20:18:25 -0400 Subject: [PATCH 04/14] Don't include compiled 6S binaries in source distributions --- pyproject.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index da1351c..9c808d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,8 +16,10 @@ packages = [ { from = "src", include = "sixs_bin" } ] include = [ - "src/sixs_bin/sixsV1.1", - "src/sixs_bin/sixsV2.1", + # Only include compiled 6S binaries in (platform-specific) wheel distributions. + # We don't want them in included in source distributions, since those may be used on different platforms. + { path = "src/sixs_bin/sixsV1.1", format = "wheel" }, + { path = "src/sixs_bin/sixsV2.1", format = "wheel" }, ] [tool.poetry.build] From e65fd6419a980a8348a851b0886afdc0492789d2 Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Wed, 6 Sep 2023 20:25:56 -0400 Subject: [PATCH 05/14] Build sdist for single job config in release workflow --- .github/workflows/release.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b1c858b..9401670 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -14,6 +14,10 @@ jobs: matrix: os: [ "windows-latest", "ubuntu-latest", "macos-latest" ] python-version: [ "3.9", "3.10", "3.11" ] + include: + - os: ubuntu-latest + python-version: '3.11' + sdist: true steps: - uses: actions/checkout@v3 @@ -31,6 +35,10 @@ jobs: - name: Build wheel run: python -I -m build --wheel + - name: Build sdist + if: ${{ matrix.sdist }} + run: python -I -m build --sdist + - uses: actions/upload-artifact@v3 with: name: dist From cda19449f3fd615163b354a8dd90639aac983f8f Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Wed, 6 Sep 2023 20:38:56 -0400 Subject: [PATCH 06/14] Fix job name in release workflow --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9401670..625d3f8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,7 +6,7 @@ on: - feat/release-github-action jobs: - test: + build: runs-on: ${{ matrix.os }} timeout-minutes: 20 strategy: From 55861aa23b0825ab68caa6959ed429b5cfdfde42 Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Sat, 9 Sep 2023 15:08:02 -0400 Subject: [PATCH 07/14] Download 6S archives once in release workflow --- .github/workflows/release.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 625d3f8..e36c697 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,6 +6,16 @@ on: - feat/release-github-action jobs: + download_archives: + uses: ./.github/workflows/web_artifact.yaml + with: + name: 6s-archives + urls: | + [ + "https://web.archive.org/web/20220912090811if_/https://rtwilson.com/downloads/6SV-1.1.tar", + "https://web.archive.org/web/20220909154857if_/https://salsa.umd.edu/files/6S/6sV2.1.tar" + ] + retention-days: 1 build: runs-on: ${{ matrix.os }} timeout-minutes: 20 @@ -34,6 +44,8 @@ jobs: - name: Build wheel run: python -I -m build --wheel + env: + SIXS_ARCHIVE_DIR: 6s-archives - name: Build sdist if: ${{ matrix.sdist }} From b074733e2ce88280ff4ce6533a8d1e913734cb0f Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Sat, 9 Sep 2023 15:09:48 -0400 Subject: [PATCH 08/14] Retrieve 6S archives from artifact in release workflow --- .github/workflows/release.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e36c697..2ede152 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -42,6 +42,12 @@ jobs: - name: Install build frontend run: python -m pip install --upgrade pip build + - name: Retrieve 6S source archives + uses: actions/download-artifact@v3 + with: + name: 6s-archives + path: 6s-archives + - name: Build wheel run: python -I -m build --wheel env: From c92e0d7a07a1875fdff18a5a99ac3cfc55e024f7 Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Sat, 9 Sep 2023 15:10:33 -0400 Subject: [PATCH 09/14] Mark build job as dependent on download_archives job --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2ede152..aad3051 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,6 +17,7 @@ jobs: ] retention-days: 1 build: + needs: download_archives runs-on: ${{ matrix.os }} timeout-minutes: 20 strategy: From 58aa401c0fc8135460c22e1f51085d7ef9f3686c Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Sat, 9 Sep 2023 16:25:16 -0400 Subject: [PATCH 10/14] Add job to publish to TestPyPI --- .github/workflows/release.yaml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index aad3051..8658364 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,8 +4,11 @@ on: push: branches: - feat/release-github-action +# tags: +# - 'v[0-9]+.[0-9]+.[0-9]+' # Only run for full release tags jobs: + download_archives: uses: ./.github/workflows/web_artifact.yaml with: @@ -16,6 +19,7 @@ jobs: "https://web.archive.org/web/20220909154857if_/https://salsa.umd.edu/files/6S/6sV2.1.tar" ] retention-days: 1 + build: needs: download_archives runs-on: ${{ matrix.os }} @@ -63,4 +67,21 @@ jobs: name: dist path: dist retention-days: 5 - if-no-files-found: error \ No newline at end of file + if-no-files-found: error + + publish: + needs: build +# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + runs-on: ubuntu-latest + steps: + - name: Retrieve distributions + uses: actions/download-artifact@v3 + with: + name: dist + path: dist + + - name: Publish distributions to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} \ No newline at end of file From 4311aac30c9bb1c4755f86d69cf0f953d95ae326 Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Sat, 9 Sep 2023 16:44:00 -0400 Subject: [PATCH 11/14] Switch to trusted publishing for TestPyPI --- .github/workflows/release.yaml | 3 ++- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8658364..7ab1dd3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -73,6 +73,8 @@ jobs: needs: build # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') runs-on: ubuntu-latest + permissions: + id-token: write steps: - name: Retrieve distributions uses: actions/download-artifact@v3 @@ -84,4 +86,3 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ - password: ${{ secrets.TEST_PYPI_API_TOKEN }} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 9c808d1..99d2132 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "6s-bin" -version = "0.7.0-dev" +version = "0.7.0.dev1" description = "Convenience distribution for building and installing local 6S executables." license = "Apache-2.0" authors = ["Brian Schubert "] From b25fbd3de5953a1606bc5fffe5da1336a29c396f Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Sat, 9 Sep 2023 20:34:02 -0400 Subject: [PATCH 12/14] Add release workflow badge to README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 79277b7..cce3bc8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # 6S Binary Distribution +[![release workflow](https://github.com/brianschubert/6s-bin/actions/workflows/release.yaml/badge.svg)](https://github.com/brianschubert/6s-bin/actions) [![tests workflow](https://github.com/brianschubert/6s-bin/actions/workflows/test.yaml/badge.svg)](https://github.com/brianschubert/6s-bin/actions) [![License](https://img.shields.io/github/license/brianschubert/6s-bin)](./LICENSE) [![Code style: black](https://img.shields.io/badge/code%20style-black-black.svg)](https://github.com/psf/black) From cce2dfbc7216a2811eef9772ea96fdb42b29e3d7 Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Sat, 9 Sep 2023 20:39:12 -0400 Subject: [PATCH 13/14] Restore all-push trigger for test workflow --- .github/workflows/test.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2c521a9..cabd2c9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,9 +1,6 @@ name: Tests -on: - push: - branches: - - '!feat/release-github-action' +on: [ push ] jobs: download_archives: From 68e8422a9bbb6b7d0689d74b3f59e5a70f080755 Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Sat, 9 Sep 2023 20:56:42 -0400 Subject: [PATCH 14/14] Configure release workflow to trigger on release tag push --- .github/workflows/release.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7ab1dd3..6102506 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,10 +2,8 @@ name: Release on: push: - branches: - - feat/release-github-action -# tags: -# - 'v[0-9]+.[0-9]+.[0-9]+' # Only run for full release tags + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' # Only run for full release tags jobs: