fix(CI): adjust job queue and remove wasteful runs (#51404)

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
pull/51412/head
Mrugesh Mohapatra 2023-08-28 16:48:51 +05:30 committed by GitHub
parent ec33071537
commit 2c37e18c7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 92 deletions

View File

@ -1,17 +1,6 @@
name: CI - E2E - Mobile (webview) Browser
on:
workflow_dispatch:
# push:
# paths-ignore:
# - 'docs/**'
# branches:
# - 'main'
# pull_request:
# paths-ignore:
# - 'docs/**'
# branches:
# - 'main'
# - 'next-**'
jobs:
mobile-test:

View File

@ -1,11 +1,11 @@
name: CI - E2E - Playwright
on:
push:
paths-ignore:
- 'docs/**'
branches:
- 'main'
- 'e2e-**'
workflow_dispatch:
workflow_run:
workflows: ['CI - Node.js']
types:
- completed
# TODO: refactor with a workflow_call
pull_request:
paths-ignore:
- 'docs/**'

View File

@ -1,16 +1,18 @@
name: CI - E2E - Web browser
on:
push:
paths-ignore:
- 'docs/**'
branches:
- 'main'
workflow_dispatch:
workflow_run:
workflows: ['CI - Node.js']
types:
- completed
# TODO: refactor with a workflow_call
pull_request:
paths-ignore:
- 'docs/**'
branches:
- 'main'
- 'next-**'
- 'e2e-**'
jobs:
build-client:

View File

@ -70,9 +70,42 @@ jobs:
pnpm run build:curriculum
pnpm run lint
# DONT REMOVE THIS JOB.
# TODO: Refactor and use re-usable workflow and shared artifacts
build:
name: Build
needs: lint
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout Source Files
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Set freeCodeCamp Environment Variables
run: cp sample.env .env
- name: Install and Build
run: |
pnpm install
pnpm run build
test:
name: Test
needs: lint
needs: build
runs-on: ubuntu-20.04
strategy:
@ -117,46 +150,9 @@ jobs:
- name: Run Tests
run: pnpm test
# DONT REMOVE THIS JOB, you dont know what it does
build:
name: Build
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout Source Files
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- name: Checkout client-config
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
repository: freeCodeCamp/client-config
path: client-config
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Set freeCodeCamp Environment Variables
run: cp sample.env .env
- name: Install and Build
run: |
pnpm install
pnpm run build
test-upcoming:
name: Test Upcoming Changes
needs: lint
name: Test - Upcoming Changes
needs: build
runs-on: ubuntu-20.04
strategy:
@ -203,8 +199,8 @@ jobs:
run: pnpm test
test-new:
name: Test New Curriculum
needs: lint
name: Test - New Curriculum
needs: build
runs-on: ubuntu-20.04
strategy:
@ -252,8 +248,8 @@ jobs:
run: pnpm test
test-localization:
name: Localize
needs: lint
name: Test - i18n
needs: build
runs-on: ubuntu-20.04
strategy:
@ -304,29 +300,3 @@ jobs:
CURRICULUM_LOCALE: ${{ matrix.locale }}
CLIENT_LOCALE: ${{ matrix.locale }}
run: pnpm test
failure-comment:
name: Comment on i18n Failure
needs: ['test', 'test-localization']
runs-on: ubuntu-20.04
if: ${{ always() && needs.test.result == 'success' && needs.test-localization.result == 'failure' }}
steps:
- uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
with:
github-token: ${{ secrets.CAMPERBOT_NO_TRANSLATE }}
script: |
const isDev = await github.rest.teams.getMembershipForUserInOrg({
org: "freeCodeCamp",
team_slug: "dev-team",
username: context.payload.pull_request.user.login
}).catch(() => ({status: 404}));
if (context.payload.pull_request.user.login !== "camperbot" && isDev.status !== 200) {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Hi,\n\nIt looks like the localization tests have failed. This is expected when there are significant curriculum changes in the English version.\n\nThis could mean a Crowdin sync is required to address the scenario. Please check with our staff developer team, either on [Discord](https://discord.gg/KVUmVXA) or our [forums](https://forum.freecodecamp.org). They will confirm and take over helping you through the PR.\n\nThanks for your understanding and contribution."
})
} else if (isDev.status === 200) {
core.setFailed('This PR appears to touch translated curriculum files, but since you are on the dev team there is no message.');
}