generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 281
91 lines (84 loc) · 2.93 KB
/
ci.yaml
File metadata and controls
91 lines (84 loc) · 2.93 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
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"
permissions:
contents: read
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) }}
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