-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (72 loc) · 2.18 KB
/
ci.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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: 00 4 * * *
env:
CARGO_TERM_COLOR: always
jobs:
lint-stable:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rust-src
- name: Run clippy
run: cargo clippy --all-targets --workspace -- --deny warnings
lint-nightly:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt, rust-src
- name: Check formatting
run: cargo fmt --all -- --check
build-container-image:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-unknown-linux-gnu
type: cross
- target: aarch64-unknown-linux-musl
type: cross
- target: riscv64gc-unknown-linux-gnu
type: cross
- target: x86_64-unknown-linux-gnu
type: native
- target: x86_64-unknown-linux-musl
type: native
name: container ${{ matrix.type }} ${{ matrix.target }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Log in to GitHub Container Registry
run: |
set -euxo pipefail
echo "${{ secrets.GITHUB_TOKEN }}" | \
docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build container image
if: github.ref == 'refs/heads/main'
run: |
cargo xtask build-container-image \
--tag ghcr.io/${{ github.repository }}/${{ matrix.type }}-${{ matrix.target }}:latest \
--target ${{ matrix.target }} \
--push
- name: Build container image
if: github.ref != 'refs/heads/main'
run: |
cargo xtask build-container-image \
--tag ghcr.io/${{ github.repository }}/${{ matrix.type }}-${{ matrix.target }}:${{ github.head_ref }} \
--target ${{ matrix.target }} \
--push