-
Notifications
You must be signed in to change notification settings - Fork 8
133 lines (120 loc) · 4.51 KB
/
run-validations.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
name: Validations
on:
push:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
SDK_SUB_KEY: ${{ secrets.SDK_SUB_KEY }}
SDK_PUB_KEY: ${{ secrets.SDK_PUB_KEY }}
SDK_PAM_SUB_KEY: ${{ secrets.SDK_PAM_SUB_KEY }}
SDK_PAM_PUB_KEY: ${{ secrets.SDK_PAM_PUB_KEY }}
SDK_PAM_SEC_KEY: ${{ secrets.SDK_PAM_SEC_KEY }}
jobs:
# pubnub-yml:
# name: "Validate .pubnub.yml"
# runs-on: ubuntu-latest
# steps:
# - name: Checkout project
# uses: actions/checkout@v3
# - name: Checkout validator action
# uses: actions/checkout@v3
# with:
# repository: pubnub/client-engineering-deployment-tools
# ref: v1
# token: ${{ secrets.GH_TOKEN }}
# path: .github/.release/actions
# - name: "Run '.pubnub.yml' file validation"
# uses: ./.github/.release/actions/actions/validators/pubnub-yml
# with:
# token: ${{ secrets.GH_TOKEN }}
# - name: Cancel workflow runs for commit on error
# if: failure()
# uses: ./.github/.release/actions/actions/utils/fast-jobs-failure
linters:
name: Launch all cargo linters to check condition of the code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run cargo check tool to check if the code are valid
run: |
cargo check --workspace --all-targets --features="full"
- name: Run cargo check tool to check if the raw domain code are valid
run: |
cargo check --workspace --no-default-features --features="pubnub_only"
- name: Run cargo check tool to check if the `no_std` code are valid
run: |
cargo check --workspace --all-targets --no-default-features --features="full_no_std"
- name: Run cargo clippy tool to check if all the best code practices are followed
run: |
cargo clippy --workspace --all-targets --features="full" -- -D warnings
- name: Run cargo clippy tool to check if all the best code practices are followed for raw domain code
run: |
cargo clippy --workspace --no-default-features --features="pubnub_only" -- -D warnings
- name: Run cargo clippy tool to check if all the best code practices are followed for `no_std` code
run: |
cargo clippy --workspace --all-targets --no-default-features --features="full_no_std" -- -D warnings
- name: Run cargo fmt tool to check if code are well formatted
run: |
cargo fmt --check --verbose --all
cargo-deny:
name: Check Cargo crate dependencies
runs-on: ubuntu-latest
strategy:
matrix:
checks:
- advisories
- bans licenses sources
# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: ${{ matrix.checks == 'advisories' }}
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}
wasm-target:
name: Check if Web Assembly target compiles as expected
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install WASM target
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Run cargo check tool to check if the WASM code are valid
uses: actions-rs/cargo@v1
with:
command: check
args: --lib --features=full
no_std-target:
name: Check if `no_std` target compiles as expected
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install `no_std` target
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: thumbv7m-none-eabi
- name: Run cargo check tool to check if the `no_std` code are valid
uses: actions-rs/cargo@v1
with:
command: check
args: --lib --no-default-features --features=full_no_std_platform_independent,mock_getrandom
- name: Run cargo check tool to check if the additional example code are valid
uses: actions-rs/cargo@v1
with:
command: check
args: --manifest-path examples/no_std/Cargo.toml --target thumbv7m-none-eabi
all-validations:
name: Validations
runs-on: ubuntu-latest
needs: [linters, cargo-deny, wasm-target, no_std-target]
steps:
- name: Validations summary
run: echo -e "\033[38;2;95;215;0m\033[1mAll validations passed"