-
Notifications
You must be signed in to change notification settings - Fork 1
127 lines (126 loc) · 4.47 KB
/
ci.yaml
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
# SPDX-FileCopyrightText: 2024 Cognitive Disorders Research Lab
#
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
---
name: Continuous integration
on:
push:
branches:
- 'main'
pull_request:
branches:
- main
types:
- closed
workflow_dispatch:
concurrency:
group: CI
env:
GIST_KEY: {{ dynamic-badge-gist }} # pragma: allowlist secret
RUST_BACKTRACE: 1
MINIMUM_WAIT: 3
MAXIMUM_WAIT: 10
jobs:
ci:
runs-on: ${{matrix.os}}-latest
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || github.event_name == 'workflow_dispatch'
outputs:
result: ${{steps.result.outputs.result}}
strategy:
fail-fast: false
matrix:
rust:
- stable
- beta
- nightly
- {{ msrv }} # MSRV
os:
- windows
- ubuntu
- macos
include:
- os: windows
logo: windows
- os: ubuntu
logo: ubuntu
- os: macos
logo: apple
- rust: {{ msrv }} # MSRV
label: msrv
- rust: stable
label: stable
- rust: beta
label: beta
- rust: nightly
label: nightly
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
components: rustfmt, clippy
- name: Install nightly Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
components: rustfmt, clippy
- name: Cache dependencies
uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # v2.2.1
- name: Cargo Build
run: cargo build --verbose
- name: Cargo Test
run: cargo test
- name: Cargo Format
run: cargo +nightly fmt --all -- --check
- name: Cargo Lint
run: cargo clippy -- -D warnings
- name: Wait before badge creation
uses: AliSajid/[email protected]
with:
minimum: ${{env.MINIMUM_WAIT}}
maximum: ${{env.MAXIMUM_WAIT}}
- name: Create Awesome Badge - Success
uses: schneegans/dynamic-badges-action@5d424ad4060f866e4d1dab8f8da0456e6b1c4f56 # v1.6.0
if: success()
with:
auth: ${{secrets.GIST_SECRET}}
gistID: ${{env.GIST_KEY}}
filename: ${{matrix.os}}-${{matrix.label}}.json
label: Build
namedLogo: ${{matrix.logo}}
message: Succeeded
color: green
- name: Create Awesome Badge - Failure
uses: schneegans/dynamic-badges-action@5d424ad4060f866e4d1dab8f8da0456e6b1c4f56 # v1.6.0
if: failure()
with:
auth: ${{secrets.GIST_SECRET}}
gistID: ${{env.GIST_KEY}}
filename: ${{matrix.os}}-${{matrix.label}}.json
namedLogo: ${{matrix.logo}}
label: Build
message: Failed
isError: true
- name: Set Result
if: always()
id: result
run: echo "result=${{job.status}}" >> "$GITHUB_OUTPUT"
generate_code_coverage:
uses: ./.github/workflows/code_coverage.yaml
needs: [ci]
secrets: inherit # pragma: allowlist secret
generate_mdbook:
uses: ./.github/workflows/deploy_mdbook.yaml
needs: [ci]
secrets: inherit # pragma: allowlist secret
get-next-version:
uses: ./.github/workflows/get_next_version.yaml
needs: [ci]
secrets: inherit # pragma: allowlist secret
semantic-release:
needs: [ci, get-next-version]
if: ${{needs.get-next-version.outputs.new-release-published == 'true'}}
uses: ./.github/workflows/release.yaml
secrets: inherit # pragma: allowlist secret