Merge pull request #230 from zimmerman-team/develop #391
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: Tests | |
on: | |
push: | |
branches: ["main", "develop"] | |
pull_request: | |
branches: ["main", "develop"] | |
env: | |
# For recording and parallelization to work you must set your CYPRESS_RECORD_KEY | |
# in GitHub repo → Settings → Secrets → Actions | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
# Creating a token https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Custom environment variables | |
# AUTH0 | |
AUTH0_USERNAME: ${{ secrets.AUTH0_USERNAME }} | |
AUTH0_PASSWORD: ${{ secrets.AUTH0_PASSWORD }} | |
AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }} | |
REACT_APP_AUTH0_DOMAIN: ${{ secrets.REACT_APP_AUTH0_DOMAIN }} | |
REACT_APP_AUTH0_AUDIENCE: ${{ secrets.REACT_APP_AUTH0_AUDIENCE }} | |
REACT_APP_AUTH0_CLIENT: ${{ secrets.REACT_APP_AUTH0_CLIENT }} | |
# API | |
REACT_APP_API: ${{ secrets.REACT_APP_API }} | |
REACT_APP_BASE_URL: ${{ secrets.REACT_APP_BASE_URL }} | |
REACT_APP_MAPBOX_TOKEN: ${{ secrets.REACT_APP_MAPBOX_TOKEN }} | |
REACT_APP_GOOGLE_ANALYTICS_ID: ${{ secrets.REACT_APP_GOOGLE_ANALYTICS_ID }} | |
REACT_APP_CMS_API: ${{ secrets.REACT_APP_CMS_API }} | |
REACT_APP_CMS_TOKEN: ${{ secrets.REACT_APP_CMS_TOKEN }} | |
REACT_APP_GOOGLE_API_CLIENT_ID: ${{ secrets.REACT_APP_GOOGLE_API_CLIENT_ID }} | |
REACT_APP_GOOGLE_API_DEV_KEY: ${{ secrets.REACT_APP_GOOGLE_API_DEV_KEY }} | |
REACT_APP_CYPRESS_TEST: "true" | |
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }} | |
GENERATE_SOURCEMAP: false | |
# GOOGLE CYPRESS | |
GOOGLE_CLIENT_ID_TEST: ${{ secrets.GOOGLE_CLIENT_ID_TEST }} | |
GOOGLE_CLIENT_SECRET_TEST: ${{ secrets.GOOGLE_CLIENT_SECRET_TEST }} | |
GOOGLE_REFRESH_TOKEN_TEST: ${{ secrets.GOOGLE_REFRESH_TOKEN_TEST }} | |
jobs: | |
jest-run: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '16' | |
cache: 'yarn' | |
- name: Install packages | |
run: yarn install && yarn add "https://github.com/zimmerman-team/rawgraphs-charts.git#b86c928" | |
- name: Build rawgraphs package | |
run: | | |
if [ -d "node_modules/@rawgraphs/rawgraphs-charts" ]; then | |
cd node_modules/@rawgraphs/rawgraphs-charts | |
yarn | |
yarn build | |
else | |
echo "Package directory not found" | |
fi | |
- name: Jest run | |
run: yarn test | |
cypress-run: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '16' | |
cache: 'yarn' | |
- name: Install packages | |
run: yarn install && yarn add "https://github.com/zimmerman-team/rawgraphs-charts.git#b86c928" | |
- name: Build rawgraphs package | |
run: | | |
if [ -d "node_modules/@rawgraphs/rawgraphs-charts" ]; then | |
cd node_modules/@rawgraphs/rawgraphs-charts | |
yarn | |
yarn build | |
else | |
echo "Package directory not found" | |
fi | |
- name: Cypress run | |
# Uses the official Cypress GitHub action https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
# Starts web server for E2E tests - replace with your own server invocation | |
# https://docs.cypress.io/guides/continuous-integration/introduction#Boot-your-server | |
start: yarn start | |
wait-on: "http://127.0.0.1:3000" # Waits for above | |
wait-on-timeout: 180 | |
# Records to Cypress Cloud | |
# https://docs.cypress.io/guides/cloud/projects#Set-up-a-project-to-record | |
record: true | |
# parallel: true # Runs test in parallel using settings above | |