-
Notifications
You must be signed in to change notification settings - Fork 7
130 lines (120 loc) · 3.42 KB
/
checks.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
name: Checks
on:
- push
env:
CARGO_TERM_COLOR: always
jobs:
# ---
# --- Run tests and lints for Rust library
# ---
test:
runs-on: ubuntu-latest
strategy:
matrix:
crate:
- .
- compact-calendar
- opening-hours-py
- opening-hours-syntax
- fuzz
features: [""]
include:
- { crate: ".", features: "log" }
- { crate: ".", features: "log,auto-country" }
- { crate: ".", features: "log,auto-country,auto-timezone" }
- { crate: ".", features: "log,auto-timezone" }
- { crate: "opening-hours-syntax", features: "log" }
defaults:
run:
working-directory: ${{ matrix.crate }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
token: ${{ secrets.GITHUB_TOKEN }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy
- name: Display rust version
run: |
rustc --version
cargo clippy -- --version
cargo fmt -- --version
- name: Lint
run: cargo clippy --no-default-features --features "${{ matrix.features }}" -- -D warnings
- name: Format
run: cargo fmt -- --check
- name: Tests
run: cargo test --no-default-features --features "${{ matrix.features }}"
# ---
# --- Check that all versions are consistency accross packages
# ---
check-version:
runs-on: ubuntu-latest
defaults:
run:
working-directory: scripts
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Install dependancies
run: poetry install
- name: Check version consistency
run: poetry run ./check-version.py
# ---
# --- Check that python stub file is up to date
# ---
check-stub:
runs-on: ubuntu-latest
defaults:
run:
working-directory: opening-hours-py
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy
- uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Install poetry deps
run: poetry install --with dev
- name: Check that Python stub file is up to date
run: cargo run --bin stub_gen -- check
# ---
# --- Calculate coverage using tarpaulin
# ---
coverage:
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Python library
run: apt-get update && apt-get install -yy python3-dev && apt-get clean
- name: Generate code coverage
run: >-
cargo +nightly tarpaulin --out xml
--ignore-panics --ignore-tests
--workspace
--all-features
--run-types Tests
--run-types Doctests
- name: Upload to codecov.io
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
token: ${{secrets.CODECOV_TOKEN}}