From 8d0d4f290f40ba0ff07c88f97962ca84b8e33344 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Sun, 13 Feb 2022 18:21:15 -0300 Subject: [PATCH] perf(ci): optimize caches and workflow runs (#3445) --- .github/workflows/build-smoke-tests.yml | 92 -------- .github/workflows/core-lint-fmt.yml | 209 ------------------ .../workflows/covector-version-or-publish.yml | 17 -- .github/workflows/lint-fmt-cli.yml | 89 ++++++++ .github/workflows/lint-fmt-core.yml | 107 +++++++++ .../workflows/{js-lint.yml => lint-js.yml} | 4 +- .github/workflows/smoke-test-prod.yml | 76 ------- .github/workflows/test-bundler.yml | 88 ++++++-- .github/workflows/test-cli.yml | 169 ++++++++++++++ .github/workflows/test-core.yml | 152 +------------ 10 files changed, 433 insertions(+), 570 deletions(-) delete mode 100644 .github/workflows/build-smoke-tests.yml delete mode 100644 .github/workflows/core-lint-fmt.yml create mode 100644 .github/workflows/lint-fmt-cli.yml create mode 100644 .github/workflows/lint-fmt-core.yml rename .github/workflows/{js-lint.yml => lint-js.yml} (95%) delete mode 100644 .github/workflows/smoke-test-prod.yml create mode 100644 .github/workflows/test-cli.yml diff --git a/.github/workflows/build-smoke-tests.yml b/.github/workflows/build-smoke-tests.yml deleted file mode 100644 index 070b7d9cb..000000000 --- a/.github/workflows/build-smoke-tests.yml +++ /dev/null @@ -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 ) }} diff --git a/.github/workflows/core-lint-fmt.yml b/.github/workflows/core-lint-fmt.yml deleted file mode 100644 index d15203d22..000000000 --- a/.github/workflows/core-lint-fmt.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/covector-version-or-publish.yml b/.github/workflows/covector-version-or-publish.yml index 9a0813981..15d7404a5 100644 --- a/.github/workflows/covector-version-or-publish.yml +++ b/.github/workflows/covector-version-or-publish.yml @@ -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 diff --git a/.github/workflows/lint-fmt-cli.yml b/.github/workflows/lint-fmt-cli.yml new file mode 100644 index 000000000..17429633e --- /dev/null +++ b/.github/workflows/lint-fmt-cli.yml @@ -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 diff --git a/.github/workflows/lint-fmt-core.yml b/.github/workflows/lint-fmt-core.yml new file mode 100644 index 000000000..4c11f6375 --- /dev/null +++ b/.github/workflows/lint-fmt-core.yml @@ -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 }} diff --git a/.github/workflows/js-lint.yml b/.github/workflows/lint-js.yml similarity index 95% rename from .github/workflows/js-lint.yml rename to .github/workflows/lint-js.yml index 4da6b3a82..c7213aa41 100644 --- a/.github/workflows/js-lint.yml +++ b/.github/workflows/lint-js.yml @@ -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/**' diff --git a/.github/workflows/smoke-test-prod.yml b/.github/workflows/smoke-test-prod.yml deleted file mode 100644 index 0d2b88621..000000000 --- a/.github/workflows/smoke-test-prod.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/test-bundler.yml b/.github/workflows/test-bundler.yml index 37f0c0476..f351edddd 100644 --- a/.github/workflows/test-bundler.yml +++ b/.github/workflows/test-bundler.yml @@ -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 diff --git a/.github/workflows/test-cli.yml b/.github/workflows/test-cli.yml new file mode 100644 index 000000000..b87cdcc12 --- /dev/null +++ b/.github/workflows/test-cli.yml @@ -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 diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.yml index 0da34e220..432f79fdf 100644 --- a/.github/workflows/test-core.yml +++ b/.github/workflows/test-core.yml @@ -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