build: extract e2e tests workflow #115
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GitHub Actions CI (Branch) | ||
on: | ||
pull_request: | ||
branches: [ "main" ] | ||
# TODO: FIXME: how to trigger on push to all branches? | ||
push: | ||
branches: [ "dev-pipeline" ] | ||
# TODO: what version of node are we getting and why? rush.json? actions default? | ||
# TODO: what jobs should be broken out into reusiable workflows? | ||
# https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow | ||
jobs: | ||
install: | ||
uses: ./.github/workflows/install.yml | ||
build: | ||
needs: install | ||
uses: ./.github/workflows/build.yml | ||
lint: | ||
needs: [install, build] | ||
uses: ./.github/workflows/lint.yml | ||
with: | ||
ENVIRONMENT: ${{ vars.ENVIRONMENT }} | ||
secrets: inherit | ||
unit-test: | ||
needs: [install, build] | ||
uses: ./.github/workflows/unit-test.yml | ||
with: | ||
ENVIRONMENT: ${{ vars.ENVIRONMENT }} | ||
secrets: inherit | ||
e2e-test: | ||
needs: [install, build] | ||
uses: ./.github/workflows/e2e-test.yml | ||
Check failure on line 39 in .github/workflows/branch.yml
|
||
with: | ||
ENVIRONMENT: ${{ vars.ENVIRONMENT }} | ||
secrets: inherit | ||
# TODO: FIXME: deploy should only run on merge to main or push to stage/** branches | ||
deploy: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: staging | ||
url: https://www-stage.trshcmpctr.com | ||
needs: [install, build, unit-test, e2e-test, lint] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Restore Build Cache | ||
id: restore-build-cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: | | ||
~/.cache/Cypress | ||
common/temp | ||
*/.rush/temp | ||
*/node_modules | ||
*/dist | ||
key: ${{ runner.os }}-${{ hashFiles('common/config/rush/repo-state.json') }}-build | ||
fail-on-cache-miss: true | ||
# TODO: dedupe 1 | ||
- name: Configure Discord Secrets | ||
run: (cd discord && ./client_config_ci.sh) | ||
env: | ||
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }} | ||
DISCORD_CLIENT_SECRET: ${{ secrets.DISCORD_CLIENT_SECRET }} | ||
DISCORD_GUILD_ID: ${{ secrets.DISCORD_GUILD_ID }} | ||
DISCORD_SESSION_SECRET: ${{ secrets.DISCORD_SESSION_SECRET }} | ||
DISCORD_REDIRECT_URI: ${{ secrets.DISCORD_REDIRECT_URI }} | ||
# TODO: dedupe 2 | ||
- name: Configure Deploy Secrets | ||
run: (cd deploy && ./client_config_ci.sh) | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
ENVIRONMENT: ${{ vars.ENVIRONMENT }} | ||
- name: Create Deployment Artifacts | ||
run: node common/scripts/install-run-rush.js deploy --create-archive deploy.zip | ||
- name: Upload Deployment Artifacts | ||
run: (cd deploy && npm run upload ${{ vars.ENVIRONMENT }}) | ||
# TODO: any utility in uploading deploy.zip with actions/upload-artifact? https://github.com/actions/upload-artifact | ||
- name: Deploy | ||
run: (cd deploy && npm start ${{ vars.ENVIRONMENT }}) |