perf(ci): optimize caches and workflow runs (#3445)

This commit is contained in:
Lucas Fernandes Nogueira 2022-02-13 18:21:15 -03:00 committed by GitHub
parent 16f1173f45
commit 8d0d4f290f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 433 additions and 570 deletions

View File

@ -1,92 +0,0 @@
# Copyright 2019-2021 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: build smoke test with source
on:
workflow_dispatch:
inputs:
repository:
description: "Repository from which to pull and create a Tauri app."
required: false
default: "tauri-apps/tauri"
ref:
description: "Branch or ref to pull down."
required: false
default: "dev"
dir:
description: "Directory we expect to run in."
required: false
default: "tauri/examples/helloworld"
buildAssets:
description: "Command to build the assets."
required: false
default: "echo no build needed"
buildTauri:
description: "Command to build the Tauri app."
required: false
default: "tauri"
env:
RUST_BACKTRACE: 1
jobs:
create-and-upload-assets:
runs-on: ${{ matrix.platform }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
include:
- platform: ubuntu-latest
releaseFolder: target/release/bundle/deb
- platform: macos-latest
releaseFolder: target/release/bundle/macos
- platform: windows-latest
releaseFolder: target/release/bundle/msi
steps:
- uses: actions/checkout@v2
with:
path: tauri
- uses: actions/checkout@v2
with:
repository: ${{ github.event.inputs.repository }}
ref: ${{ github.event.inputs.ref }}
path: example
- name: setup node
uses: actions/setup-node@v2
with:
node-version: 14
cache: yarn
cache-dependency-path: tooling/*/yarn.lock
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: build and install cli.rs
run: cargo install --path tauri/tooling/cli
- name: install and build assets
working-directory: "example/${{ github.event.inputs.dir }}"
run: ${{ github.event.inputs.buildAssets }}
- name: build tauri app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tauriScript: cargo tauri
includeDebug: true
projectPath: "example/${{ github.event.inputs.dir }}"
preferGlobal: true
- uses: actions/upload-artifact@v2
if: success()
with:
name: tauri-app.${{ matrix.platform }}
path: ${{ format('./{0}{1}/src-tauri/{2}/**', 'example/', github.event.inputs.dir, matrix.releaseFolder ) }}

View File

@ -1,209 +0,0 @@
# Copyright 2019-2021 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: clippy and fmt check
on:
push:
branches:
- dev
- next
pull_request:
paths:
- '.github/workflows/core-lint-fmt.yml'
- 'core/**'
- 'examples/**'
- 'tooling/cli/**'
jobs:
workspace_clippy_fmt_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Cache cargo registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-index-
- name: Cache core cargo target
uses: actions/cache@v2
with:
path: target
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-core-
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all-features -- -D warnings
name: workspace
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
cli_clippy_fmt_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./tooling/cli/Cargo.toml --all-targets --all-features -- -D warnings
name: cli
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Cache cargo registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-index-
- name: Cache CLI cargo target
uses: actions/cache@v2
with:
path: tooling/cli/target
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-cli-${{ hashFiles('tooling/cli/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-cli-${{ hashFiles('tooling/cli/Cargo.lock') }}
ubuntu-latest-nightly-cargo-cli-
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path ./tooling/cli/Cargo.toml --all -- --check
core_clippy_check:
runs-on: ubuntu-latest
strategy:
matrix:
feature: [custom-protocol, api-all]
steps:
- uses: actions/checkout@v2
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest'
- name: Get current date
if: matrix.platform == 'windows-latest'
run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Cache cargo registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-index-
- name: Cache core cargo target
uses: actions/cache@v2
with:
path: target
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-core-
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./core/tauri/Cargo.toml --all-targets --features ${{ matrix.feature }} -- -D warnings
name: core

View File

@ -29,23 +29,6 @@ jobs:
cache: yarn
cache-dependency-path: tooling/*/yarn.lock
- name: Cache CLI cargo target
uses: actions/cache@v2
with:
path: tooling/cli/target
# Add date to the cache to keep it up to date
key: ubuntu-latest-stable-cargo-cli-${{ hashFiles('tooling/cli/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-stable-cargo-cli-${{ hashFiles('tooling/cli/Cargo.lock') }}
ubuntu-latest-stable-cargo-cli-
- name: build CLI
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ./tooling/cli/Cargo.toml
- name: cargo login
run: cargo login ${{ secrets.crate_token }}
- name: git config

89
.github/workflows/lint-fmt-cli.yml vendored Normal file
View File

@ -0,0 +1,89 @@
# Copyright 2019-2021 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: cli clippy and fmt check
on:
push:
branches:
- dev
- next
pull_request:
paths:
- '.github/workflows/lint-fmt-cli.yml'
- 'tooling/cli/**'
jobs:
fmt_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path ./tooling/cli/Cargo.toml --all -- --check
cli_clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Cache cargo registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ubuntu-latest-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-stable-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ubuntu-latest-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-stable-cargo-index-
- name: Cache CLI cargo target
uses: actions/cache@v2
with:
path: tooling/cli/target
# Add date to the cache to keep it up to date
key: ubuntu-latest-stable-cargo-cli-${{ hashFiles('tooling/cli/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-stable-cargo-cli-${{ hashFiles('tooling/cli/Cargo.lock') }}
ubuntu-latest-stable-cargo-cli-
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./tooling/cli/Cargo.toml --all-targets --all-features -- -D warnings
name: cli

107
.github/workflows/lint-fmt-core.yml vendored Normal file
View File

@ -0,0 +1,107 @@
# Copyright 2019-2021 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: core clippy and fmt check
on:
push:
branches:
- dev
- next
pull_request:
paths:
- '.github/workflows/lint-fmt-core.yml'
- 'core/**'
- 'examples/**'
jobs:
fmt_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
core_clippy_check:
runs-on: ubuntu-latest
strategy:
matrix:
clippy:
- { args: '', key: 'empty' }
- { args: '--features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray', key: 'all' }
- { args: '--no-default-features', key: 'no-default' }
- { args: '--features custom-protocol', key: 'custom-protocol' }
- { args: '--features api-all', key: 'api-all' }
steps:
- uses: actions/checkout@v2
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest'
- name: Get current date
if: matrix.platform == 'windows-latest'
run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Cache cargo registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ubuntu-latest-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-stable-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ubuntu-latest-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-stable-cargo-index-
- name: Cache core cargo target
uses: actions/cache@v2
with:
path: target
# Add date to the cache to keep it up to date
key: ubuntu-latest-stable-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-stable-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}
ubuntu-latest-stable-cargo-core-
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./core/tauri/Cargo.toml --all-targets ${{ matrix.clippy.args }} -- -D warnings
name: ${{ matrix.clippy.key }}

View File

@ -2,12 +2,12 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: eslint check
name: api and cli.js lint check
on:
pull_request:
paths:
- '.github/workflows/js-lint.yml'
- '.github/workflows/lint-js.yml'
- 'tooling/cli/node/**'
- 'tooling/api/**'
- 'tooling/create-tauri-app/**'

View File

@ -1,76 +0,0 @@
# Copyright 2019-2021 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: build smoke tests with prod
on:
release:
types: [published]
jobs:
via-prod:
runs-on: ${{ matrix.platform }}
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
example: [react/gatsby-themed-site, react/create-react-app, react/next.js, vanillajs/monolith, vue/quasar-app, svelte/svelte-app]
include:
- platform: ubuntu-latest
CARGO_HOME: ~/.cargo
- platform: macos-latest
CARGO_HOME: ~/.cargo
- platform: windows-latest
CARGO_HOME: ~/.cargo
steps:
- uses: actions/checkout@v2
- name: install rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: cache rust bin
id: cache_rust_bin
uses: actions/cache@v1
with:
path: ${{ format('{0}/bin/', matrix.CARGO_HOME) }}
key: ${{ runner.OS }}-build-bin-${{ hashFiles('**/Cargo.toml') }}-
- name: cache rust registry/index
id: cache_rust_reg_index
uses: actions/cache@v1
with:
path: ${{ format('{0}/registry/index/', matrix.CARGO_HOME) }}
key: ${{ runner.OS }}-build-reg-index-${{ hashFiles('**/Cargo.toml') }}-
- name: cache rust registry/cache
id: cache_rust_reg_cache
uses: actions/cache@v1
with:
path: ${{ format('{0}/registry/cache/', matrix.CARGO_HOME) }}
key: ${{ runner.OS }}-build-reg-cache-${{ hashFiles('**/Cargo.toml') }}-
- name: cache node modules
uses: actions/cache@v1
with:
path: ${{ format('examples/node/{0}/node_modules', matrix.example) }}
key: ${{ runner.OS }}-build-${{ hashFiles(format('examples/{0}/yarn.lock', matrix.example)) }}
restore-keys: ${{ runner.OS }}-build-${{ env.cache-name }}-
- name: install via yarn
run: |
cd ./node/examples/${{ matrix.example }}
yarn
- name: build example
run: |
cd ./node/examples/${{ matrix.example }}
yarn build
- name: yarn tauri build
run: |
cd ./node/examples/${{ matrix.example }}
yarn tauri:prod:build

View File

@ -32,12 +32,6 @@ jobs:
with:
toolchain: stable
- name: install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest'
@ -84,33 +78,81 @@ jobs:
cd ./tooling/bundler
cargo test
clippy-fmt-check:
fmt_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install minimal nightly with clippy and rustfmt
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path ./tooling/bundler/Cargo.toml --all -- --check
clippy-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install minimal stable with clippy and rustfmt
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest'
- name: Get current date
if: matrix.platform == 'windows-latest'
run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Cache cargo registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-index-
- name: Cache bundler cargo target
uses: actions/cache@v2
with:
path: tooling/bundler/target
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-bundler-${{ hashFiles('tooling/bundler/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-bundler-${{ hashFiles('tooling/bundler/Cargo.lock') }}
${{ matrix.platform }}-stable-cargo-bundler-
- name: install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: clippy check
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./tooling/bundler/Cargo.toml --all-targets -- -D warnings
name: bundler
- name: fmt check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path ./tooling/bundler/Cargo.toml --all -- --check

169
.github/workflows/test-cli.yml vendored Normal file
View File

@ -0,0 +1,169 @@
# Copyright 2019-2021 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: test CLI
on:
push:
branches:
- dev
- next
pull_request:
paths:
- '.github/workflows/test-cli.yml'
- 'tooling/cli/**'
env:
RUST_BACKTRACE: 1
jobs:
test-tauri-cli:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: install stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest'
- name: Get current date
if: matrix.platform == 'windows-latest'
run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Cache cargo registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-index-
- name: Cache CLI cargo target
uses: actions/cache@v2
with:
path: tooling/cli/target
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-cli-${{ hashFiles('tooling/cli/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-cli-${{ hashFiles('tooling/cli/Cargo.lock') }}
${{ matrix.platform }}-stable-cargo-cli-
- name: build CLI
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ./tooling/cli/Cargo.toml
test-tauri-js-cli:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: setup node
uses: actions/setup-node@v2
with:
node-version: 14
cache: yarn
cache-dependency-path: tooling/cli/node/yarn.lock
- name: install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest'
- name: Get current date
if: matrix.platform == 'windows-latest'
run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Cache cargo registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-index-
- name: Cache CLI cargo target
uses: actions/cache@v2
with:
path: tooling/cli/target
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-cli-${{ hashFiles('tooling/cli/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-cli-${{ hashFiles('tooling/cli/Cargo.lock') }}
${{ matrix.platform }}-stable-cargo-cli-
- name: Cache template cargo target
uses: actions/cache@v2
with:
path: tooling/cli/node/test/jest/fixtures/empty/src-tauri/target
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-template-${{ hashFiles('tooling/cli/templates/app/**') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-template-${{ hashFiles('tooling/cli/templates/app/**') }}
${{ matrix.platform }}-stable-template-
- name: test
timeout-minutes: 30
run: |
cd ./tooling/cli/node
yarn
yarn build
yarn test

View File

@ -14,7 +14,7 @@ on:
- '.github/workflows/test-core.yml'
- 'core/**'
- 'examples/**'
- 'tooling/**'
- 'tooling/cli/**'
env:
RUST_BACKTRACE: 1
@ -86,153 +86,3 @@ jobs:
cargo test
cargo test --features api-all
cargo test --features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray
test-tauri-cli:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: install stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest'
- name: Get current date
if: matrix.platform == 'windows-latest'
run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Cache cargo registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-index-
- name: Cache CLI cargo target
uses: actions/cache@v2
with:
path: tooling/cli/target
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-cli-${{ hashFiles('tooling/cli/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-cli-${{ hashFiles('tooling/cli/Cargo.lock') }}
${{ matrix.platform }}-stable-cargo-cli-
- name: build CLI
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ./tooling/cli/Cargo.toml
test-tauri-js-cli:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: setup node
uses: actions/setup-node@v2
with:
node-version: 14
cache: yarn
cache-dependency-path: tooling/cli/node/yarn.lock
- name: install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest'
- name: Get current date
if: matrix.platform == 'windows-latest'
run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Cache cargo registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-index-
- name: Cache CLI cargo target
uses: actions/cache@v2
with:
path: tooling/cli/target
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-cli-${{ hashFiles('tooling/cli/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-cli-${{ hashFiles('tooling/cli/Cargo.lock') }}
${{ matrix.platform }}-stable-cargo-cli-
- name: Cache template cargo target
uses: actions/cache@v2
with:
path: tooling/cli/node/test/jest/fixtures/empty/src-tauri/target
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-template-${{ hashFiles('tooling/cli/templates/app/**') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-template-${{ hashFiles('tooling/cli/templates/app/**') }}
${{ matrix.platform }}-stable-template-
- name: test
timeout-minutes: 30
run: |
cd ./tooling/cli/node
yarn
yarn build
yarn test