chore(deps): update npm #896
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Further CI inspiration | |
# https://gist.github.com/PurpleBooth/84b3d7d6669f77d5a53801a258ed269a | |
# https://github.com/qt-creator/qt-creator/blob/master/.github/workflows/build_cmake.yml | |
name: ci | |
on: | |
push: | |
branches: | |
- 'master' | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
build: | |
- default | |
- no_features | |
- stats | |
- web | |
- web_debug | |
- web_debug_static_embedded | |
- all_features | |
include: | |
- build: default | |
features: "" | |
no_default_features: false | |
all_features: false | |
release: true | |
- build: no_features | |
features: "" | |
no_default_features: true | |
all_features: false | |
release: true | |
- build: stats | |
features: stats | |
no_default_features: true | |
all_features: false | |
release: true | |
- build: web | |
features: web | |
no_default_features: true | |
all_features: false | |
release: true | |
- build: web_debug | |
features: web | |
no_default_features: true | |
all_features: false | |
release: false | |
- build: web_debug_static_embedded | |
features: debug_static_embedded | |
no_default_features: true | |
all_features: false | |
release: true | |
- build: all_features | |
features: "" | |
no_default_features: false | |
all_features: true | |
release: true | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: '${{ runner.os }}-cargo-registry-v2-${{ hashFiles(''**/Cargo.lock'') }}' | |
- uses: actions/cache@v4 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-target-checks-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Create dummy web artifacts | |
run: mkdir -p webclients/svelte/build | |
- name: Run cargo check | |
run: cargo check ${{ matrix.features && '--features' }} ${{ matrix.features }} ${{ matrix.release && '--release' || '' }} ${{ matrix.no_default_features && '--no-default-features' || '' }} ${{ matrix.all_features && '--all-features' || '' }} | |
test: | |
name: Test Suite | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
build: | |
- default | |
- no_features | |
- stats | |
- web | |
- web_debug | |
- web_debug_static_embedded | |
- all_features | |
include: | |
- build: default | |
features: "" | |
no_default_features: false | |
all_features: false | |
release: true | |
- build: no_features | |
features: "" | |
no_default_features: true | |
all_features: false | |
release: true | |
- build: stats | |
features: stats | |
no_default_features: true | |
all_features: false | |
release: true | |
- build: web | |
features: web | |
no_default_features: true | |
all_features: false | |
release: true | |
- build: web_debug | |
features: web | |
no_default_features: true | |
all_features: false | |
release: false | |
- build: web_debug_static_embedded | |
features: debug_static_embedded | |
no_default_features: true | |
all_features: false | |
release: true | |
- build: all_features | |
features: "" | |
no_default_features: false | |
all_features: true | |
release: true | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: '${{ runner.os }}-cargo-registry-v2-${{ hashFiles(''**/Cargo.lock'') }}' | |
- uses: actions/cache@v4 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-target-test-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Create dummy web artifacts | |
run: mkdir -p webclients/svelte/build | |
- name: Install latest nextest release | |
uses: taiki-e/install-action@nextest | |
- name: Run cargo nextest | |
run: cargo nextest run --profile ci ${{ matrix.features && '--features' }} ${{ matrix.features }} ${{ matrix.release && '--release' || '' }} ${{ matrix.no_default_features && '--no-default-features' || '' }} ${{ matrix.all_features && '--all-features' || '' }} | |
env: | |
RUST_BACKTRACE: full | |
- name: Setup tmate session | |
if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
uses: mxschmitt/action-tmate@v3 | |
lints: | |
name: Lints | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
build: | |
- default | |
- no_features | |
- stats | |
- web | |
- web_debug | |
- web_debug_static_embedded | |
- all_features | |
include: | |
- build: default | |
features: "" | |
no_default_features: false | |
all_features: false | |
release: true | |
- build: no_features | |
features: "" | |
no_default_features: true | |
all_features: false | |
release: true | |
- build: stats | |
features: stats | |
no_default_features: true | |
all_features: false | |
release: true | |
- build: web | |
features: web | |
no_default_features: true | |
all_features: false | |
release: true | |
- build: web_debug | |
features: web | |
no_default_features: true | |
all_features: false | |
release: false | |
- build: web_debug_static_embedded | |
features: debug_static_embedded | |
no_default_features: true | |
all_features: false | |
release: true | |
- build: all_features | |
features: "" | |
no_default_features: false | |
all_features: true | |
release: true | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: '${{ runner.os }}-cargo-registry-v2-${{ hashFiles(''**/Cargo.lock'') }}' | |
- uses: actions/cache@v4 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-target-checks-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- name: Create dummy web artifacts | |
run: mkdir -p webclients/svelte/build | |
- name: Run cargo fmt | |
run: cargo fmt --all -- --check | |
continue-on-error: true | |
- name: Run cargo clippy | |
run: cargo clippy ${{ matrix.features && '--features' }} ${{ matrix.features }} ${{ matrix.release && '--release' || '' }} ${{ matrix.no_default_features && '--no-default-features' || '' }} ${{ matrix.all_features && '--all-features' || '' }} -- -D warnings | |
web_check: | |
name: Web Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
cache-dependency-path: 'webclients/svelte/package-lock.json' | |
- name: Install node packages | |
run: npm ci | |
working-directory: webclients/svelte | |
- name: Run npm check | |
run: npm run check | |
working-directory: webclients/svelte | |
web_lints: | |
name: Web Lints | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
cache-dependency-path: 'webclients/svelte/package-lock.json' | |
- name: Install node packages | |
run: npm ci | |
working-directory: webclients/svelte | |
- name: Run prettier and eslint | |
run: npm run lint | |
working-directory: webclients/svelte | |
build: | |
needs: | |
- check | |
- test | |
- lints | |
- web_check | |
- web_lints | |
name: Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build: | |
- linux_x64 | |
- linux_x64_stats | |
- linux_x64_web | |
- linux_armv7 | |
- linux_aarch64 | |
- linux_aarch64_stats | |
- linux_aarch64_web | |
- mac_x64 | |
- mac_x64_stats | |
- mac_x64_web | |
include: | |
- build: linux_x64 | |
# building x86_64-unknown-linux-musl fails with not finding musl-gcc | |
rust_target_arch: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
cross: false | |
features: "" | |
- build: linux_x64_stats | |
# building x86_64-unknown-linux-musl fails with not finding musl-gcc | |
rust_target_arch: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
cross: false | |
features: stats | |
- build: linux_x64_web | |
# building x86_64-unknown-linux-musl fails with not finding musl-gcc | |
rust_target_arch: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
cross: false | |
features: web | |
- build: linux_armv7 | |
rust_target_arch: armv7-unknown-linux-musleabihf | |
os: ubuntu-latest | |
cross: true | |
features: "" | |
- build: linux_aarch64 | |
rust_target_arch: aarch64-unknown-linux-musl | |
os: ubuntu-latest | |
cross: true | |
features: "" | |
- build: linux_aarch64_stats | |
rust_target_arch: aarch64-unknown-linux-musl | |
os: ubuntu-latest | |
cross: true | |
features: stats | |
- build: linux_aarch64_web | |
rust_target_arch: aarch64-unknown-linux-musl | |
os: ubuntu-latest | |
cross: true | |
features: web | |
- build: mac_x64 | |
rust_target_arch: x86_64-apple-darwin | |
os: macos-latest | |
cross: false | |
features: "" | |
- build: mac_x64_stats | |
rust_target_arch: x86_64-apple-darwin | |
os: macos-latest | |
cross: false | |
features: stats | |
- build: mac_x64_web | |
rust_target_arch: x86_64-apple-darwin | |
os: macos-latest | |
cross: false | |
features: web | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Cache cargo registry | |
uses: actions/cache@v4 | |
if: matrix.cross == true | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: '${{ runner.os }}-cargo-registry-v2-${{ hashFiles(''**/Cargo.lock'') }}' | |
- name: Cache target folder | |
uses: actions/cache@v4 | |
if: matrix.cross == true | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-target-builds-${{ matrix.build }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.rust_target_arch }} | |
- name: Use smart rust cache | |
uses: Swatinem/rust-cache@v2 | |
if: matrix.cross == false | |
with: | |
key: ${{ matrix.build }} | |
- name: Show project dependency graph | |
run: cargo tree | |
- name: Install cross | |
if: matrix.cross == true | |
run: cargo install cross --git https://github.com/cross-rs/cross | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
if: matrix.features == 'web' | |
with: | |
node-version: 20 | |
cache: npm | |
cache-dependency-path: 'webclients/svelte/package-lock.json' | |
- name: Install node packages | |
run: npm ci | |
working-directory: webclients/svelte | |
if: matrix.features == 'web' | |
- name: Generate types from the rust generated openapi schema | |
run: npm run apigen | |
working-directory: webclients/svelte | |
if: matrix.features == 'web' | |
- name: Build web app | |
run: npm run build | |
working-directory: webclients/svelte | |
if: matrix.features == 'web' | |
- name: Create dummy web artifacts | |
run: mkdir -p webclients/svelte/build | |
if: matrix.features != 'web' | |
- name: Build with cargo | |
run: cargo build --release --target=${{ matrix.rust_target_arch }} ${{ matrix.features && '--features' }} ${{ matrix.features }} --no-default-features | |
if: matrix.cross == false | |
- name: Build with cross | |
run: cross build --release --target=${{ matrix.rust_target_arch }} ${{ matrix.features && '--features' }} ${{ matrix.features }} --no-default-features | |
if: matrix.cross == true | |
- name: Run app with --build-info | |
run: cargo run --release --target=${{ matrix.rust_target_arch }} ${{ matrix.features && '--features' }} ${{ matrix.features }} --no-default-features -- --build-info | |
if: matrix.cross == false | |
- name: Create staging archive | |
id: create_staging_archive | |
uses: ./.github/actions/create_archive | |
with: | |
rust_target_arch: ${{ matrix.rust_target_arch }} | |
archive_suffix: "-${{ github.run_id }}" | |
- name: Upload archive | |
uses: actions/upload-artifact@master | |
with: | |
name: ${{ env.ARTIFACT_NAME }}-${{ env.RELEASE_VERSION }}-${{ matrix.rust_target_arch }}-feat-${{ matrix.build }}-${{ github.run_id }}.tar.gz | |
path: ${{ steps.create_staging_archive.outputs.archive_name }} |