-
Notifications
You must be signed in to change notification settings - Fork 21
Release automation #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Release automation #194
Changes from all commits
49f5ede
e042248
bbab0e0
69f11d1
4aba369
94aa402
f29437b
fe14030
d7506bd
57541e0
e47f335
2e8b0dd
f823048
0eb4c0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| [ | ||
| { | ||
| "os": "ubuntu-22.04", | ||
| "slug": "linux", | ||
| "name": "Ubuntu 22.04", | ||
| "pre_build": "sudo apt update && sudo apt install -y cmake && python3 -m pip install -e INCHI-1-TEST[invariance-tests]", | ||
| "build_exe": "cmake --build CMake_build/cli_build", | ||
| "build_lib": "cmake --build CMake_build/libinchi_build", | ||
| "exe_path": "CMake_build/cli_build/bin/inchi-1", | ||
| "lib_path": "CMake_build/libinchi_build/bin/libinchi.so", | ||
| "main_path": "CMake_build/libinchi_build/bin/inchi_main" | ||
| }, | ||
| { | ||
| "os": "windows-2022", | ||
| "slug": "windows", | ||
| "name": "Windows Server 2022", | ||
| "pre_build": "python -m pip install -e INCHI-1-TEST[invariance-tests]", | ||
| "build_exe": "cmake --build CMake_build/cli_build --config Release", | ||
| "build_lib": "cmake --build CMake_build/libinchi_build --config Release", | ||
| "exe_path": "CMake_build/cli_build/bin/Release/inchi-1.exe", | ||
| "lib_path": "CMake_build/libinchi_build/bin/Release/libinchi.dll", | ||
| "main_path": "CMake_build/libinchi_build/bin/Release/inchi_main.exe" | ||
|
|
||
| }, | ||
| { | ||
| "os": "macos-14", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please make sure, that this must run on M1/ARM runners, so the CMake must not contain any x86_64 specific flags |
||
| "slug": "macos", | ||
| "name": "MacOS 14", | ||
| "pre_build": "python -m pip install -e INCHI-1-TEST[invariance-tests]", | ||
| "build_exe": "cmake --build CMake_build/cli_build", | ||
| "build_lib": "cmake --build CMake_build/libinchi_build", | ||
| "exe_path": "CMake_build/cli_build/bin/inchi-1", | ||
| "lib_path": "CMake_build/libinchi_build/bin/libinchi.dylib", | ||
| "main_path": "CMake_build/libinchi_build/bin/inchi_main" | ||
| } | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,150 @@ | ||
| # Trigger this workflow by pushing a release tag. | ||
| # Make sure that `HEAD` is pointing to the commit you want to release. | ||
| # Then run `git tag -a v<version_tag> -m "Release version <version_tag> (<yyyy>-<mm>-<dd>)" && git push && git push --tags`. | ||
| # For example `git tag -a v1.06 -m "Release version 1.06 (2020-12-20)" && git push && git push --tags`. | ||
| name: InChI Release | ||
| name: Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| # TODO: Remove branches trigger. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reminder to do this TODO ;) |
||
| branches: [ release-automation ] | ||
| # Trigger this workflow by pushing a release tag. | ||
| # Make sure that `HEAD` is pointing to the commit you want to release. | ||
| # Then run `git tag -a v<version_tag> -m "Release version <version_tag> (<yyyy>-<mm>-<dd>)" && git push && git push --tags`. | ||
| # For example `git tag -a v1.06 -m "Release version 1.06 (2020-12-20)" && git push && git push --tags`. | ||
| tags: | ||
| - v1.* | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| define_matrix: | ||
| runs-on: ubuntu-22.04 | ||
| outputs: | ||
| matrix: ${{ steps.define_matrix.outputs.matrix }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Define build matrix | ||
| id: define_matrix | ||
| # The build matrix is used to interpolate commands and inputs throughout the remainder of the workflow. | ||
| # Since those interpolations are potentially security-sensitive, we verify the hash of the build matrix. | ||
| if: ${{ hashFiles('.github/workflows/build_matrix.json') == 'ae87ded543b131908cf5aed1502d0e39b2cb9374693598ef7f09c5c5a8be4e52' }} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add an else statement here that prints a dedicated error message here if the hash check fails |
||
| run: | | ||
| echo "matrix=$(cat .github/workflows/build_matrix.json| jq -c .)" >> $GITHUB_OUTPUT | ||
|
|
||
| build_and_test: | ||
| needs: define_matrix | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| ${{ fromJson(needs.define_matrix.outputs.matrix) }} | ||
| name: ${{ matrix.name }} | ||
| runs-on: ${{ matrix.os }} | ||
| env: | ||
| RELEASE_DIR: inchi-${{ matrix.slug }}-${{ github.sha }} | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the build_and_test block needs the permission to write? |
||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Install dependencies | ||
| run: ${{ matrix.pre_build }} | ||
|
|
||
| - name: Set up Visual Studio shell | ||
| if: runner.os == 'Windows' | ||
| uses: egor-tensin/vs-shell@9a932a62d05192eae18ca370155cf877eecc2202 | ||
| with: | ||
| fetch-depth: 0 | ||
| arch: x64 | ||
|
|
||
| - name: Build executable | ||
| run: | | ||
| cmake -B CMake_build/cli_build -S INCHI-1-SRC/INCHI_EXE/inchi-1/src | ||
| ${{ matrix.build_exe }} | ||
|
|
||
| - name: Checkout release | ||
| # `ref_name` is triggering tag. | ||
| run: git checkout ${{ github.ref_name }} | ||
| - name: Test executable | ||
| run: pytest INCHI-1-TEST/tests/test_executable --exe-path ${{ matrix.exe_path }} | ||
|
|
||
| - name: Build library | ||
| run: | | ||
| cmake -B CMake_build/libinchi_build -S INCHI-1-SRC/INCHI_API/demos/inchi_main/src | ||
| ${{ matrix.build_lib }} | ||
|
|
||
| - name: Test library | ||
| uses: ./.github/actions/regression_tests | ||
| with: | ||
| artifact-name: regression-test-results-${{ matrix.slug }}-${{ github.sha }} | ||
| library-path: ${{ matrix.lib_path }} | ||
| shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }} | ||
|
|
||
| - name: Upload CMake configurations | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: CMake-configurations-${{ matrix.slug }}-${{ github.sha }} | ||
| path: | | ||
| CMake_build/libinchi_build/CMakeCache.txt | ||
| CMake_build/cli_build/CMakeCache.txt | ||
|
|
||
| - name: Build release artifacts | ||
| - name: Collect artifacts | ||
| run: | | ||
| zip -r INCHI-1-BIN.zip INCHI-1-BIN | ||
| zip -r INCHI-1-DOC.zip INCHI-1-DOC | ||
| zip -r INCHI-1-SRC.zip INCHI-1-SRC | ||
| zip -r INCHI-1-TEST.zip INCHI-1-TEST | ||
| mkdir -p ${{ env.RELEASE_DIR }} | ||
| cp ${{ matrix.exe_path }} ${{ env.RELEASE_DIR }} | ||
| cp ${{ matrix.lib_path }} ${{ env.RELEASE_DIR }} | ||
| cp ${{ matrix.main_path }} ${{ env.RELEASE_DIR }} | ||
|
|
||
| - id: upload-unsigned-artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ env.RELEASE_DIR }} | ||
| path: ${{ env.RELEASE_DIR }} | ||
|
|
||
| - name: Sign artifacts | ||
| if: runner.os == 'Windows' | ||
| uses: signpath/github-action-submit-signing-request@ced31329c0317e779dad2eec2a7c3bb46ea1343e | ||
| with: | ||
| api-token: ${{ secrets.SIGNPATH_API_TOKEN }} | ||
| organization-id: 656f8204-f8c5-4028-bd48-f832f5f89b31 | ||
| project-slug: InChI | ||
| signing-policy-slug: test-signing | ||
| github-artifact-id: ${{ steps.upload-unsigned-artifacts.outputs.artifact-id }} | ||
| wait-for-completion: true | ||
| output-artifact-directory: ${{ env.RELEASE_DIR }}-signed | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| if: runner.os == 'Windows' | ||
| with: | ||
| name: ${{ env.RELEASE_DIR }}-signed | ||
| path: ${{ env.RELEASE_DIR }}-signed | ||
|
|
||
| release: | ||
| needs: build_and_test | ||
| runs-on: ubuntu-22.04 | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Download artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: release_artifacts | ||
| pattern: inchi-* | ||
|
|
||
| - name: Package artifacts | ||
| run: zip -r release_artifacts.zip release_artifacts | ||
|
|
||
| - name: Download CMake configurations | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: cmake_configurations | ||
| pattern: CMake-configurations-* | ||
|
|
||
| - name: Package CMake configurations | ||
| run: zip -r cmake_configurations.zip cmake_configurations | ||
|
|
||
| - name: Create release | ||
| # TODO: lift this guard to release job level | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reminder to do the TODO ;) |
||
| if: github.ref_type == 'tag' | ||
| shell: bash | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
@@ -42,4 +154,4 @@ jobs: | |
| --verify-tag \ | ||
| --title "${{ github.ref_name }}" \ | ||
| --notes "For details about this release have a look at the [CHANGELOG](INCHI-1-DOC/CHANGELOG.md)." \ | ||
| INCHI-1-BIN.zip INCHI-1-DOC.zip INCHI-1-SRC.zip INCHI-1-TEST.zip | ||
| release_artifacts.zip cmake_configurations.zip | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Github prefers the ${{ }} syntax, although he encapsulation with ' ' works as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for the other if statement in this file