Skip to content

Commit 624b9b5

Browse files
authored
Merge pull request #23 from compio-rs/ci
ci: add build workflow
2 parents 8334642 + e4fae3d commit 624b9b5

1 file changed

Lines changed: 76 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
build:
17+
runs-on: ${{ matrix.setup.os }}
18+
strategy:
19+
matrix:
20+
toolchain: ['nightly']
21+
setup:
22+
- os: 'ubuntu-22.04'
23+
- os: 'ubuntu-24.04'
24+
- os: 'ubuntu-24.04'
25+
features: 'gtk'
26+
no_default_features: true
27+
- os: 'windows-latest'
28+
target: 'x86_64-pc-windows-msvc'
29+
- os: 'windows-latest'
30+
target: 'i686-pc-windows-msvc'
31+
- os: 'macos-13'
32+
- os: 'macos-14'
33+
- os: 'macos-15'
34+
steps:
35+
- uses: actions/checkout@v4
36+
- name: Setup Rust Toolchain
37+
run: rustup toolchain install ${{ matrix.toolchain }}
38+
- name: Install Linux dependencies
39+
if: runner.os == 'Linux'
40+
run: |
41+
sudo apt update
42+
43+
PKGS=()
44+
if [[ "${{ matrix.setup.features }}" == *"gtk"* ]]; then
45+
PKGS+=("libgtk-4-dev")
46+
else
47+
PKGS+=("qt6-base-dev")
48+
fi
49+
50+
sudo apt install -y "${PKGS[@]}"
51+
- name: Setup target
52+
if: ${{ matrix.setup.target }}
53+
run: rustup +${{ matrix.toolchain }} target install ${{ matrix.setup.target }}
54+
- name: Build on ${{ matrix.setup.os }} ${{ matrix.toolchain }} ${{ matrix.setup.target }}
55+
shell: bash
56+
run: |
57+
set -ex
58+
59+
# Add feature "nightly" if toolchain is nightly
60+
if [[ "${{ matrix.toolchain }}" == "nightly" ]]; then
61+
ARGS+=("--features" "nightly")
62+
fi
63+
# Add features if features is not empty
64+
if [[ -n "${{ matrix.setup.features }}" ]]; then
65+
ARGS+=("--features" "${{ matrix.setup.features }}")
66+
fi
67+
# Add no-default-features if no_default_features is true
68+
if [[ -n "${{ matrix.setup.no_default_features }}" ]]; then
69+
ARGS+=("--no-default-features")
70+
fi
71+
# Specify target if target is not empty
72+
if [[ -n "${{ matrix.setup.target }}" ]]; then
73+
ARGS+=("--target" "${{ matrix.setup.target }}")
74+
fi
75+
76+
cargo +${{ matrix.toolchain }} build --all-targets --workspace "${ARGS[@]}"

0 commit comments

Comments
 (0)