Skip to content

fix

fix #11

Workflow file for this run

name: Build
on:
merge_group:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
- chore/github-actions
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
NODE_VERSION: 18
CACHE_KEY: '${{ github.ref }}-${{ github.run_id }}-${{ github.run_attempt }}'
jobs:
sample-01:
name: Build and Unit Test Sample
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- run: git clone https://github.com/auth0-samples/spa-quickstarts-tests scripts
- name: Build Sample
uses: ./.github/actions/build
with:
working-directory: Sample-01
standalone:
name: Build and Unit Test Standalone
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- run: git clone https://github.com/auth0-samples/spa-quickstarts-tests scripts
- name: Build Standalone
uses: ./.github/actions/build
with:
working-directory: Standalone
e2e-sample-01:
name: E2E Test Sample
runs-on: ubuntu-latest
env:
AUTH0_CFG: Sample-01/auth_config.json
AUTH0_EXAMPLE_CFG: Sample-01/auth_config.json.example
SAMPLE_PATH: Sample-01
IMAGE_NAME: ${{ github.event.pull_request.head.sha || github.sha }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- run: git clone https://github.com/auth0-samples/spa-quickstarts-tests scripts
- name: Replace Auth0 test credentials
run: |
sed \
-e "s/{DOMAIN}/$AUTH0_TEST_DOMAIN/g" \
-e "s/{CLIENT_ID}/$AUTH0_TEST_CLIENT_ID/g" \
-e "s/{API_IDENTIFIER}/$AUTH0_TEST_API_IDENTIFIER/g" \
$AUTH0_EXAMPLE_CFG > $AUTH0_CFG
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build pull request
run: |
docker build -t $IMAGE_NAME ./$SAMPLE_PATH
docker run -d -p 4200:4200 --name $CONTAINER_NAME $IMAGE_NAME
- name: Wait for app to be available
run: |
sleep 10
docker run --network host --rm appropriate/curl --retry 8 --retry-connrefused -v localhost:4200
- name: Run tests
run: |
docker create --env "SAMPLE_PORT=4200" --network host --name tester codeceptjs/codeceptjs codeceptjs run-multiple --all --steps
docker cp $(pwd)/lock_login_test.js tester:/tests/lock_login_test.js
docker cp $(pwd)/codecept.conf.js tester:/tests/codecept.conf.js
docker start -i tester
working-directory: scripts
- name: Copy app container logs
run: |
mkdir -p /tmp/out
docker logs $CONTAINER_NAME > /tmp/out/app_logs.log
docker cp tester:/tests/out /tmp/
if: failure()