-
-
Notifications
You must be signed in to change notification settings - Fork 1
155 lines (129 loc) · 4.61 KB
/
main.yml
File metadata and controls
155 lines (129 loc) · 4.61 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
name: CI
on:
push: {}
pull_request: {}
schedule:
# Run daily to catch breakages in new Rust versions as well as new cargo audit findings.
- cron: '0 16 * * *'
workflow_dispatch: {}
env:
CARGO_TERM_COLOR: always
RUST_LOG: info
jobs:
test:
name: Run tests
runs-on: ${{ matrix.rust_os.os }}
strategy:
fail-fast: false
matrix:
rust_os:
- { rust: 1.70.0, os: ubuntu-22.04 }
- { rust: stable, os: ubuntu-22.04 }
- { rust: beta, os: ubuntu-22.04 }
- { rust: nightly, os: ubuntu-22.04 }
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_os.rust }}
components: rustfmt
# Newer dependency versions may not support rustc 1.70, so we use a Cargo.lock file for those
# builds along with `--locked`.
- name: Use Rust 1.70 lockfile
if: ${{ matrix.rust_os.rust == '1.70.0' }}
run: |
cp Cargo-1.70.lock Cargo.lock
echo "CARGO_LOCKED=--locked" >> $GITHUB_ENV
- name: Run default tests
run: cargo ${CARGO_LOCKED} test -vv
petstore-test:
name: Run Petstore example tests
runs-on: ${{ matrix.rust_os.os }}
strategy:
fail-fast: false
matrix:
rust_os:
- { rust: 1.70.0, os: ubuntu-22.04 }
- { rust: stable, os: ubuntu-22.04 }
- { rust: beta, os: ubuntu-22.04 }
- { rust: nightly, os: ubuntu-22.04 }
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_os.rust }}
components: rustfmt
targets: aarch64-unknown-linux-gnu
- name: Install AWS SAM CLI
uses: aws-actions/setup-sam@v2
with:
use-installer: true
# The Petstore example builds for ARM64, but GitHub runners are all x86-64, so we need QEMU.
# See https://github.com/aws/aws-sam-cli/issues/3169#issuecomment-906729604.
- name: Install QEMU
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Install Zig toolchain
uses: korandoru/setup-zig@v1
with:
zig-version: 0.10.0
# See https://www.cargo-lambda.info/guide/getting-started.html#github-actions.
- name: Install Cargo Lambda
uses: jaxxstorm/action-install-gh-release@v1
with:
repo: cargo-lambda/cargo-lambda
tag: v1.0.1
platform: linux
arch: x86_64
# Newer dependency versions may not support rustc 1.70, so we use a Cargo.lock file for those
# builds along with `--locked`.
- name: Use Rust 1.70 lockfile
if: ${{ matrix.rust_os.rust == '1.70.0' }}
run: |
cp Cargo-1.70.lock Cargo.lock
echo "CARGO_LOCKED=--locked" >> $GITHUB_ENV
- name: Build Petstore example SAM template
working-directory: examples/petstore
run: sam build
# NB: Most of the logs produced here will be in the Post action!
- name: Start Petstore example local API
uses: JarvusInnovations/background-action@v1
with:
run: sam local start-api &
wait-on: tcp:localhost:3000
working-directory: examples/petstore
tail: true
log-output-if: true
- name: Run Petstore example integration tests
run: cargo test -p petstore -vv -- --ignored
clippy-fmt:
name: Cargo fmt + clippy (MSRV only)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.70.0
with:
components: clippy, rustfmt
# Newer dependency versions may not support rustc 1.70, so we use a Cargo.lock file for those
# builds along with `--locked`.
- name: Use MSRV lockfile
run: cp Cargo-1.70.lock Cargo.lock
- name: Run Clippy
run: cargo --locked clippy --all -vv -- --deny warnings
# Cargo fmt doesn't run build.rs, so we need to run clippy first in order for
# openapi-lambda-test to pass (since it depends on the .openapi-lambda output directory).
- name: Check fmt
run: cargo --locked fmt --all -v -- --check
audit:
name: Cargo Audit (stable only)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run Cargo Audit
run: |
cargo install --force cargo-audit
cargo --locked audit