TECH-1172 define env variables for every app #5
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: Build and run example apps using dev endpoints | |
on: [push, pull_request] | |
jobs: | |
# check-version: | |
# runs-on: ubuntu-latest | |
# outputs: | |
# version_changed: ${{ env.version_changed }} | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Check Versions | |
# id: check-version | |
# run: | | |
# BETA_VERSION=$(npm view @civic/auth@beta version) | |
# PROD_VERSION=$(npm view @civic/auth version) | |
# echo "Beta version: $BETA_VERSION" | |
# echo "Production version: $PROD_VERSION" | |
# if [ -f .civic-versions ]; then | |
# PREV_VERSIONS=$(cat .civic-versions) | |
# PREV_BETA=$(echo "$PREV_VERSIONS" | head -n1) | |
# PREV_PROD=$(echo "$PREV_VERSIONS" | tail -n1) | |
# if [ "$BETA_VERSION" != "$PREV_BETA" ] || [ "$PROD_VERSION" != "$PREV_PROD" ]; then | |
# echo "version_changed=true" >> $GITHUB_ENV | |
# echo "Changed from:" | |
# echo "Beta: $PREV_BETA -> $BETA_VERSION" | |
# echo "Prod: $PREV_PROD -> $PROD_VERSION" | |
# fi | |
# fi | |
# echo "$BETA_VERSION" > .civic-versions | |
# echo "$PROD_VERSION" >> .civic-versions | |
build: | |
# needs: check-version | |
# if: needs.check-version.outputs.version_changed == 'true' | |
runs-on: ubuntu-latest | |
env: | |
CLIENT_ID: example-repo-client-id | |
VITE_CLIENT_ID: example-repo-client-id | |
OAUTH_SERVER: https://auth-dev.civic.com/oauth | |
defaults: | |
run: | |
working-directory: ./ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Bun (used to run the examples) | |
uses: oven-sh/setup-bun@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install dependencies' | |
shell: bash | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: yarn build | |
- name: Start the nextjs example app | |
uses: JarvusInnovations/background-action@v1.0.7 | |
with: | |
run: yarn dev & | |
working-directory: packages/civic-auth/nextjs | |
wait-on: http://localhost:3000 | |
wait-for: 60s | |
log-output-if: true | |
env: | |
CLIENT_ID: example-repo-client-id | |
OAUTH_SERVER: https://auth-dev.civic.com/oauth | |
- name: Start the reactjs example app | |
uses: JarvusInnovations/background-action@v1.0.7 | |
with: | |
run: yarn dev & | |
working-directory: packages/civic-auth/reactjs | |
wait-on: http://localhost:3006 | |
wait-for: 60s | |
log-output-if: true | |
env: | |
VITE_CLIENT_ID: example-repo-client-id | |
OAUTH_SERVER: https://auth-dev.civic.com/oauth | |
- name: Start the express example app | |
uses: JarvusInnovations/background-action@v1.0.7 | |
with: | |
run: yarn dev & | |
working-directory: packages/civic-auth/server/express | |
wait-on: http://localhost:3007 | |
wait-for: 60s | |
log-output-if: true | |
env: | |
CLIENT_ID: example-repo-client-id | |
OAUTH_SERVER: https://auth-dev.civic.com/oauth | |
- name: Start the fastify example app | |
uses: JarvusInnovations/background-action@v1.0.7 | |
with: | |
run: yarn dev & | |
working-directory: packages/civic-auth/server/fastify | |
wait-on: http://localhost:3008 | |
wait-for: 60s | |
log-output-if: true | |
env: | |
CLIENT_ID: example-repo-client-id | |
OAUTH_SERVER: https://auth-dev.civic.com/oauth | |
- name: Start the hono example app | |
working-directory: ./packages/civic-auth/server/hono | |
run: | | |
bun add @hono/node-server | |
yarn dev & npx wait-on http://localhost:3009 | |
timeout-minutes: 1 | |
env: | |
CLIENT_ID: example-repo-client-id | |
OAUTH_SERVER: https://auth-dev.civic.com/oauth | |
- name: Start the wagmi example app | |
uses: JarvusInnovations/background-action@v1.0.7 | |
with: | |
run: yarn dev & | |
working-directory: packages/civic-auth-web3/wagmi | |
wait-on: http://localhost:3010 | |
wait-for: 60s | |
log-output-if: true | |
env: | |
VITE_CLIENT_ID: example-repo-client-id | |
OAUTH_SERVER: https://auth-dev.civic.com/oauth | |
# - name: Set up cypress e2e tests for client-auth lib in example app | |
# uses: ./.github/actions/test-e2e | |
# with: | |
# dummy-oidc-server: http://localhost:9090 | |
# npm-token: ${{ secrets.NPM_TOKEN }} | |
# aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }} | |
# aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }} | |
# github-ssh-key: ${{ secrets.CIVIC_LOG_GITHUB_DEPLOY_KEY }} | |
- name: Run Cypress example app e2e dev tests | |
id: cypress | |
uses: cypress-io/github-action@v6 | |
with: | |
working-directory: packages/e2e | |
command: npx cypress run --env stage=dev --browser chrome --record | |
browser: chrome | |
install: true | |
wait-on: 'http://localhost:3000,http://localhost:3006,http://localhost:3007,http://localhost:3008,http://localhost:3009' | |
wait-on-timeout: 60 | |
record: true | |
env: | |
NEXT_JS_BASE_URL: 'http://localhost:3000' | |
REACT_BASE_URL: 'http://localhost:3006' | |
EXPRESS_BASE_URL: 'http://localhost:3007' | |
FASTIFY_BASE_URL: 'http://localhost:3008' | |
HONO_BASE_URL: 'http://localhost:3009' | |
WAGMI_BASE_URL: 'http://localhost:3010' | |
CYPRESS_TEST_TAG: '@dev' | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
- name: Send Slack Notification on Failure | |
if: failure() | |
uses: slackapi/slack-github-action@v1.27.0 | |
with: | |
payload: | | |
{ | |
"channel": "#build", | |
"text": "<!subteam^S012Q4F3TRB> (THIS IS A TEST. PLEASE IGNORE) Example repo Cypress develop tests failed in civicteam/civic-auth-examples.\n\nThese tests are run after new beta and prod versions of civic/auth and civic/auth-web3, so there may be an issue with the new version(s). Check the recording of the test failure here https://cloud.cypress.io/projects/cmyigw/runs.\n\nAlternatively, see the full GitHub Actions run details here https://github.com/civicteam/civic-auth-examples/actions/runs/12999564832." | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |