From 5de469e3124270daa4a0bf0196f02c9fc3dfb010 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 7 May 2025 22:15:48 -0400 Subject: [PATCH] Update workflow files (#675) ## Description: - Split the CI workflow in to separate build and test jobs, to improve visibility on PRs when the build passes but tests fail. - Add emoji labels to various jobs and steps - Add build and startup time to job summary ![image](https://github.com/user-attachments/assets/187e99d2-20de-4220-b1a4-11f4d2e72647) ![image](https://github.com/user-attachments/assets/83f9a9fc-c118-415a-92ca-faca48bac31e) ![image](https://github.com/user-attachments/assets/b8061a28-7d5d-4f93-99c6-673f3ca84e30) ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com> --- .github/workflows/ci.yml | 23 ++++++++++++++++------- .github/workflows/deploy.yml | 18 ++++++++++-------- .github/workflows/eslint.yml | 4 ++-- .github/workflows/prettier.yml | 4 ++-- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 076493044..8e3954117 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI +name: ๐Ÿงช CI on: [push, pull_request] jobs: build: @@ -12,13 +12,22 @@ jobs: uses: actions/setup-node@v4 with: node-version: 20 - - name: Setup npm - run: npm install - - name: Run tests - run: npm test - - name: Build - run: npm run build-prod + - run: npm ci + - run: npm run build-prod - uses: actions/upload-artifact@v4 with: path: out/index.html retention-days: 1 + test: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: false + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm ci + - run: npm test diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3eb00042d..836b8ec33 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -61,7 +61,7 @@ jobs: SUBDOMAIN: ${{ github.event_name == 'push' && github.ref_name || inputs.target_subdomain || 'main' }} steps: - uses: actions/checkout@v4 - - name: Update deployment status + - name: ๐Ÿ“ Update deployment status env: FQDN: ${{ env.SUBDOMAIN && format('{0}.{1}', env.SUBDOMAIN, env.DOMAIN) || env.DOMAIN || 'openfront.dev' }} run: | @@ -71,12 +71,12 @@ jobs: Deploying from $GITHUB_REF to $FQDN EOF - - name: Log in to Docker Hub + - name: ๐Ÿ”— Log in to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Create SSH private key + - name: ๐Ÿ”‘ Create SSH private key env: SERVER_HOST_EU: ${{ secrets.SERVER_HOST_EU }} SERVER_HOST_STAGING: ${{ secrets.SERVER_HOST_STAGING }} @@ -90,7 +90,7 @@ jobs: test -n "$SERVER_HOST_US" && ssh-keyscan -H "$SERVER_HOST_US" >> ~/.ssh/known_hosts test -n "$SERVER_HOST_EU" && ssh-keyscan -H "$SERVER_HOST_EU" >> ~/.ssh/known_hosts chmod 600 ~/.ssh/id_rsa - - name: Deploy + - name: ๐Ÿšข Deploy env: ADMIN_TOKEN: ${{ secrets.ADMIN_TOKEN }} CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} @@ -115,8 +115,9 @@ jobs: run: | echo "::group::deploy.sh" ./deploy.sh "$ENV" "$HOST" "$SUBDOMAIN" + echo "Deployment created in ${SECONDS} seconds" >> $GITHUB_STEP_SUMMARY echo "::endgroup::" - - name: Wait for deployment to start + - name: โณ Wait for deployment to start run: | echo "::group::Wait for deployment to start" set -euxo pipefail @@ -127,8 +128,9 @@ jobs: fi sleep 10 done + echo "Deployment started in ${SECONDS} seconds" >> $GITHUB_STEP_SUMMARY echo "::endgroup::" - - name: Notify PR ๐Ÿš€ + - name: ๐Ÿš€ Notify PR if: ${{ success() && github.event_name == 'push' && github.repository != 'openfrontio/OpenFrontIO' }} @@ -147,7 +149,7 @@ jobs: exit 0; fi gh pr comment "$pr_url" --body "๐Ÿš€ Deployed ${GITHUB_SHA} to [$FQDN](https://$FQDN)." - - name: Update deployment status โœ… + - name: โœ… Update deployment status if: success() run: | cat <> $GITHUB_STEP_SUMMARY @@ -155,7 +157,7 @@ jobs: Deployed from $GITHUB_REF to $FQDN EOF - - name: Update deployment status โŒ + - name: โŒ Update deployment status if: failure() run: | cat <> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 3cd72b90e..836b8284d 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -1,4 +1,4 @@ -name: ESLint Check +name: ๐Ÿ” ESLint on: pull_request: @@ -6,7 +6,7 @@ on: branches: [main] jobs: - eslint: + check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 530ef7fcf..315b8031b 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -1,4 +1,4 @@ -name: Prettier Check +name: ๐ŸŽจ Prettier on: pull_request: @@ -6,7 +6,7 @@ on: branches: [main] jobs: - prettier: + check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4