|
1 | | -# Trigger this workflow by pushing a release tag. |
2 | | -# Make sure that `HEAD` is pointing to the commit you want to release. |
3 | | -# Then run `git tag -a v<version_tag> -m "Release version <version_tag> (<yyyy>-<mm>-<dd>)" && git push && git push --tags`. |
4 | | -# For example `git tag -a v1.06 -m "Release version 1.06 (2020-12-20)" && git push && git push --tags`. |
5 | | -name: InChI Release |
| 1 | +name: Release |
6 | 2 |
|
7 | 3 | on: |
| 4 | + workflow_dispatch: |
8 | 5 | push: |
| 6 | + # TODO: Remove branches trigger. |
| 7 | + branches: [ release-automation ] |
| 8 | + # Trigger this workflow by pushing a release tag. |
| 9 | + # Make sure that `HEAD` is pointing to the commit you want to release. |
| 10 | + # Then run `git tag -a v<version_tag> -m "Release version <version_tag> (<yyyy>-<mm>-<dd>)" && git push && git push --tags`. |
| 11 | + # For example `git tag -a v1.06 -m "Release version 1.06 (2020-12-20)" && git push && git push --tags`. |
9 | 12 | tags: |
10 | 13 | - v1.* |
11 | 14 |
|
12 | 15 | jobs: |
13 | | - release: |
14 | | - runs-on: ubuntu-latest |
| 16 | + define_matrix: |
| 17 | + runs-on: ubuntu-22.04 |
| 18 | + outputs: |
| 19 | + matrix: ${{ steps.define_matrix.outputs.matrix }} |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Define build matrix |
| 24 | + id: define_matrix |
| 25 | + # The build matrix is used to interpolate commands and inputs throughout the remainder of the workflow. |
| 26 | + # Since those interpolations are potentially security-sensitive, we verify the hash of the build matrix. |
| 27 | + if: ${{ hashFiles('.github/workflows/build_matrix.json') == 'ae87ded543b131908cf5aed1502d0e39b2cb9374693598ef7f09c5c5a8be4e52' }} |
| 28 | + run: | |
| 29 | + echo "matrix=$(cat .github/workflows/build_matrix.json| jq -c .)" >> $GITHUB_OUTPUT |
| 30 | +
|
| 31 | + build_and_test: |
| 32 | + needs: define_matrix |
| 33 | + strategy: |
| 34 | + matrix: |
| 35 | + include: |
| 36 | + ${{ fromJson(needs.define_matrix.outputs.matrix) }} |
| 37 | + name: ${{ matrix.name }} |
| 38 | + runs-on: ${{ matrix.os }} |
| 39 | + env: |
| 40 | + RELEASE_DIR: inchi-${{ matrix.slug }}-${{ github.sha }} |
15 | 41 |
|
16 | 42 | permissions: |
17 | 43 | contents: write |
18 | 44 |
|
19 | 45 | steps: |
20 | 46 | - uses: actions/checkout@v4 |
| 47 | + |
| 48 | + - uses: actions/setup-python@v5 |
21 | 49 | with: |
22 | | - fetch-depth: 0 |
| 50 | + python-version: '3.12' |
| 51 | + |
| 52 | + - name: Install dependencies |
| 53 | + run: ${{ matrix.pre_build }} |
| 54 | + |
| 55 | + - name: Set up Visual Studio shell |
| 56 | + if: runner.os == 'Windows' |
| 57 | + uses: egor-tensin/vs-shell@9a932a62d05192eae18ca370155cf877eecc2202 |
| 58 | + with: |
| 59 | + arch: x64 |
| 60 | + |
| 61 | + - name: Build executable |
| 62 | + run: | |
| 63 | + cmake -B CMake_build/cli_build -S INCHI-1-SRC/INCHI_EXE/inchi-1/src |
| 64 | + ${{ matrix.build_exe }} |
| 65 | +
|
| 66 | + - name: Test executable |
| 67 | + run: pytest INCHI-1-TEST/tests/test_executable --exe-path ${{ matrix.exe_path }} |
| 68 | + |
| 69 | + - name: Build library |
| 70 | + run: | |
| 71 | + cmake -B CMake_build/libinchi_build -S INCHI-1-SRC/INCHI_API/demos/inchi_main/src |
| 72 | + ${{ matrix.build_lib }} |
23 | 73 |
|
24 | | - - name: Checkout release |
25 | | - # `ref_name` is triggering tag. |
26 | | - run: git checkout ${{ github.ref_name }} |
| 74 | + - name: Test library |
| 75 | + uses: ./.github/actions/regression_tests |
| 76 | + with: |
| 77 | + artifact-name: regression-test-results-${{ matrix.slug }}-${{ github.sha }} |
| 78 | + test-config: INCHI-1-TEST/tests/test_library/config/config_regression_${{ matrix.slug }}.py |
| 79 | + shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }} |
27 | 80 |
|
28 | | - - name: Build release artifacts |
| 81 | + - name: Collect artifacts |
29 | 82 | run: | |
30 | | - zip -r INCHI-1-BIN.zip INCHI-1-BIN |
31 | | - zip -r INCHI-1-DOC.zip INCHI-1-DOC |
32 | | - zip -r INCHI-1-SRC.zip INCHI-1-SRC |
33 | | - zip -r INCHI-1-TEST.zip INCHI-1-TEST |
| 83 | + mkdir -p ${{ env.RELEASE_DIR }} |
| 84 | + cp ${{ matrix.exe_path }} ${{ env.RELEASE_DIR }} |
| 85 | + cp ${{ matrix.lib_path }} ${{ env.RELEASE_DIR }} |
| 86 | + cp ${{ matrix.main_path }} ${{ env.RELEASE_DIR }} |
| 87 | +
|
| 88 | + - id: upload-unsigned-artifacts |
| 89 | + uses: actions/upload-artifact@v4 |
| 90 | + with: |
| 91 | + name: ${{ env.RELEASE_DIR }} |
| 92 | + path: ${{ env.RELEASE_DIR }} |
| 93 | + |
| 94 | + - name: Sign artifacts |
| 95 | + if: runner.os == 'Windows' |
| 96 | + uses: signpath/github-action-submit-signing-request@4f13d373e8f0cd8d3c0465ff4877feff27aed2ae |
| 97 | + with: |
| 98 | + api-token: ${{ secrets.SIGNPATH_API_TOKEN }} |
| 99 | + organization-id: 656f8204-f8c5-4028-bd48-f832f5f89b31 |
| 100 | + project-slug: InChI |
| 101 | + signing-policy-slug: test-signing |
| 102 | + github-artifact-id: ${{ steps.upload-unsigned-artifacts.outputs.artifact-id }} |
| 103 | + wait-for-completion: true |
| 104 | + output-artifact-directory: ${{ env.RELEASE_DIR }}-signed |
| 105 | + |
| 106 | + - uses: actions/upload-artifact@v4 |
| 107 | + if: runner.os == 'Windows' |
| 108 | + with: |
| 109 | + name: ${{ env.RELEASE_DIR }}-signed |
| 110 | + path: ${{ env.RELEASE_DIR }}-signed |
| 111 | + |
| 112 | + release: |
| 113 | + needs: build_and_test |
| 114 | + if: github.ref_type == 'tag' |
| 115 | + runs-on: ubuntu-22.04 |
| 116 | + permissions: |
| 117 | + contents: write |
| 118 | + |
| 119 | + steps: |
| 120 | + - name: Download artifacts |
| 121 | + uses: actions/download-artifact@v4 |
| 122 | + with: |
| 123 | + path: release_artifacts |
| 124 | + pattern: inchi-* |
| 125 | + |
| 126 | + - name: Package artifacts |
| 127 | + run: zip -r release_artifacts.zip release_artifacts |
34 | 128 |
|
35 | 129 | - name: Create release |
36 | 130 | shell: bash |
|
42 | 136 | --verify-tag \ |
43 | 137 | --title "${{ github.ref_name }}" \ |
44 | 138 | --notes "For details about this release have a look at the [CHANGELOG](INCHI-1-DOC/CHANGELOG.md)." \ |
45 | | - INCHI-1-BIN.zip INCHI-1-DOC.zip INCHI-1-SRC.zip INCHI-1-TEST.zip |
| 139 | + release_artifacts.zip |
0 commit comments