From c85c0d895f70fa5c0c351ae7b5a6e12dec3dac00 Mon Sep 17 00:00:00 2001 From: Alex Freska Date: Tue, 23 Apr 2024 10:49:23 -0400 Subject: [PATCH] ci: speed up release workflow by 2x --- .github/workflows/release-main.yml | 112 ++++++++++++++++++++--------- 1 file changed, 78 insertions(+), 34 deletions(-) diff --git a/.github/workflows/release-main.yml b/.github/workflows/release-main.yml index fb23bc25b..76115a324 100644 --- a/.github/workflows/release-main.yml +++ b/.github/workflows/release-main.yml @@ -13,7 +13,7 @@ env: concurrency: commits-to-main jobs: - release-main: + release: runs-on: ubuntu-latest steps: - name: Checkout all commits @@ -25,15 +25,6 @@ jobs: with: node_version: 20.10.0 go_version: 1.21.7 - - uses: docker/setup-buildx-action@v2 - - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Lint TypeScript - shell: bash - run: npx nx run-many --target=lint --all --parallel=5 # The SDK is referenced via dist in the tsconfig.base.json # because the next executor does not actually support # buildLibsFromSource=false @@ -42,35 +33,12 @@ jobs: - name: Force build SDK shell: bash run: npx nx run sdk:build - - name: Test TypeScript - shell: bash - run: npx nx run-many --target=test --all --parallel=5 - - name: Install playwright deps for e2e - shell: bash - run: npx playwright install-deps - - name: Test e2e - shell: bash - run: npx nx run-many --target=e2e --all --parallel=5 - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Build for publishing shell: bash run: npx nx run-many --target=build --configuration=production --all --parallel=5 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} - - name: Containers - shell: bash - run: npx nx run-many --target=container --configuration=production -all --parallel=5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} - - name: Containers zen - shell: bash - run: npx nx run-many --target=container --configuration=production-testnet-zen -all --parallel=5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} # If there are changesets, then we are in PR prep mode and will # update the release pull request. Note that if there are no changesets # this step will be skipped because no publish script is specified. @@ -104,10 +72,86 @@ jobs: token: ${{ secrets.PAT_REPOSITORY_DISPATCH }} repository: siafoundation/web event-type: release-go + release-docker: + runs-on: ubuntu-latest + steps: + - name: Checkout all commits + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup + uses: ./.github/actions/setup-all + with: + node_version: 20.10.0 + go_version: 1.21.7 + - uses: docker/setup-buildx-action@v2 + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + # The SDK is referenced via dist in the tsconfig.base.json + # because the next executor does not actually support + # buildLibsFromSource=false + # With this configuration NX does not build the SDK as expected + # when it is an app dependency + - name: Force build SDK + shell: bash + run: npx nx run sdk:build + - name: Containers + shell: bash + run: npx nx run-many --target=container --configuration=production -all --parallel=5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} + - name: Containers zen + shell: bash + run: npx nx run-many --target=container --configuration=production-testnet-zen -all --parallel=5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} + # This job should always pass because the workflow is running run against code that + # was already linted and tested in PR. + # This runs in parallel to the build and release process as an extra check but does + # not actually block the release if job fails. + test-js: + runs-on: ubuntu-latest + steps: + - name: Checkout all commits + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup + uses: ./.github/actions/setup-all + with: + node_version: 20.10.0 + go_version: 1.21.7 + - name: Lint TypeScript + shell: bash + run: npx nx run-many --target=lint --all --parallel=5 + # The SDK is referenced via dist in the tsconfig.base.json + # because the next executor does not actually support + # buildLibsFromSource=false + # With this configuration NX does not build the SDK as expected + # when it is an app dependency + - name: Force build SDK + shell: bash + run: npx nx run sdk:build + - name: Test TypeScript + shell: bash + run: npx nx run-many --target=test --all --parallel=5 + - name: Install playwright deps for e2e + shell: bash + run: npx playwright install-deps + - name: Test e2e + shell: bash + run: npx nx run-many --target=e2e --all --parallel=5 + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # This job should always pass because the workflow is running run against code that # was already linted and tested in PR. # This runs in parallel to the build and release process as an extra check but does - # not actually block the release if the Go tests fail. + # not actually block the release if job fails. test-go: # Run matrix since Go modules are used across all platforms runs-on: ${{ matrix.os }}