-
Notifications
You must be signed in to change notification settings - Fork 347
114 lines (97 loc) · 3.42 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
on: [push, pull_request]
name: Continuous integration
jobs:
build:
name: Test ${{ matrix.job.target }}
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
# Operating systems available: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04 }
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04, use-cross: true }
# macos-14 is an M1 ARM device but macos-14 is x86-64
# https://github.com/actions/runner-images
- { target: x86_64-apple-darwin, os: macos-14-large }
- { target: aarch64-apple-darwin, os: macos-14 }
# musl binaries produced by GitHub actions segfault when run, see
# https://github.com/Wilfred/difftastic/issues/563
#
# musl builds seem to work fine elsewhere, so just verify
# that compilation works for now.
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04, use-cross: true, build-only: true }
env:
BUILD_CMD: cargo
SUBCOMMAND: test
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/[email protected]
with:
targets: ${{ matrix.job.target }}
- name: Install cross
if: matrix.job.use-cross
uses: taiki-e/install-action@v2
with:
tool: [email protected]
- name: Overwrite build command env variable
if: matrix.job.use-cross
shell: bash
run: echo "BUILD_CMD=cross" >> $GITHUB_ENV
- name: Overwrite build subcommand env variable
if: matrix.job.build-only
shell: bash
run: echo "SUBCOMMAND=build" >> $GITHUB_ENV
- name: Test
shell: bash
run: $BUILD_CMD $SUBCOMMAND --target ${{ matrix.job.target }}
test_mime_db:
name: Test with MIME database
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
# This runs tests that rely on the MIME database being present.
- run: cargo test -- --ignored
test_linux_latest_stable:
name: Test Linux (latest stable Rust)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo +stable test
regression_test:
name: Output Regression Test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
- name: Generate output for all sample files
run: ./sample_files/compare_all.sh
- name: Verify output is unchanged
run: diff -C2 sample_files/compare.result sample_files/compare.expected
package:
name: Check Linux Packaging
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
- run: cargo package --allow-dirty
fmt:
name: Rustfmt
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
- run: cargo fmt --all -- --check
actionlint:
name: Actionlint
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: raven-actions/actionlint@v2
with:
shellcheck: false