-
-
Notifications
You must be signed in to change notification settings - Fork 240
91 lines (77 loc) · 2.98 KB
/
lint.yml
File metadata and controls
91 lines (77 loc) · 2.98 KB
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
name: Lint
on:
workflow_call:
outputs:
matrix-result:
description: 'Matrix job result'
value: ${{ jobs.lint.result }}
env:
RUSTFLAGS: -Dwarnings
jobs:
lint:
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-musl
- x86_64-pc-windows-msvc
- aarch64-apple-darwin
- x86_64-apple-darwin
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-24.04
display-os: Linux
- target: x86_64-pc-windows-msvc
os: windows-2022
display-os: Windows
- target: aarch64-apple-darwin
os: macos-14
display-os: macOS – aarch64
- target: x86_64-apple-darwin
os: macos-14
display-os: macOS – x86_64
name: ${{ matrix.display-os }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 # 6.0.1
- name: Setup Rust Toolchain
run: |
rustup set profile minimal
rustup component add clippy rustfmt
rustup target add ${{ matrix.target }}
- name: Install musl-gcc (Linux only)
if: matrix.os == 'ubuntu-24.04'
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
# On x86_64, this environment variable specifies to the openssl-sys crate
# where to find the OpenSSL library.
- name: Set OpenSSL env (x86_64)
if: matrix.target == 'x86_64-apple-darwin'
run: echo "X86_64_APPLE_DARWIN_OPENSSL_DIR=${{ github.workspace }}/openssl-x86_64" >> $GITHUB_ENV
- name: Get OpenSSL cache month (x86_64)
if: matrix.target == 'x86_64-apple-darwin'
id: cache-date
run: echo "month=$(date +%Y-%m)" >> $GITHUB_OUTPUT
- name: Cache x86_64 OpenSSL
if: matrix.target == 'x86_64-apple-darwin'
id: cache-openssl-x86
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # 5.0.1
with:
path: ${{ env.X86_64_APPLE_DARWIN_OPENSSL_DIR }}
key: openssl-x86_64-${{ runner.os }}-${{ steps.cache-date.outputs.month }}
# To cross-compile for x86_64 from an ARM-based macOS runner, we need to have the
# x86_64 OpenSSL libraries installed locally.
- name: Download x86_64 OpenSSL
if: matrix.target == 'x86_64-apple-darwin' && steps.cache-openssl-x86.outputs.cache-hit != 'true'
run: |
brew fetch --bottle-tag=sonoma openssl@3
mkdir -p $X86_64_APPLE_DARWIN_OPENSSL_DIR
tar xzf $(brew --cache --bottle-tag=sonoma openssl@3) -C $X86_64_APPLE_DARWIN_OPENSSL_DIR --strip-components=2
- name: Cache Dependencies
uses: swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # 2.8.2
- name: Run Rustfmt
run: cargo fmt --all -- --check
- name: Run Clippy
run: cargo clippy --workspace --tests --target ${{ matrix.target }}