aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/test.yml
blob: 1f7f0557d2f0e73667290904ffff867e2008bca4 (plain) (blame)
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
name: Test & Build

on:
  push:
    branches: ["main"]
    paths-ignore:
      - "**.md"
      - "ui/**"
  pull_request:
    branches: ["main"]
  workflow_dispatch:

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test on ${{ matrix.name }}
    runs-on: ${{ matrix.platform }}
    container:
      image: ${{ matrix.container }}
      options: --user root
    strategy:
      fail-fast: false
      matrix:
        # On Push: Linux only. On PR: All platforms.
        include:
          - platform: "ubuntu-22.04"
            name: "Ubuntu 22.04"
          - platform: "ubuntu-22.04"
            name: "Arch Linux (Wayland)"
            container: "archlinux:latest"
            wayland: true
          - platform: "windows-latest"
            name: "Windows"
          - platform: "macos-14"
            name: "macOS"

    steps:
      - uses: actions/checkout@v4

      - name: Install Dependencies (Ubuntu)
        if: runner.os == 'Linux' && !matrix.wayland
        run: |
          sudo apt-get update
          sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev

      - name: Install Dependencies (Arch Linux)
        if: matrix.wayland
        run: |
          pacman -Syu --noconfirm
          pacman -S --noconfirm webkit2gtk-4.1 base-devel curl wget file openssl gtk3

      - name: Setup Wayland Environment (Arch)
        if: matrix.wayland
        run: |
          echo "WAYLAND_DISPLAY=wayland-1" >> $GITHUB_ENV
          echo "GDK_BACKEND=wayland" >> $GITHUB_ENV
          echo "XDG_SESSION_TYPE=wayland" >> $GITHUB_ENV
          echo "Wayland test environment configured"

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Install Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 22

      - name: Install pnpm
        uses: pnpm/action-setup@v2
        with:
          version: 9

      - name: Install Frontend Dependencies
        working-directory: ./ui
        run: pnpm install

      - name: Install Tauri CLI
        run: cargo install tauri-cli

      - name: Rust Cache
        uses: swatinem/rust-cache@v2
        with:
          workspaces: ./src-tauri

      - name: Run Tests
        working-directory: ./src-tauri
        run: cargo test --verbose

      - name: Build App (Debug)
        run: cargo tauri build --debug

      - name: Get Short SHA
        id: slug
        run: echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT

      - name: Upload Artifact (Linux)
        if: runner.os == 'Linux'
        uses: actions/upload-artifact@v4
        with:
          name: dropout-linux-${{ matrix.wayland && 'arch' || 'ubuntu' }}-${{ steps.slug.outputs.sha8 }}
          path: |
            src-tauri/target/debug/bundle/appimage/*.AppImage
            src-tauri/target/debug/bundle/deb/*.deb
            src-tauri/target/debug/dropout
          retention-days: 5

      - name: Upload Artifact (Windows)
        if: runner.os == 'Windows'
        uses: actions/upload-artifact@v4
        with:
          name: dropout-windows-${{ steps.slug.outputs.sha8 }}
          path: |
            src-tauri/target/debug/bundle/msi/*.msi
            src-tauri/target/debug/bundle/nsis/*.exe
            src-tauri/target/debug/dropout.exe
          retention-days: 5

      - name: Upload Artifact (macOS)
        if: runner.os == 'macOS'
        uses: actions/upload-artifact@v4
        with:
          name: dropout-macos-${{ steps.slug.outputs.sha8 }}
          path: |
            src-tauri/target/debug/bundle/dmg/*.dmg
            src-tauri/target/debug/bundle/macos/DropOut.app
          retention-days: 5