Skip to content

test create-tauri-app templates #968

test create-tauri-app templates

test create-tauri-app templates #968

# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: test create-tauri-app templates
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
pull_request:
branches:
- 'dev'
paths:
- '.github/workflows/templates-test.yml'
- 'src/**'
- 'templates/**'
env:
RUST_BACKTRACE: 1
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
generate-matrix:
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v42
with:
base_sha: ${{ github.event.pull_request.base.sha }}
separator: ","
- name: set matrix
id: set-matrix
shell: bash
run: |
OUT="$(node .scripts/generate-templates-matrix.js '${{ github.event_name }}' '${{ steps.changed-files.outputs.all_changed_files }}')"
echo "matrix=$OUT" >> $GITHUB_OUTPUT
build-cli:
needs: [generate-matrix]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --release --package create-tauri-app
- name: add cli to .tar archive
run: tar -rf create-tauri-app.tar target/release/cargo-create-tauri-app
- name: upload cli artifact
uses: actions/upload-artifact@v3
with:
name: create-tauri-app
path: create-tauri-app.tar
if-no-files-found: error
test:
needs: [build-cli, generate-matrix]
runs-on: ubuntu-22.04
if: ${{ needs.generate-matrix.outputs.matrix != '[]' && needs.generate-matrix.outputs.matrix != '' }}
strategy:
fail-fast: false
matrix:
settings: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
name: ${{ matrix.settings.manager }} - ${{ matrix.settings.template }} ${{ matrix.settings.flags }}
steps:
- uses: oven-sh/setup-bun@v1
if: matrix.settings.manager == 'bun'
with:
bun-version: latest
- name: Install Deno@2
if: matrix.settings.manager == 'deno'
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- run: corepack enable
if: matrix.settings.node
- name: Install Node.js@18
if: matrix.settings.node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install [email protected]
if: matrix.settings.manager == 'dotnet'
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- uses: dtolnay/rust-toolchain@stable
- run: cargo install tauri-cli --locked
if: (matrix.settings.manager == 'cargo' || matrix.settings.manager == 'dotnet') && matrix.settings.tauriVersion != 1
- run: cargo install tauri-cli --version '^1.0.0' --locked
if: (matrix.settings.manager == 'cargo' || matrix.settings.manager == 'dotnet') && matrix.settings.tauriVersion == 1
- run: rustup target add wasm32-unknown-unknown
if: matrix.settings.install_trunk || matrix.settings.install_dioxus_cli
- run: cargo install trunk --locked
if: matrix.settings.install_trunk
- run: cargo install dioxus-cli --locked
if: matrix.settings.install_dioxus_cli
- name: install system dependencies (v1)
if: matrix.settings.tauriVersion == 1
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
- name: install system dependencies
if: matrix.settings.tauriVersion != 1
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.1 libayatana-appindicator3-dev librsvg2-dev patchelf
- name: download cli artifact
uses: actions/download-artifact@v3
- run: tar -xf create-tauri-app/create-tauri-app.tar
- name: bootstrap a ${{ matrix.settings.template }} project (${{ matrix.settings.flags }})
run: ./target/release/cargo-create-tauri-app tauri-app -m ${{ matrix.settings.manager }} -t ${{ matrix.settings.template }} ${{ matrix.settings.flags }} -y
- run: sed -i 's/com.tauri.dev/com.create-tauri-app.dev/g' **/tauri.conf.json
working-directory: tauri-app
- run: ${{ matrix.settings.install_cmd }}
if: matrix.settings.install_cmd != ''
working-directory: tauri-app
- run: ${{ matrix.settings.run_cmd }} tauri build ${{ matrix.settings.no_bundle_flag }}
if: matrix.settings.manager != 'npm'
working-directory: tauri-app
- run: ${{ matrix.settings.run_cmd }} tauri build -- ${{ matrix.settings.no_bundle_flag }}
if: matrix.settings.manager == 'npm'
working-directory: tauri-app