-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (120 loc) · 3.37 KB
/
check.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
name: 'Code checks'
on:
push:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -euxlo pipefail {0}
jobs:
format:
name: 'Format'
runs-on: ubuntu-22.04
env:
TITLE: ${{ github.event.pull_request.title }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Format code
uses: ./.github/actions/format
- name: Ignore some changes
run: while read -r line ; do git checkout "$line" ; done <.relaxedfmt
- name: Check formatted
run: |
test -z "$(git status --porcelain | grep -v --file .relaxedfmt)" || {
echo "FIX: Please run ./scripts/fmt"
git diff
exit 1
}
sh-tests:
name: "Shell tests"
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install tools
run: sudo apt-get install -yy shellcheck
- name: Lint shell
run: ./scripts/lint-sh
rust-tests:
name: "Rust tests"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Have relevant files changed?
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
test:
- '.github/workflows/check.yml'
- '**/*.rs'
- '**/Cargo.*'
- 'rust-toolchain.toml'
- uses: actions/cache@v4
if: steps.changes.outputs.test == 'true'
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Lint rust code
if: steps.changes.outputs.test == 'true'
run: ./scripts/lint-rs
- name: Run Unit Tests
if: steps.changes.outputs.test == 'true'
shell: bash
run: scripts/test-rs
installation:
name: "dfx deploy & integration"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Have relevant files changed?
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
test:
- '!**/*.md'
- uses: actions/cache@v4
if: steps.changes.outputs.test == 'true'
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install dfx
uses: dfinity/setup-dfx@main
- name: Install build tools
run: scripts/setup cargo-binstall candid-extractor ic-wasm
- name: Start dfx
run: dfx start --clean --background
- name: Deploy all canisters
run: dfx deploy
- name: Verify that bindings are up to date
uses: ./.github/actions/bindings
- name: Run integration tests
run: ./scripts/test.signer.sh
- name: Stop dfx
run: dfx stop
check-pass:
name: "Checks pass"
needs: ["format", "rust-tests", "sh-tests", "installation"]
if: ${{ always() }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/needs_success
with:
needs: '${{ toJson(needs) }}'