|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 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 | + matrix: |
| 22 | + node-version: [16] |
| 23 | + platform: [macos-latest, ubuntu-latest, windows-latest] |
| 24 | + |
| 25 | + # The type of runner that the job will run on |
| 26 | + runs-on: ${{ matrix.platform }} |
| 27 | + |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v2 |
| 30 | + |
| 31 | + - name: Cache node modules |
| 32 | + uses: actions/cache@v2 |
| 33 | + env: |
| 34 | + cache-name: cache-node-modules |
| 35 | + with: |
| 36 | + # npm cache files are stored in `~/.npm` |
| 37 | + path: ~/.npm |
| 38 | + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
| 39 | + restore-keys: | |
| 40 | + ${{ runner.os }}-build-${{ env.cache-name }}- |
| 41 | + ${{ runner.os }}-build- |
| 42 | + ${{ runner.os }}- |
| 43 | +
|
| 44 | + - name: Use Node.js ${{ matrix.node-version }} |
| 45 | + uses: actions/setup-node@v1 |
| 46 | + with: |
| 47 | + node-version: ${{ matrix.node-version }} |
| 48 | + |
| 49 | + - name: install rust stable |
| 50 | + uses: actions-rs/toolchain@v1 |
| 51 | + with: |
| 52 | + toolchain: stable |
| 53 | + profile: minimal |
| 54 | + |
| 55 | + - name: install dependencies (ubuntu only) |
| 56 | + if: matrix.platform == 'ubuntu-latest' |
| 57 | + run: | |
| 58 | + sudo apt-get update |
| 59 | + sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf |
| 60 | +
|
| 61 | + - name: Install Dependencies |
| 62 | + run: npm i && npm i -D cli-truncate |
| 63 | + |
| 64 | + - name: Check lint |
| 65 | + run: npm run lint |
| 66 | + |
| 67 | + - name: Run headless unit test |
| 68 | + if: matrix.platform == 'ubuntu-latest' |
| 69 | + uses: GabrielBB/xvfb-action@v1 |
| 70 | + with: |
| 71 | + run: npm test |
| 72 | + |
| 73 | + - name: build tauri app |
| 74 | + uses: tauri-apps/tauri-action@v0 |
| 75 | + env: |
| 76 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments