-
Notifications
You must be signed in to change notification settings - Fork 11
189 lines (156 loc) · 5.43 KB
/
test.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
---
name: Test
on:
# Allow running this workflow manually from the Actions tab
workflow_dispatch:
pull_request:
push:
branches:
- main
# Run weekly on the default branch to make sure it always builds with the latest rust release
schedule:
- cron: '30 5 * * 1'
jobs:
rustfmt:
if: github.event_name != 'schedule'
runs-on: ubuntu-20.04
steps:
- name: Checkout the repo
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Install Rust nightly toolchain
run: rustup toolchain install --no-self-update nightly --profile minimal -c rustfmt
- name: Format check
run: cargo +nightly fmt --all -- --check
clippy:
if: github.event_name != 'schedule'
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
flags: --all-features
- os: macos-14
flags: --all-features
- os: windows-latest
flags: --no-default-features -F extensions
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repo
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- if: ${{ runner.os == 'macOS' }}
name: Install protoc
run: brew install protobuf
- if: ${{ runner.os == 'Linux' }}
name: Install protoc
run: sudo apt install -y protobuf-compiler
- if: ${{ runner.os == 'Windows' }}
name: Install protoc
run: choco install protoc
- name: Install Rust toolchain
run: rustup toolchain install --no-self-update stable --profile minimal -c clippy
- name: Clippy
run: cargo +stable clippy --locked ${{ matrix.flags }} --all-targets -- -D warnings
test-matrix:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-14]
include:
- os: windows-latest
flags: --no-default-features -F extensions
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repo
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- if: ${{ runner.os == 'macOS' }}
name: Install protoc
run: brew install protobuf
- if: ${{ runner.os == 'Linux' }}
name: Install protoc
run: sudo apt install -y protobuf-compiler
- if: ${{ runner.os == 'Windows' }}
name: Install protoc
run: choco install protoc
- name: Install Rust toolchain
run: rustup toolchain install --no-self-update stable --profile minimal
- name: Test
run: cargo +stable test --locked ${{ matrix.flags }}
oldstable:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-14, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repo
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- if: ${{ runner.os == 'macOS' }}
name: Install protoc
run: brew install protobuf
- if: ${{ runner.os == 'Linux' }}
name: Install protoc
run: sudo apt install -y protobuf-compiler
- if: ${{ runner.os == 'Windows' }}
name: Install protoc
run: choco install protoc
- name: Oldstable
shell: bash
run: |
oldstable=$(grep rust-version ./cli/Cargo.toml | sed 's/.*"\(.*\)".*/\1/')
rustup toolchain install --profile minimal "${oldstable}"
cargo "+${oldstable}" check
all-features:
# Skip this job when the secret is unavailable
if: github.secret_source == 'Actions'
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-14]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repo
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- if: ${{ runner.os == 'macOS' }}
name: Install protoc
run: brew install protobuf
- if: ${{ runner.os == 'Linux' }}
name: Install protoc
run: sudo apt install -y protobuf-compiler
- name: Install Rust toolchain
run: rustup toolchain install --no-self-update stable --profile minimal
- name: All Features
env:
PHYLUM_API_KEY: ${{ secrets.PHYLUM_TOKEN_STAGING }}
run: cargo +stable test --all-features
deno-checks:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
container: denoland/deno
steps:
- name: Checkout the repo
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: deno fmt
run: deno fmt --check
- name: deno lint
run: deno lint
- name: deno check
run: deno check --no-lock extensions/**/*.ts
shellcheck:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Script Style Check
run: find . -iname "*.sh" -print0 | xargs -0 shellcheck -o all -S style -s sh
# This job reports the results of the test jobs above and is used
# to enforce status checks in the repo settings without needing
# to update those settings every time the test jobs are updated.
test:
if: always()
needs: [clippy, test-matrix, oldstable, all-features]
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
name: Fail the build
run: exit 1