Skip to content

Commit

Permalink
Remove parallel testing for now - doesn't work. Restructure workflows…
Browse files Browse the repository at this point in the history
… to share common code.
  • Loading branch information
svogt0511 committed Dec 27, 2023
1 parent 4e78cbe commit f1b80bd
Show file tree
Hide file tree
Showing 10 changed files with 295 additions and 719 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/branch_to_staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Manually Test and Deploy Branch to Vercel
on:
workflow_dispatch:

jobs:
call_build:
name: Build
uses: ./.github/workflows/build.yml
secrets: inherit

ember_test:
name: Ember Testing
needs: call_build
uses: ./.github/workflows/ember_test.yml
secrets: inherit

cypress_test:
name: Cypress Testing
needs: call_build
uses: ./.github/workflows/cypress_test.yml
secrets: inherit

deploy:
needs: [call_build, ember_test, cypress_test]
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Extract variables
shell: bash
run: |
echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_OUTPUT
echo "GIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "GIT_SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
id: extract_variables

- name: Vercel deploy staging
uses: amondnet/[email protected]
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.ORG_ID}}
vercel-project-id: ${{ secrets.PROJECT_ID}}
vercel-args: ${{ vars.VERCEL_NOCACHE == 'true' && '--force' || '' }}
scope: ${{ secrets.TEAM_ID}}
vercel-project-name: 'bracco'
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build
on:
workflow_call:
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: cypress-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
node_modules
~/.cache/Cypress
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

- name: Get branch name
run: |
echo "### CURRENT BRANCH NAME: ${{ github.ref_name }}."
- name: Build
env:
NODE_OPTIONS: "--openssl-legacy-provider"
run: |
yarn --prefer-offline
./node_modules/.bin/ember build --output-path="test_build" --environment=development
- name: Upload Test Build artifact
uses: actions/upload-artifact@v3
with:
name: test_build
path: test_build/
82 changes: 82 additions & 0 deletions .github/workflows/cypress_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Cypress Tests
on:
workflow_call:
jobs:
cypress-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
# matrix:
# containers: [1, 2, 3, 4, 5]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: cypress-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
node_modules
~/.cache/Cypress
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

- name: Download Test Build artifact
uses: actions/download-artifact@v3
with:
name: test_build
path: test_build/

- name: Cypress Testing
uses: cypress-io/github-action@v5
with:
config-file: cypress.config.ts
install: false
config: defaultCommandTimeout=15000
start: yarn start --path=test_build
wait-on: 'https://localhost:4200'
wait-on-timeout: 600
quiet: false
# record: true
# parallel: true
spec: |
cypress/e2e/client_admin/doi.test.ts
cypress/e2e/client_admin/info.test.ts
cypress/e2e/client_admin/prefixes.test.ts
cypress/e2e/client_admin/settings.test.ts
cypress/e2e/consortium_admin/contact.test.ts
cypress/e2e/consortium_admin/info.test.ts
cypress/e2e/consortium_admin/settings.test.ts
cypress/e2e/organization_admin/contact.test.ts
cypress/e2e/organization_admin/doi.test.ts
cypress/e2e/organization_admin/info.test.ts
cypress/e2e/organization_admin/prefixes.test.ts
cypress/e2e/organization_admin/repositories.test.ts
cypress/e2e/organization_admin/settings.test.ts
cypress/e2e/staff_admin/contact.test.ts
cypress/e2e/staff_admin/info.test.ts
cypress/e2e/staff_admin/settings.test.ts
cypress/e2e/ui/consent.test.ts
cypress/e2e/ui/login.test.ts
cypress/e2e/anonymous/admin.test.ts
cypress/e2e/anonymous/anonymous.test.ts
cypress/e2e/anonymous/doi.test.ts
cypress/e2e/anonymous/provider.test.ts
cypress/e2e/anonymous/repository.test.ts
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CLIENT_ADMIN_USERNAME: ${{ secrets.CLIENT_ADMIN_USERNAME }}
CLIENT_ADMIN_PASSWORD: ${{ secrets.CLIENT_ADMIN_PASSWORD }}
CONSORTIUM_ADMIN_USERNAME: ${{ secrets.CONSORTIUM_ADMIN_USERNAME }}
CONSORTIUM_ADMIN_PASSWORD: ${{ secrets.CONSORTIUM_ADMIN_PASSWORD }}
ORGANIZATION_ADMIN_USERNAME: ${{ secrets.ORGANIZATION_ADMIN_USERNAME }}
ORGANIZATION_ADMIN_PASSWORD: ${{ secrets.ORGANIZATION_ADMIN_PASSWORD }}
STAFF_ADMIN_USERNAME: ${{ secrets.STAFF_ADMIN_USERNAME }}
STAFF_ADMIN_PASSWORD: ${{ secrets.STAFF_ADMIN_PASSWORD }}
167 changes: 11 additions & 156 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,172 +3,27 @@ on:
push:
branches:
- "main"

jobs:
build:
call_build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: cypress-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
node_modules
~/.cache/Cypress
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

- name: Build
env:
NODE_OPTIONS: "--openssl-legacy-provider"
run: |
yarn --frozen-lockfile --prefer-offline
./node_modules/.bin/ember build --output-path="test_build" --environment=development
- name: Upload Test Build artifact
uses: actions/upload-artifact@v3
with:
name: test_build
path: test_build/
uses: ./.github/workflows/build.yml
secrets: inherit

ember_test:
name: Ember Testing
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: cypress-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
node_modules
~/.cache/Cypress
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

- name: Download Test Build artifact
uses: actions/download-artifact@v3
with:
name: test_build
path: test_build/

- name: Ember Testing
env:
COVERAGE: true
run: |
yarn run ember test --path=test_build
# - name: Publish code coverage
# uses: paambaati/[email protected]
# env:
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}


needs: call_build
uses: ./.github/workflows/ember_test.yml
secrets: inherit

cypress_test:
name: Cypress Testing
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: cypress-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
node_modules
~/.cache/Cypress
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

- name: Download Test Build artifact
uses: actions/download-artifact@v3
with:
name: test_build
path: test_build/

- name: Cypress Testing
uses: cypress-io/github-action@v5
with:
config-file: cypress.config.ts
install: false
config: defaultCommandTimeout=15000
start: yarn start --path=test_build
wait-on: 'https://localhost:4200'
wait-on-timeout: 600
quiet: true
record: true
parallel: true
group: 'Tests'
spec: |
cypress/e2e/client_admin/doi.test.ts
cypress/e2e/client_admin/info.test.ts
cypress/e2e/client_admin/prefixes.test.ts
cypress/e2e/client_admin/settings.test.ts
cypress/e2e/consortium_admin/contacts.test.ts
cypress/e2e/consortium_admin/info.test.ts
cypress/e2e/consortium_admin/settings.test.ts
cypress/e2e/organization_admin/contacts.test.ts
cypress/e2e/organization_admin/doi.test.ts
cypress/e2e/organization_admin/info.test.ts
cypress/e2e/organization_admin/prefixes.test.ts
cypress/e2e/organization_admin/repositories.test.ts
cypress/e2e/organization_admin/settings.test.ts
cypress/e2e/staff_admin/contacts.test.ts
cypress/e2e/staff_admin/info.test.ts
cypress/e2e/staff_admin/settings.test.ts
cypress/e2e/ui/consent.test.ts
cypress/e2e/ui/login.test.ts
cypress/e2e/anonymous/admin.test.ts
cypress/e2e/anonymous/anonymous.test.ts
cypress/e2e/anonymous/doi.test.ts
cypress/e2e/anonymous/provider.test.ts
cypress/e2e/anonymous/repository.test.ts
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CLIENT_ADMIN_USERNAME: ${{ secrets.CLIENT_ADMIN_USERNAME }}
CLIENT_ADMIN_PASSWORD: ${{ secrets.CLIENT_ADMIN_PASSWORD }}
CONSORTIUM_ADMIN_USERNAME: ${{ secrets.CONSORTIUM_ADMIN_USERNAME }}
CONSORTIUM_ADMIN_PASSWORD: ${{ secrets.CONSORTIUM_ADMIN_PASSWORD }}
ORGANIZATION_ADMIN_USERNAME: ${{ secrets.ORGANIZATION_ADMIN_USERNAME }}
ORGANIZATION_ADMIN_PASSWORD: ${{ secrets.ORGANIZATION_ADMIN_PASSWORD }}
STAFF_ADMIN_USERNAME: ${{ secrets.STAFF_ADMIN_USERNAME }}
STAFF_ADMIN_PASSWORD: ${{ secrets.STAFF_ADMIN_PASSWORD }}
needs: call_build
uses: ./.github/workflows/cypress_test.yml
secrets: inherit

deploy:
needs: [ember_test, cypress_test]
needs: [call_build, ember_test, cypress_test]
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Expand Down
Loading

0 comments on commit f1b80bd

Please sign in to comment.