-
Notifications
You must be signed in to change notification settings - Fork 3
103 lines (102 loc) · 3 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
name: CI
on:
push:
branches: ["**"]
tags: ["**"]
pull_request:
branches: ["**"]
jobs:
fmt:
name: rustfmt check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all -- --check
- uses: crate-ci/typos@master
lint-test:
name: clippy lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: cargo clippy
run: cargo clippy -- -Dclippy::all -Dclippy::pedantic
build-bin:
name: build binaries
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --release
- uses: actions/upload-artifact@v4
with:
path: target/release/lpl.exe
name: lpl-windows
if: matrix.os == 'windows-latest'
- uses: actions/upload-artifact@v4
with:
path: target/release/lpl
name: lpl-linux
if: matrix.os == 'ubuntu-latest'
- uses: actions/upload-artifact@v4
with:
path: target/release/lpl
name: lpl-macos
if: matrix.os == 'macos-latest'
vhs:
name: record screencast
runs-on: [ubuntu-latest]
needs: [build-bin]
steps:
- uses: actions/checkout@v4
- uses: FedericoCarboni/setup-ffmpeg@v2
- run: |
mkdir /home/runner/bin
wget -O /home/runner/bin/ttyd https://github.com/tsl0922/ttyd/releases/download/1.7.4/ttyd.x86_64
chmod +x /home/runner/bin/ttyd
wget -O /home/runner/vhs.tar.gz https://github.com/charmbracelet/vhs/releases/download/v0.7.1/vhs_0.7.1_Linux_x86_64.tar.gz
(cd /home/runner/bin && tar xzf ../vhs.tar.gz)
echo /home/runner/bin >>$GITHUB_PATH
- uses: actions/download-artifact@v4
with:
name: lpl-linux
path: /home/runner/lpl
- run: mv /home/runner/{lpl,bin}/lpl && chmod +x /home/runner/bin/lpl
- run: vhs examples/sinusoidal.tape
- uses: actions/upload-artifact@v4
with:
path: target/sinusoidal.gif
name: sinusoidal.gif
pages:
name: prepare GitHub pages
runs-on: [ubuntu-latest]
needs: [vhs, build-bin]
steps:
- uses: actions/download-artifact@v4
with:
path: /home/runner/pages
merge-multiple: true
- uses: actions/upload-pages-artifact@v3
with:
path: /home/runner/pages
deploy-pages:
name: deploy GitHub pages
runs-on: [ubuntu-latest]
permissions:
pages: write
id-token: write
needs: [pages]
if: github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'ci-test')
concurrency:
group: gh-pages
steps:
- uses: actions/deploy-pages@v4
id: deployment