-
Notifications
You must be signed in to change notification settings - Fork 2
164 lines (138 loc) · 4.32 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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: CI
on:
push:
branches:
- ci
defaults:
run:
shell: bash
env:
FONTS: "Monaspace FiraCode ProFont CascadiaCode Noto"
BREW_FONTS: "font-monaspace font-fira-code-nerd-font font-profont-nerd-font font-caskaydia-cove-nerd-font font-monaspace-nerd-font font-noto-nerd-font"
VERSION: "v3.2.1"
EXTENSION: ".zip"
jobs:
fmt:
name: cargo fmt
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
toolchain: [stable, nightly]
steps:
- uses: actions/checkout@v4
- name: install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: rustfmt
- name: cargo fmt
run: cargo fmt --all --check
clippy:
name: cargo clippy
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
toolchain: [stable, nightly]
steps:
- uses: actions/checkout@v4
- name: restore cache
uses: Swatinem/rust-cache@v2
- name: install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- name: Show toolchain info
run: cargo --version --verbose
- name: Run Clippy
run: cargo clippy --all-targets -- -D warnings
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
event-upload:
needs: test
name: Upload Test Event
runs-on: ubuntu-latest
steps:
- uses: actions/upload-artifact@v4
with:
name: test-event
path: ${{ github.event_path }}
test:
name: cargo test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
toolchain: [stable, nightly]
steps:
- uses: actions/checkout@v4
- name: restore cache
uses: Swatinem/rust-cache@v2
- name: install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: install Mesa
run: |
if [[ $RUNNER_OS == "Linux" ]]; then
sudo add-apt-repository ppa:kisak/kisak-mesa
sudo apt update
sudo apt upgrade
sudo add-apt-repository ppa:oibaf/graphics-drivers
sudo apt update
sudo apt upgrade
fi
- name: Install Fonts
run: |
declare -a fonts=(
"Monaspace"
"FiraCode"
"ProFont"
"CascadiaCode"
"Noto"
)
if [[ $RUNNER_OS == "macOS" ]]; then
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh && brew upgrade
brew install ${{ env.BREW_FONTS }}
elif [[ $RUNNER_OS == "Linux" ]]; then
FONT_DIR="${HOME}/.local/share/fonts"
mkdir -p "$FONT_DIR"
for font in ${{ env.FONTS }}; do
ZIP_FILE="${font}${EXTENSION}"
if [[ "$font" == "Monaspace" ]]; then
DOWNLOAD_URL="https://github.com/githubnext/monaspace/releases/download/v1.101/monaspace-v1.101.zip"
else
DOWNLOAD_URL="https://github.com/ryanoasis/nerd-fonts/releases/download/${VERSION}/${ZIP_FILE}"
fi
echo "Downloading and installing '$font'..."
wget --quiet "$DOWNLOAD_URL" -O "$ZIP_FILE"
unzip -oq "$ZIP_FILE" -d "$FONT_DIR"
rm "$ZIP_FILE"
echo "'$font' installed successfully."
done
# Refresh font cache
fc-cache -fv
fi
- name: cargo test
run: RUST_BACKTRACE=1 cargo test --workspace --locked --all-features
build:
name: cargo build
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
toolchain: [stable, nightly]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --locked --release