-
Notifications
You must be signed in to change notification settings - Fork 4
133 lines (118 loc) · 4.28 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
name: Continuous Integration
on:
push:
branches:
- next
pull_request:
jobs:
format:
runs-on: ubuntu-22.04
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: recursive
- name: Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-rust_stable-${{ hashFiles('**/Cargo.toml') }}
- name: Format
run: cargo fmt --all -- --check
clippy-check:
runs-on: ubuntu-22.04
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: recursive
- name: Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: Get date for registry cache
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Cargo registry cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git
key: ${{ runner.os }}-cargo-registry-${{ steps.date.outputs.date }}
restore-keys: ${{ runner.os }}-cargo-registry-
- name: Get cargo-cache latest version
id: cargocacheversion
run: echo "version=$(cargo search 'cargo-cache' --limit 1 | head -n 1 | cut -d ' ' -f 3 | cut -d '"' -f 2)" >> $GITHUB_OUTPUT
- name: Cargo binaries cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/cargo-cache
~/.cargo/.crates.toml
~/.cargo/.crates2.json
key: ${{ runner.os }}-cargo-binaries-${{ steps.cargocacheversion.outputs.version }}
- name: Install cargo-cache
run: cargo install cargo-cache --version ${{ steps.cargocacheversion.outputs.version }}
- name: Clean cargo cache of old items
run: cargo cache clean-unref
- name: System dependencies
run: sudo apt-get update; sudo apt-get install -y libudev-dev libgbm-dev libxkbcommon-dev libegl1-mesa-dev libwayland-dev libinput-dev libdbus-1-dev libsystemd-dev libseat-dev
- name: Clippy
run: cargo clippy -- -D warnings
doc:
name: Documentation on Github Pages
runs-on: ubuntu-22.04
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: recursive
- name: Get date for registry cache
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Cargo registry cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git
key: ${{ runner.os }}-cargo-registry-${{ steps.date.outputs.date }}
restore-keys: ${{ runner.os }}-cargo-registry-
- name: Rust toolchain
uses: dtolnay/rust-toolchain@nightly
- name: System dependencies
run: sudo apt-get update; sudo apt-get install -y libudev-dev libgbm-dev libxkbcommon-dev libegl1-mesa-dev libwayland-dev libinput-dev libdbus-1-dev libsystemd-dev libseat-dev
- name: Build Documentation
run: cargo doc --no-deps -p runa-core -p runa-orbiter -p runa-io -p runa-io-traits -p runa-wayland-protocols
- name: Setup index
run: echo "<!DOCTYPE html><html><head><meta http-equiv=refresh content=0;url=runa_core/index.html /></head></html>" > ./target/doc/index.html
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./target/doc
# Deploy job
deploy:
needs: doc
if: ${{ github.event_name == 'push' }}
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1