n-link/.github/workflows/ci.yml
2021-08-30 19:55:16 -04:00

105 lines
3.2 KiB
YAML

name: "CI"
on:
push:
branches-ignore:
- 'dependabot/**'
- release
pull_request:
jobs:
test-tauri:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-18.04, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: Install GNU tar
if: runner.os == 'macOS'
run: |
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ matrix.platform }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ matrix.platform }}-yarn-
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
desktop/src-tauri/target
key: ${{ matrix.platform }}-cargo-v2-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.platform }}-cargo-v2-
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 12
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install tauri bundler
if: runner.os != 'Windows'
run: cargo install tauri-bundler || [ $? -eq 101 ]
- name: install tauri bundler
if: runner.os == 'Windows'
run: cargo install tauri-bundler; exit ($LASTEXITCODE -ne 101 -and $LASTEXITCODE -ne 0)
shell: powershell -command "& '{0}'"
- name: install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-18.04'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 squashfs-tools
- name: install app dependencies
run: yarn
# https://github.com/tauri-apps/tauri-action/issues/162
- name: build app
run: cd desktop; yarn tauri:build
- name: fake yarn
run: node -e "eval(process.env.COMMAND)"
env:
COMMAND: 'fs.writeFileSync("desktop/yarn.lock","")'
- uses: tauri-apps/tauri-action@v0
with:
npmScript: "tauri:build"
projectPath: desktop/
- uses: actions/upload-artifact@v2
with:
name: my-artifact-${{ runner.os }}
path: desktop/src-tauri/target/release/bundle
test-web:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ matrix.platform }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
ubuntu-18.04-yarn-
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 12
- name: install app dependencies
run: yarn
- name: Build
run: |
yarn workspace web run generate