-
-
Notifications
You must be signed in to change notification settings - Fork 29
120 lines (102 loc) · 2.74 KB
/
test.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: Test
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
STABLE_PYTHON_VERSION: "3.11"
jobs:
test:
name: ${{ matrix.job.target }} (${{ matrix.job.os }})
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
# Linux
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
cross: true
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
cross: true
test: true
validate: true
- target: x86_64-unknown-linux-musl
os: ubuntu-22.04
cross: true
- target: i686-unknown-linux-gnu
os: ubuntu-22.04
cross: true
- target: powerpc64le-unknown-linux-gnu
os: ubuntu-22.04
cross: true
# Windows
- target: x86_64-pc-windows-msvc
os: windows-2022
test: true
- target: i686-pc-windows-msvc
os: windows-2022
# macOS
- target: aarch64-apple-darwin
os: macos-12
- target: x86_64-apple-darwin
os: macos-12
test: true
env:
CARGO: cargo
CARGO_BUILD_TARGET: "${{ matrix.job.target }}"
PYAPP_PROJECT_NAME: cowsay
PYAPP_PROJECT_VERSION: "5.0.0"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ env.STABLE_PYTHON_VERSION }}
if: matrix.job.validate
uses: actions/setup-python@v4
with:
python-version: ${{ env.STABLE_PYTHON_VERSION }}
- name: Validate
if: matrix.job.validate
run: python scripts/validate_options.py
- name: Set up cross compiling
if: matrix.job.cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Configure cross compiling
if: matrix.job.cross
run: echo "CARGO=cross" >> $GITHUB_ENV
- name: Configure target
run: |-
config_file=".cargo/config_${{ matrix.job.target }}.toml"
if [[ -f "$config_file" ]]; then
mv "$config_file" .cargo/config.toml
fi
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.job.target }}
components: clippy, rustfmt
- name: Lint
run: $CARGO clippy --no-deps
- name: Format
if: matrix.job.validate
run: cargo fmt --check
- name: See dependency tree
run: $CARGO tree
- name: Build
if: ${{ !matrix.job.test }}
run: $CARGO build
- name: Test
if: matrix.job.test
run: cargo run -- Moo Success!