-
Notifications
You must be signed in to change notification settings - Fork 0
190 lines (164 loc) · 6.22 KB
/
test_and_package_development.yml
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
183
184
185
186
187
188
189
190
name: Test and package development builds
on:
workflow_call:
inputs:
ref:
description: "ref to build"
required: true
type: string
outputs:
abq_version:
description: "Released ABQ version"
value: ${{ jobs.release.outputs.abq_version }}
secrets:
RWX_ACCESS_TOKEN:
required: true
RWX_STAGING_CREATE_RELEASE_ACCESS_TOKEN:
required: true
AWS_S3_ABQ_RELEASES_STAGING_ACCESS_KEY_ID:
required: true
AWS_S3_ABQ_RELEASES_STAGING_SECRET_ACCESS_KEY:
required: true
jobs:
release:
name: Build, Upload, Release ABQ
# We only need x86-64 statically-linked binaries for development testing.
runs-on: ubuntu-latest
outputs:
abq_version: ${{ steps.abq_version.outputs.abq_version }}
env:
AWS_DEFAULT_REGION: us-east-2
AWS_DEFAULT_OUTPUT: json
RUST_TARGET: x86_64-unknown-linux-musl
ABQ_DEVELOPMENT_BUILD: 1
ABQ_NO_REBUILD: true
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # get whole history for versioning
- name: Mark safe directory
run: |
# For some reason we need this, even though actions/checkout sets
# safe.directory by default?
# Perhaps it is because we work in a container?
git config --global --add safe.directory "$PWD"
git describe
# this may not be unecessary when https://github.com/actions/checkout/issues/882 is resolved
- name: re-fetch overwritten tag
run: git fetch --tags --force
- name: check for typos
uses: crate-ci/typos@master
- name: Install musl libc tools
run: |
sudo apt-get install -y musl-tools
- name: Restore cargo cache
uses: actions/[email protected]
env:
cache-name: ci
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-release-unstable-1-linux_x86-64-musl-${{ hashFiles('rust-toolchain.toml')}}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
cargo-release-unstable-1-linux_x86-64-musl-${{ hashFiles('rust-toolchain.toml')}}-
- name: Install Rust toolchain
uses: rwx-research/rust-toolchain@abq
with:
toolchain: 1.81.0
target: ${{ env.RUST_TARGET }}
components: clippy, rustfmt
- name: Check formatting
uses: actions-rs/[email protected]
with:
command: fmt
args: -- --check
- name: Run lints
uses: actions-rs/[email protected]
with:
command: clippy
args: --workspace --tests --profile=release-unstable --all-features --target=${{ env.RUST_TARGET }} -- --deny warnings
- name: Lint github workflows
run: |
echo "::add-matcher::.github/actionlint-matcher.json"
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/97871a555712e90a2f4f9ae0f42794bd61af88bc/scripts/download-actionlint.bash)
./actionlint -color
shell: bash
# setup testdata
- uses: actions/setup-node@v4
with:
node-version: "14"
cache: "npm"
cache-dependency-path: "testdata/**/package-lock.json"
- name: Load test dependencies
run: |
scripts/init_testdata
# End setup testdata
- name: Build release with tests
run: |
cargo build --tests --bins --profile=release-unstable --all-features --target="$RUST_TARGET"
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: install captain
uses: rwx-research/setup-captain@v1
- name: Run tests with cargo
timeout-minutes: 4
if: github.run_attempt == 1
run: |
captain run test-abq
env:
CI: false
RWX_ACCESS_TOKEN: ${{ secrets.RWX_ACCESS_TOKEN }}
- name: Run retried tests with cargo, including debug output
timeout-minutes: 5
if: github.run_attempt > 1
run: |
export ABQ_DEBUG_CLI_TESTS_FOR_CI=1
captain run test-abq -- --nocapture
env:
CI: false
RWX_ACCESS_TOKEN: ${{ secrets.RWX_ACCESS_TOKEN }}
- name: Prepare release environment
run: |
ABQ_VERSION="$(cat build_artifact/abq_version.txt)"
RELEASE_DIR="abq_${ABQ_VERSION}_linux_x86-64"
RELEASE_ARCHIVE="${RELEASE_DIR}.tar.gz"
{
echo "ABQ_VERSION=$ABQ_VERSION"
echo "RELEASE_DIR=$RELEASE_DIR"
echo "RELEASE_ARCHIVE=$RELEASE_ARCHIVE"
echo "RELEASE_S3_OBJECT=abq/${ABQ_VERSION}/${RELEASE_ARCHIVE}"
echo "RELEASE_S3_NIGHTLY_OBJECT=abq/nightly/abq_nightly_linux_x86-64"
echo "NEW_RELEASE_S3_OBJECT=abq/${ABQ_VERSION}/linux/x86_64/abq"
echo "NEW_RELEASE_S3_NIGHTLY_OBJECT=abq/nightly/linux/x86_64/abq"
echo "NEW_RELEASE_S3_OBJECT_TESTER_HARNESS=abq/${ABQ_VERSION}/linux/x86_64/abq_tester_harness"
echo "NEW_RELEASE_S3_NIGHTLY_OBJECT_TESTER_HARNESS=abq/nightly/linux/x86_64/abq_tester_harness"
} >> "$GITHUB_ENV"
- name: Prepare release
id: prepare_release
run: |
mkdir "${RELEASE_DIR}"
cp "target/$RUST_TARGET/release-unstable/abq" "${RELEASE_DIR}"
cp "target/$RUST_TARGET/release-unstable/abq_tester_harness" "${RELEASE_DIR}"
tar -czvf "${RELEASE_ARCHIVE}" "${RELEASE_DIR}"
- name: Push release to staging S3
env:
RELEASE_BUCKET: abq-releases-staging
run: |
scripts/upload-to-aws.sh ${{ secrets.AWS_S3_ABQ_RELEASES_STAGING_ACCESS_KEY_ID }} ${{ secrets.AWS_S3_ABQ_RELEASES_STAGING_SECRET_ACCESS_KEY }} staging
- name: export abq version
id: abq_version
run: |
echo "abq_version=${ABQ_VERSION}" >> "$GITHUB_OUTPUT"
notify-api:
name: Release new abq to staging API
needs: release
uses: ./.github/workflows/release_staging.yml
with:
version: ${{ needs.release.outputs.abq_version }}
secrets:
RWX_STAGING_CREATE_RELEASE_ACCESS_TOKEN: ${{ secrets.RWX_STAGING_CREATE_RELEASE_ACCESS_TOKEN }}