From 7acadc29cc2f9d7ff2e5600f4bf214b9bb8460d9 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 7 Jan 2025 10:58:29 +0000 Subject: [PATCH] Speed up Netlify CI/CD (#28878) * Speed up Netlify CI/CD By switching it from using the webapp from the E2E CI to the Build CI which doesn't need to await any tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .github/workflows/build.yml | 35 ++++++++++++++++++++++++++++++---- .github/workflows/netlify.yaml | 4 ++-- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 381755b6067..7e3b8207627 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,9 @@ on: branches: [develop, master] merge_group: types: [checks_requested] +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.sha }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} # develop pushes and repository_dispatch handled in build_develop.yaml env: # These must be set for fetchdep.sh to get the right branch @@ -37,14 +40,38 @@ jobs: - uses: actions/setup-node@v4 with: - cache: "yarn" + # Disable cache on Windows as it is slower than not caching + # https://github.com/actions/setup-node/issues/975 + cache: ${{ runner.os != 'Windows' && 'yarn' || '' }} node-version: "lts/*" # Workaround for yarn install timeouts, especially on Windows - run: yarn config set network-timeout 300000 - - name: Install Dependencies - run: "./scripts/layered.sh" + - name: Fetch layered build + id: layered_build + env: + # tell layered.sh to check out the right sha of the JS-SDK & EW, if they were given one + JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }} + run: | + scripts/layered.sh + JSSDK_SHA=$(git -C matrix-js-sdk rev-parse --short=12 HEAD) + VECTOR_SHA=$(git rev-parse --short=12 HEAD) + echo "VERSION=$VECTOR_SHA--js-$JSSDK_SHA" >> $GITHUB_OUTPUT + + - name: Copy config + run: cp element.io/develop/config.json config.json - name: Build - run: "yarn build" + env: + CI_PACKAGE: true + VERSION: "${{ steps.layered_build.outputs.VERSION }}" + run: | + yarn build + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: webapp-${{ matrix.image }} + path: webapp + retention-days: 1 diff --git a/.github/workflows/netlify.yaml b/.github/workflows/netlify.yaml index 63bac7d33f5..cd03ca5140f 100644 --- a/.github/workflows/netlify.yaml +++ b/.github/workflows/netlify.yaml @@ -3,7 +3,7 @@ name: Upload Preview Build to Netlify on: workflow_run: - workflows: ["End to End Tests"] + workflows: ["Build"] types: - completed jobs: @@ -32,7 +32,7 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} run-id: ${{ github.event.workflow_run.id }} - name: webapp + name: webapp-ubuntu-24.04 path: webapp - name: 📤 Deploy to Netlify