diff --git a/.github/workflows/docker-hub-latest.yml b/.github/workflows/docker-hub-latest.yml index 99fdb119..9db91cc0 100644 --- a/.github/workflows/docker-hub-latest.yml +++ b/.github/workflows/docker-hub-latest.yml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx diff --git a/.github/workflows/docker-hub-release.yml b/.github/workflows/docker-hub-release.yml index acf58f1d..3fb9e000 100644 --- a/.github/workflows/docker-hub-release.yml +++ b/.github/workflows/docker-hub-release.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get release tag run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Set up QEMU diff --git a/.github/workflows/docs-latest.yml b/.github/workflows/docs-latest.yml index 1223db3b..c15a2cb7 100644 --- a/.github/workflows/docs-latest.yml +++ b/.github/workflows/docs-latest.yml @@ -13,10 +13,10 @@ jobs: deploy: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: .node-version diff --git a/.github/workflows/docs-release.yml b/.github/workflows/docs-release.yml index d492fb7f..632b23c9 100644 --- a/.github/workflows/docs-release.yml +++ b/.github/workflows/docs-release.yml @@ -12,10 +12,10 @@ jobs: deploy: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: .node-version diff --git a/.github/workflows/helm-lint.yml b/.github/workflows/helm-lint.yml index 600e5be5..32bf61ee 100644 --- a/.github/workflows/helm-lint.yml +++ b/.github/workflows/helm-lint.yml @@ -14,7 +14,7 @@ jobs: lint-helm: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Lint Helm uses: WyriHaximus/github-action-helm3@v3 diff --git a/.github/workflows/helm.yml b/.github/workflows/helm.yml index 15d50742..e42604e6 100644 --- a/.github/workflows/helm.yml +++ b/.github/workflows/helm.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 978e61b8..1eceba7e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,66 +20,63 @@ concurrency: jobs: lint-node: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version-file: .node-version - - run: yarn --ignore-scripts - - run: yarn lint:js + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + - run: yarn --ignore-scripts + - run: yarn lint:js lint-rust: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - components: rustfmt - - run: cargo fmt --all -- --check - - run: cargo clippy -- -Dwarnings + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + with: + shared-key: rust-cache + - run: cargo fmt --all -- --check + - run: cargo clippy -- -Dwarnings config: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 + needs: + # for cache population + - lint-rust + env: + HOOKSHOT_BUILD_PROFILE: " " # This is equivalent to dev steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: .node-version + - uses: Swatinem/rust-cache@v2 + with: + shared-key: rust-cache - run: yarn # Need to build scripts to get rust bindings - run: yarn --silent ts-node src/config/Defaults.ts --config | diff config.sample.yml - - - metrics-docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version-file: .node-version - - run: yarn # Need to build scripts to get rust bindings - run: yarn --silent ts-node ./scripts/build-metrics-docs.ts | diff docs/metrics.md - test: # Test on LTS-1 - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 + env: + HOOKSHOT_BUILD_PROFILE: " " + needs: + - lint-node + - lint-rust strategy: matrix: node_version: [20, 21] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node_version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node_version }} - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - uses: Swatinem/rust-cache@v2 with: shared-key: rust-cache @@ -87,12 +84,12 @@ jobs: - run: yarn test:cover build-homerunner: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 outputs: homerunnersha: ${{ steps.gitsha.outputs.sha }} steps: - name: Checkout matrix-org/complement - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: matrix-org/complement - name: Get complement git sha @@ -100,7 +97,7 @@ jobs: run: echo sha=`git rev-parse --short HEAD` >> "$GITHUB_OUTPUT" - name: Cache homerunner id: cached - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: homerunner key: ${{ runner.os }}-homerunner-${{ steps.gitsha.outputs.sha }} @@ -120,28 +117,30 @@ jobs: go build ./cmd/homerunner integration-test: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 timeout-minutes: 30 needs: - test - build-homerunner + env: + HOOKSHOT_BUILD_PROFILE: " " steps: - name: Install Complement Dependencies run: | sudo apt-get update && sudo apt-get install -y libolm3 - name: Load cached homerunner bin - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: homerunner key: ${{ runner.os }}-homerunner-${{ needs.build-synapse.outputs.homerunnersha }} fail-on-cache-miss: true # Shouldn't happen, we build this in the needs step. - name: Checkout matrix-hookshot - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: matrix-hookshot # Setup node & run tests - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: matrix-hookshot/.node-version - uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/newsfile.yml b/.github/workflows/newsfile.yml index ce32d639..21557fa5 100644 --- a/.github/workflows/newsfile.yml +++ b/.github/workflows/newsfile.yml @@ -9,7 +9,7 @@ jobs: changelog: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # Needed for comparison fetch-depth: 0 - uses: actions/setup-python@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4a7e217e..1d4d97b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ jobs: draft-release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Get changelog id: extract-changelog env: diff --git a/changelog.d/916.bugfix b/changelog.d/916.bugfix new file mode 100644 index 00000000..b7641f93 --- /dev/null +++ b/changelog.d/916.bugfix @@ -0,0 +1 @@ +Cache more dependencies in CI to speed up runs. diff --git a/package.json b/package.json index 68f75d73..db23c744 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "scripts": { "build:web": "vite build", "build:app": "tsc --project tsconfig.json", - "build:app:rs": "napi build --dts ../src/libRs.d.ts --release ./lib", + "build:app:rs": "napi build --dts ../src/libRs.d.ts $HOOKSHOT_BUILD_PROFILE ./lib", "build:app:fix-defs": "ts-node scripts/definitions-fixer.ts src/libRs.d.ts", "build:docs": "ts-node scripts/build-metrics-docs.ts > docs/metrics.md && mdbook build", "dev:web": "vite dev", diff --git a/scripts/build-app.sh b/scripts/build-app.sh index 6a8fdce4..437f0511 100755 --- a/scripts/build-app.sh +++ b/scripts/build-app.sh @@ -1,8 +1,10 @@ -#!/bin/bash +#!/usr/bin/env bash # exit when any command fails set -e +export HOOKSHOT_BUILD_PROFILE="${HOOKSHOT_BUILD_PROFILE:---release}" + echo "Building Rust layer" yarn run build:app:rs echo "Running rust-typescript definitions fix"