Skip to content

Commit e301b43

Browse files
committed
Sign artifacts
1 parent 64aeebe commit e301b43

File tree

3 files changed

+120
-93
lines changed

3 files changed

+120
-93
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 73 deletions
This file was deleted.

.github/workflows/build_matrix.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"pre_build": "sudo apt update && sudo apt install -y cmake && python3 -m pip install -e INCHI-1-TEST[invariance-tests]",
77
"build_exe": "cmake --build CMake_build/cli_build",
88
"build_lib": "cmake --build CMake_build/libinchi_build",
9-
"exe_path": "CMake_build/cli_build/bin/inchi-1"
9+
"exe_path": "CMake_build/cli_build/bin/inchi-1",
10+
"lib_path": "CMake_build/libinchi_build/bin/libinchi.so",
11+
"main_path": "CMake_build/libinchi_build/bin/inchi_main"
1012
},
1113
{
1214
"os": "windows-2022",
@@ -15,7 +17,9 @@
1517
"pre_build": "python -m pip install -e INCHI-1-TEST[invariance-tests]",
1618
"build_exe": "cmake --build CMake_build/cli_build --config Release",
1719
"build_lib": "cmake --build CMake_build/libinchi_build --config Release",
18-
"exe_path": "CMake_build/cli_build/bin/Release/inchi-1.exe"
20+
"exe_path": "CMake_build/cli_build/bin/Release/inchi-1.exe",
21+
"lib_path": "CMake_build/libinchi_build/bin/Release/libinchi.dll",
22+
"main_path": "CMake_build/libinchi_build/bin/Release/inchi_main.exe"
1923

2024
},
2125
{
@@ -25,6 +29,8 @@
2529
"pre_build": "python -m pip install -e INCHI-1-TEST[invariance-tests]",
2630
"build_exe": "cmake --build CMake_build/cli_build",
2731
"build_lib": "cmake --build CMake_build/libinchi_build",
28-
"exe_path": "CMake_build/cli_build/bin/inchi-1"
32+
"exe_path": "CMake_build/cli_build/bin/inchi-1",
33+
"lib_path": "CMake_build/libinchi_build/bin/libinchi.dylib",
34+
"main_path": "CMake_build/libinchi_build/bin/inchi_main"
2935
}
3036
]

.github/workflows/release.yml

Lines changed: 111 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,130 @@
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
62

73
on:
4+
workflow_dispatch:
85
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`.
912
tags:
1013
- v1.*
1114

1215
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 }}
1541

1642
permissions:
1743
contents: write
1844

1945
steps:
2046
- uses: actions/checkout@v4
47+
48+
- uses: actions/setup-python@v5
2149
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 }}
2373
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' }}
2780

28-
- name: Build release artifacts
81+
- name: Collect artifacts
2982
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
34128

35129
- name: Create release
36130
shell: bash
@@ -42,4 +136,4 @@ jobs:
42136
--verify-tag \
43137
--title "${{ github.ref_name }}" \
44138
--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

Comments
 (0)