Skip to content

Commit 9e1aef5

Browse files
committed
Configure CI on GitHub Actions
Continuous integration has been set up using GitHub Actions. During CI, the code is linted and tested.
1 parent 5a7ba2d commit 9e1aef5

File tree

4 files changed

+227
-0
lines changed

4 files changed

+227
-0
lines changed

.github/workflows/lint.yaml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Lint
3+
4+
on: [push]
5+
6+
jobs:
7+
markdown:
8+
name: Markdown
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
15+
- name: markdownlint-cli
16+
uses: nosborn/[email protected]
17+
with:
18+
files: "**/*.md"
19+
20+
prettier:
21+
name: Prettier
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v2
27+
28+
- name: prettier
29+
uses: creyD/[email protected]
30+
with:
31+
branch: ${{ github.head_ref }}
32+
dry: true
33+
34+
yaml:
35+
name: YAML
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v2
41+
42+
- name: Run yamllint
43+
uses: actionshub/[email protected]

.github/workflows/rust.yaml

+158
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
---
2+
name: Rust
3+
4+
on: [push]
5+
6+
jobs:
7+
clippy:
8+
name: Clippy
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Cache cargo registry
13+
uses: actions/cache@v1
14+
with:
15+
path: ~/.cargo/registry
16+
key: ${{ runner.os }}-stable-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
17+
18+
- name: Cache cargo index
19+
uses: actions/cache@v1
20+
with:
21+
path: ~/.cargo/git
22+
key: ${{ runner.os }}-stable-cargo-index-${{ hashFiles('**/Cargo.lock') }}
23+
24+
- name: Cache cargo build
25+
uses: actions/cache@v1
26+
with:
27+
path: target
28+
key: ${{ runner.os }}-stable-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
29+
30+
- name: Checkout code
31+
uses: actions/checkout@v2
32+
33+
- name: Set up Rust toolchain
34+
uses: actions-rs/toolchain@v1
35+
with:
36+
profile: minimal
37+
toolchain: stable
38+
override: true
39+
components: clippy
40+
41+
- name: Run Clippy
42+
uses: actions-rs/cargo@v1
43+
with:
44+
command: clippy
45+
args: --all-targets --all-features -- -D warnings
46+
47+
rustfmt:
48+
name: Rustfmt
49+
runs-on: ubuntu-latest
50+
51+
steps:
52+
- name: Checkout code
53+
uses: actions/checkout@v2
54+
55+
- name: Set up Rust toolchain
56+
uses: actions-rs/toolchain@v1
57+
with:
58+
profile: minimal
59+
toolchain: stable
60+
override: true
61+
components: rustfmt
62+
63+
- name: Run Rustfmt
64+
uses: actions-rs/cargo@v1
65+
with:
66+
command: fmt
67+
args: --all -- --check
68+
69+
coverage:
70+
name: Test (ubuntu-latest)
71+
runs-on: ubuntu-latest
72+
73+
steps:
74+
- name: Cache cargo registry
75+
uses: actions/cache@v1
76+
with:
77+
path: ~/.cargo/registry
78+
key: ${{ runner.os }}-stable-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
79+
80+
- name: Cache cargo index
81+
uses: actions/cache@v1
82+
with:
83+
path: ~/.cargo/git
84+
key: ${{ runner.os }}-stable-cargo-index-${{ hashFiles('**/Cargo.lock') }}
85+
86+
- name: Cache cargo build
87+
uses: actions/cache@v1
88+
with:
89+
path: target
90+
key: ${{ runner.os }}-stable-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
91+
92+
- name: Checkout code
93+
uses: actions/checkout@v2
94+
95+
- name: Set up Rust toolchain
96+
uses: actions-rs/toolchain@v1
97+
with:
98+
toolchain: stable
99+
override: true
100+
101+
- name: Run cargo-tarpaulin
102+
uses: actions-rs/tarpaulin@master
103+
104+
- name: Upload to codecov.io
105+
uses: codecov/[email protected]
106+
with:
107+
token: ${{ secrets.CODECOV_TOKEN }}
108+
109+
- name: Archive code coverage results
110+
uses: actions/upload-artifact@v1
111+
with:
112+
name: code-coverage-report
113+
path: cobertura.xml
114+
115+
test:
116+
name: Test
117+
strategy:
118+
matrix:
119+
rust:
120+
- stable
121+
- beta
122+
- nightly
123+
runs-on: macos-latest
124+
125+
steps:
126+
- name: Cache cargo registry
127+
uses: actions/cache@v1
128+
with:
129+
path: ~/.cargo/registry
130+
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
131+
132+
- name: Cache cargo index
133+
uses: actions/cache@v1
134+
with:
135+
path: ~/.cargo/git
136+
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
137+
138+
- name: Cache cargo build
139+
uses: actions/cache@v1
140+
with:
141+
path: target
142+
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
143+
144+
- name: Checkout code
145+
uses: actions/checkout@v2
146+
147+
- name: Set up Rust toolchain
148+
uses: actions-rs/toolchain@v1
149+
with:
150+
profile: minimal
151+
toolchain: ${{ matrix.rust }}
152+
override: true
153+
154+
- name: Run tests
155+
uses: actions-rs/cargo@v1
156+
with:
157+
command: test
158+
args: --verbose

.github/workflows/security.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Security
3+
4+
on:
5+
schedule:
6+
- cron: "0 0 * * *"
7+
8+
jobs:
9+
audit:
10+
name: Audit
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
- name: Run security audit
18+
uses: actions-rs/audit-check@v1
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}

.yamllint.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extends: default
2+
3+
rules:
4+
line-length:
5+
max: 80
6+
level: warning

0 commit comments

Comments
 (0)