-
Notifications
You must be signed in to change notification settings - Fork 241
141 lines (132 loc) · 4.95 KB
/
ci.yaml
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
on:
push:
branches:
- main
- fix-ci
workflow_dispatch:
name: CI
env:
SDK_BATCH_COUNT: 32
EXAMPLES_BATCH_COUNT: 4
RUST_VERSIONS: "stable"
RUST_VERSION: "stable"
jobs:
generate-test-sdk-matrix:
runs-on: ubuntu-latest
name: Generate Test Matrix (SDK)
steps:
- uses: actions/checkout@v3
- name: Generate the matrix
id: generate-matrix
# Run the `crate-range.py` script to calculate a matrix for the `test-sdk` job.
# This script outputs JSON that GitHub Actions can consume as a matrix definition.
# Rust versions to test against are arguments to this script.
run: echo "matrix=$(./tools/ci/crate-range.py generate-matrix -b ${SDK_BATCH_COUNT} --folder sdk ${RUST_VERSIONS})" >> "${GITHUB_OUTPUT}"
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
test-sdk:
needs: generate-test-sdk-matrix
runs-on: ubuntu-latest
name: Compile & Test SDK
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: ""
RUSTDOCFLAGS: ""
strategy:
# Use the matrix generated by the previous job
matrix: ${{ fromJson(needs.generate-test-sdk-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_version }}
# Pinned to the commit hash of v2.1.0
- uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd
with:
shared-key: test
- name: Cargo Test
run: ./tools/ci/crate-range.py run ${{ matrix.crate_range }} --folder sdk -- cargo test --all-features
- name: Cargo Doc
run: ./tools/ci/crate-range.py run ${{ matrix.crate_range }} --folder sdk -- cargo doc --all-features --no-deps
# Psuedo-job that depends on the test job so that we don't have to enter
# the myriad of crate range combinations into GitHub's protected branch rules
require-test-sdk:
needs: test-sdk
# Run this job even if its dependency jobs fail
if: always()
runs-on: ubuntu-latest
name: Test Matrix Success (SDK)
steps:
- name: Verify jobs succeeded
# Pinned to commit hash of v1.2.2
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
with:
jobs: ${{ toJSON(needs) }}
generate-check-examples-matrix:
runs-on: ubuntu-latest
name: Generate Check Matrix (examples)
steps:
- uses: actions/checkout@v3
- name: Generate the matrix
id: generate-matrix
# Run the `crate-range.py` script to calculate a matrix for the `check-examples` job.
# This script outputs JSON that GitHub Actions can consume as a matrix definition.
# Rust versions to check against are arguments to this script.
run: echo "matrix=$(./tools/ci/crate-range.py generate-matrix -b ${EXAMPLES_BATCH_COUNT} --folder examples ${RUST_VERSIONS})" >> "${GITHUB_OUTPUT}"
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
check-examples:
needs: generate-check-examples-matrix
runs-on: ubuntu-latest
name: Check Examples
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: ""
RUSTDOCFLAGS: ""
strategy:
# Use the matrix generated by the previous job
matrix: ${{ fromJson(needs.generate-check-examples-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_version }}
targets: wasm32-unknown-unknown
# Pinned to the commit hash of v2.1.0
- uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd
with:
shared-key: check
- name: Cargo Check
run: ./tools/ci/crate-range.py run ${{ matrix.crate_range }} --folder examples -- cargo check --all-features
# Psuedo-job that depends on the check job so that we don't have to enter
# the myriad of crate range combinations into GitHub's protected branch rules
require-check-examples:
needs: check-examples
# Run this job even if its dependency jobs fail
if: always()
runs-on: ubuntu-latest
name: Check Matrix Success (examples)
steps:
- name: Verify jobs succeeded
# Pinned to commit hash of v1.2.2
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
with:
jobs: ${{ toJSON(needs) }}
check-manifests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: awslabs/smithy-rs
path: smithy-rs
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "${{ env.RUST_VERSION }}"
# Pinned to the commit hash of v2.1.0
- uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd
with:
shared-key: check-manifests
- name: check manifests
working-directory: smithy-rs/tools/ci-build/publisher
run: cargo run fix-manifests --check --location ../../../../sdk