Skip to content

Commit 1d3a077

Browse files
committed
ci: add first ci
1 parent d64884e commit 1d3a077

File tree

2 files changed

+130
-0
lines changed

2 files changed

+130
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @Firestar99

.github/workflows/ci.yaml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
pull_request:
6+
merge_group:
7+
8+
name: CI
9+
10+
# Cancel PR actions on new commits
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
test:
17+
name: Test
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [ ubuntu-24.04, windows-2022, macOS-latest ]
22+
runs-on: ${{ matrix.os }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: install nextest
26+
uses: taiki-e/install-action@v2
27+
with:
28+
tool: nextest
29+
- name: Install Vulkan SDK
30+
uses: jakoch/install-vulkan-sdk-action@v1
31+
with:
32+
vulkan_version: 1.4.321.0
33+
install_runtime: true
34+
cache: true
35+
stripdown: true
36+
37+
# FIXME(eddyb) consider using lavapipe instead, or even trying both.
38+
install_swiftshader: true
39+
# install_lavapipe: true
40+
- if: ${{ runner.os == 'Linux' }}
41+
name: Linux - Install native dependencies
42+
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
43+
# just need a random command that forces the installation of rust-toolchain
44+
# figure out native target triple while we're at it
45+
- name: install rust-toolchain
46+
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
47+
- name: xtask cargo fetch --locked
48+
run: cd xtask && cargo fetch --locked --target $TARGET
49+
- name: xtask build
50+
run: cd xtask && cargo build
51+
- name: xtask generate
52+
run: cargo xtask generate
53+
- name: cargo fetch --locked
54+
run: cargo xtask generate -x "cargo fetch --locked --target $TARGET"
55+
- name: cargo build
56+
run: cargo xtask generate -x "cargo build"
57+
- name: cargo test
58+
run: cargo xtask generate -x "cargo nextest run"
59+
60+
# This allows us to have a single job we can branch protect on, rather than needing
61+
# to update the branch protection rules when the test matrix changes
62+
test_success:
63+
runs-on: ubuntu-24.04
64+
needs: [test, lint]
65+
# Hack for buggy GitHub Actions behavior with skipped checks: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
66+
if: ${{ always() }}
67+
steps:
68+
# Another hack is to actually check the status of the dependencies or else it'll fall through
69+
- run: |
70+
echo "Checking statuses..."
71+
[[ "${{ needs.test.result }}" == "success" ]] || exit 1
72+
[[ "${{ needs.xtask-test.result }}" == "success" ]] || exit 1
73+
[[ "${{ needs.lint.result }}" == "success" ]] || exit 1
74+
75+
xtask-test:
76+
name: xtask test
77+
runs-on: ubuntu-24.04
78+
steps:
79+
- uses: actions/checkout@v4
80+
- name: install nextest
81+
uses: taiki-e/install-action@v2
82+
with:
83+
tool: nextest
84+
- if: ${{ runner.os == 'Linux' }}
85+
name: Linux - Install native dependencies
86+
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
87+
# just need a random command that forces the installation of rust-toolchain
88+
# figure out native target triple while we're at it
89+
- name: install rust-toolchain
90+
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
91+
- name: xtask cargo fetch --locked
92+
run: cd xtask && cargo fetch --locked --target $TARGET
93+
- name: xtask build
94+
run: cd xtask && cargo build
95+
- name: xtask test
96+
run: cd xtask && cargo nextest run
97+
- name: xtask fmt
98+
run: cd xtask && cargo fmt --all -- --check
99+
- name: xtask clippy
100+
run: cd xtask && cargo clippy --all-targets -- -D warnings
101+
102+
lint:
103+
name: Lint
104+
runs-on: ubuntu-24.04
105+
steps:
106+
- uses: actions/checkout@v4
107+
- if: ${{ runner.os == 'Linux' }}
108+
name: Linux - Install native dependencies
109+
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
110+
# just need a random command that forces the installation of rust-toolchain
111+
# figure out native target triple while we're at it
112+
- name: install rust-toolchain
113+
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
114+
- name: xtask cargo fetch --locked
115+
run: cd xtask && cargo fetch --locked
116+
- name: xtask build
117+
run: cd xtask && cargo build
118+
- name: xtask generate
119+
run: cargo xtask generate
120+
- name: cargo fetch --locked
121+
run: cargo xtask generate -x "cargo fetch --locked"
122+
- name: fmt
123+
run: cargo xtask generate -x "cargo fmt --all -- --check"
124+
- name: clippy
125+
run: cargo xtask generate -x "cargo clippy --all-targets -- -D warnings"
126+
127+
defaults:
128+
run:
129+
shell: bash

0 commit comments

Comments
 (0)