summaryrefslogtreecommitdiff
path: root/.github/workflows/rust.yml
blob: b609a8f81e7d88681b86dfcd128d38e696d48034 (plain)
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
name: Rust

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        os: [ubuntu, archlinux]

    steps:
    - uses: actions/checkout@v4

    - name: Setup environment (Ubuntu)
      if: matrix.os == 'ubuntu'
      run: |
        sudo apt update
        sudo apt install -y libasound2-dev libx11-dev

    - name: Test makepkg build (Arch)
      if: matrix.os == 'archlinux'
      uses: docker://archlinux:latest
      with:
        args: |
          bash -c "
            pacman -Sy --noconfirm base-devel git alsa-lib libx11 rustup &&
            useradd -m builder &&
            chown -R builder:builder /github/workspace &&
            cd /github/workspace/aur &&
            sudo -u builder bash -c '
            rustup default stable &&
            makepkg -sf --noconfirm --nocheck --syncdeps'"

    - name: Build (Ubuntu)
      if: matrix.os == 'ubuntu'
      run: cargo build --verbose --release

    - name: Test (Ubuntu)
      if: matrix.os == 'ubuntu'
      run: cargo test --verbose