diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index cbb9e65..f4f647e 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -1,8 +1,6 @@ -name: Run formatter, linter and tests +name: Run formatter and linter on: - merge_group: pull_request: - push: branches: - main @@ -21,8 +19,8 @@ jobs: - name: Check Rust formatting run: cargo fmt --all -- --check - lint-and-test: - timeout-minutes: 30 + lint: + timeout-minutes: 10 strategy: max-parallel: 1 runs-on: ubuntu-latest @@ -40,6 +38,10 @@ jobs: - uses: dtolnay/rust-toolchain@1.76 with: components: clippy + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: npm - name: Install Linux dependencies run: | sudo apt-get update @@ -55,5 +57,5 @@ jobs: git remote set-branches origin main git fetch --depth 1 origin main git branch main origin/main - - name: Run Nx-configured `lint` and `test` targets - run: npx nx affected -t lint test --base=main --head=HEAD + - name: Run Nx-configured `lint` targets + run: npx nx affected -t lint --base=main --head=HEAD diff --git a/.github/workflows/prod-validation.yml b/.github/workflows/prod-validation.yml new file mode 100644 index 0000000..bc1b791 --- /dev/null +++ b/.github/workflows/prod-validation.yml @@ -0,0 +1,46 @@ +name: Run unit tests +on: + pull_request: + branches: + - production + +env: + CARGO_TERM_COLOR: always + +jobs: + test: + timeout-minutes: 30 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin + ~/.cargo/registry/index/ + ~/.cargp/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-lint-and-test-${{ hashFiles('**/Cargo.toml') }} + - uses: dtolnay/rust-toolchain@1.76 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: npm + - name: Install Linux dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + libasound2-dev \ + libudev-dev \ + git + - name: Install JS dependencies + run: npm ci + - name: Ensure unambiguous `production` + if: github.ref != 'refs/heads/production' + run: | + git remote set-branches origin production + git fetch --depth 1 origin production + git branch production origin/production + - name: Run Nx-configured `test` targets + run: npx nx affected -t test --base=production --head=HEAD diff --git a/ci-image-gen.sh b/ci-image-gen.sh index 372cb45..0455711 100755 --- a/ci-image-gen.sh +++ b/ci-image-gen.sh @@ -9,9 +9,6 @@ rustup target add wasm32-unknown-unknown rustup show active-toolchain npm version -# Install project dependencies -npm ci - # Build projects #npx nx run studio:build:image-generator npx nx run studio:build:web diff --git a/ci.sh b/ci.sh index d83add2..39661d3 100755 --- a/ci.sh +++ b/ci.sh @@ -11,9 +11,6 @@ rustup target add wasm32-unknown-unknown rustup show npm version -# Install project dependencies -npm ci - # Build projects npx nx run studio:build:web npx nx run studio-frontend:build:production