-
Notifications
You must be signed in to change notification settings - Fork 97
182 lines (159 loc) · 5.33 KB
/
Copy pathrelease.yml
File metadata and controls
182 lines (159 loc) · 5.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: read
jobs:
create-release:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write
outputs:
tag: ${{ github.ref_name }}
steps:
- name: Create draft release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
gh release create "$TAG" \
--repo "$GITHUB_REPOSITORY" \
--draft \
--title "$TAG"
build:
needs: create-release
runs-on: ${{ matrix.runner }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: codebuild-aws-lambda-cpp-test-trigger-x86-${{ github.run_id }}-${{ github.run_attempt }}
- arch: aarch64
runner: codebuild-aws-lambda-cpp-test-trigger-arm64-${{ github.run_id }}-${{ github.run_attempt }}
steps:
- name: Install prerequisites
env:
AWS_DEFAULT_REGION: eu-west-1
CA_DOMAIN: aws-lambda
CA_DOMAIN_OWNER: ${{ secrets.AWS_ACCOUNT_ID }}
CA_REPO: pypi-store
run: |
aws codeartifact login --tool pip \
--domain "$CA_DOMAIN" --domain-owner "$CA_DOMAIN_OWNER" \
--repository "$CA_REPO"
pip install cmake ninja
cmake --version
ninja --version
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.ref_name }}
- name: Build in Release mode
env:
TAG: ${{ github.ref_name }}
run: |
cmake -B build -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_TESTS=ON \
-DAWS_LAMBDA_CPP_VERSION="${TAG#v}"
cmake --build build
- name: Run unit tests
run: cd build && ctest --output-on-failure
- name: Extract library
run: |
mkdir -p staging
cp build/libaws-lambda-runtime.a staging/libaws-lambda-runtime-${{ matrix.arch }}.a
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: libaws-lambda-runtime-${{ matrix.arch }}
path: staging/libaws-lambda-runtime-${{ matrix.arch }}.a
upload:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
# The signing role's trust policy is scoped to the `environment:release`
# OIDC subject claim. Without this, the token carries a `ref:` subject and
# AssumeRoleWithWebIdentity is denied. See docs/gpg-key-management.md.
environment: release
permissions:
id-token: write
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: artifacts
merge-multiple: true
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@517a711dbcd0e402f90c77e7e2f81e849156e31d # v6.2.2
with:
role-to-assume: ${{ secrets.AWS_GPG_SIGNING_ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Sign artifacts and generate checksums
env:
GPG_SECRET_ID: lambda-runtimes/cpp/gpg-signing-key
run: |
GNUPGHOME="$(mktemp -d)"
chmod 700 "$GNUPGHOME"
export GNUPGHOME
trap 'gpgconf --kill all >/dev/null 2>&1 || true; rm -rf "$GNUPGHOME"' EXIT
aws secretsmanager get-secret-value \
--secret-id "$GPG_SECRET_ID" \
--query SecretString \
--output text \
| gpg --batch --import
FPR="$(gpg --with-colons --list-secret-keys \
| awk -F: '/^fpr:/ {print $10; exit}')"
if [ -z "$FPR" ]; then
echo "No secret key imported from $GPG_SECRET_ID" >&2
exit 1
fi
cd artifacts
# Sign each artifact
for file in *.a; do
gpg --batch --yes --local-user "$FPR" \
--armor --detach-sign "$file"
done
# Generate checksums file and sign it
sha256sum ./*.a > SHA256SUMS
gpg --batch --yes --local-user "$FPR" \
--armor --detach-sign SHA256SUMS
gpg --batch --verify SHA256SUMS.asc SHA256SUMS
for file in *.a; do
gpg --batch --verify "$file.asc" "$file"
done
- name: Upload assets to release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
gh release upload "$TAG" \
--repo "$GITHUB_REPOSITORY" \
artifacts/*
smoke-test:
needs: upload
runs-on: ${{ matrix.runner }}
timeout-minutes: 15
permissions:
contents: write
strategy:
fail-fast: true
matrix:
include:
- arch: x86_64
runner: ubuntu-latest
- arch: aarch64
runner: ubuntu-24.04-arm
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.ref_name }}
- name: OCI + RIE smoke test against the published artifact
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ci/integ/run-oci-smoke.sh "${{ matrix.arch }}" "${{ github.ref_name }}"