|
| 1 | +# This is a basic workflow to help you get started with Actions name: 'Tauri Build' |
| 2 | +name: "Tauri Build" |
| 3 | + |
| 4 | +# Controls when the action will run. |
| 5 | +on: |
| 6 | + # Triggers the workflow on push or pull request events but only for the main branch |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + pull_request: |
| 11 | + branches: |
| 12 | + - main |
| 13 | + |
| 14 | + # Allows you to run this workflow manually from the Actions tab |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + platform: [macos-latest, ubuntu-22.04, windows-latest] |
| 24 | + |
| 25 | + # The type of runner that the job will run on |
| 26 | + runs-on: ${{ matrix.platform }} |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout repository |
| 30 | + uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Setup Node.js 22 |
| 33 | + uses: actions/setup-node@v4 |
| 34 | + with: |
| 35 | + node-version: 22 |
| 36 | + |
| 37 | + - name: Cache Node modules |
| 38 | + uses: actions/cache@v4 |
| 39 | + with: |
| 40 | + # npm cache files are stored in ~/.npm |
| 41 | + path: ~/.npm |
| 42 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 43 | + restore-keys: | |
| 44 | + ${{ runner.os }}-node- |
| 45 | +
|
| 46 | + - name: Setup Rust toolchain (stable) |
| 47 | + uses: dtolnay/rust-toolchain@stable |
| 48 | + with: |
| 49 | + # Only required targets will be downloaded depending on platform |
| 50 | + targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} |
| 51 | + |
| 52 | + # ---------------------------- |
| 53 | + # MACOS ONLY FIX |
| 54 | + # ---------------------------- |
| 55 | + - name: Install macOS dependencies |
| 56 | + if: matrix.platform == 'macos-latest' |
| 57 | + run: | |
| 58 | + brew install gnu-tar coreutils |
| 59 | + echo "Homebrew dependencies installed" |
| 60 | +
|
| 61 | + # ---------------------------- |
| 62 | + # UBUNTU ONLY |
| 63 | + # ---------------------------- |
| 64 | + - name: Install dependencies (Linux only) |
| 65 | + if: matrix.platform == 'ubuntu-22.04' |
| 66 | + run: | |
| 67 | + sudo apt-get update |
| 68 | + sudo apt-get install -y \ |
| 69 | + libgtk-3-dev \ |
| 70 | + libappindicator3-dev \ |
| 71 | + librsvg2-dev \ |
| 72 | + patchelf \ |
| 73 | + libsoup-3.0 \ |
| 74 | + libwebkit2gtk-4.1-dev |
| 75 | +
|
| 76 | + - name: Install Node dependencies |
| 77 | + run: npm install |
| 78 | + |
| 79 | + - name: Check lint |
| 80 | + run: npm run lint |
| 81 | + |
| 82 | + - name: Run unit tests (Linux only) |
| 83 | + if: matrix.platform == 'ubuntu-22.04' |
| 84 | + uses: GabrielBB/xvfb-action@v1 |
| 85 | + with: |
| 86 | + run: npm run test |
| 87 | + |
| 88 | + # ---------------------------- |
| 89 | + # BUILD TAURI |
| 90 | + # ---------------------------- |
| 91 | + - name: Build Tauri app |
| 92 | + uses: tauri-apps/tauri-action@v0 |
| 93 | + env: |
| 94 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments