diff --git a/.github/workflows/e2e.yml b/.github/workflows/ci.yml similarity index 95% rename from .github/workflows/e2e.yml rename to .github/workflows/ci.yml index e5bebde0..bf85cac5 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,21 @@ -name: Build Data Image and Run End-to-end Tests +name: Build and run unit tests, build data image and run e2e tests on: push jobs: + build-and-run-unit-tests: + timeout-minutes: 60 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 16 + cache: 'npm' + - run: npm ci + - run: APP_ENV=develop npm run ci:build:develop + - run: npm test + check-for-image: # Run in Sage repo on develop or main branches # and on all branches in user-owned forks @@ -184,9 +197,10 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 16 + cache: 'npm' - name: install dependencies - run: npm install + run: npm ci - name: install Playwright Browsers run: npx playwright install --with-deps diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index d8172629..00000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,55 +0,0 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - -name: Node.js CI - -on: - push: - branches: [ develop, main ] - pull_request: - branches: [ develop, main ] - -jobs: - build: - timeout-minutes: 60 - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [16.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - # Allow OIDC Integration (so we can assume the AWS role to deploy) - # permissions: - # id-token: write - # contents: read - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm ci - - run: APP_ENV=develop npm run ci:build:develop - # Background dev server - # - run: npm run dev & - - run: npm test - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v4 - # with: - # aws-region: "us-east-1" - # role-to-assume: "arn:aws:iam::607346494281:role/sagebase-github-oidc-agora-eb-deploy" - # role-session-name: GitHubActions-${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }} - # role-duration-seconds: 1200 - # - name: Install Playwright Browsers - # run: npx playwright install --with-deps - # - name: Run Playwright tests - # run: npx playwright test - # - uses: actions/upload-artifact@v3 - # if: always() - # with: - # name: playwright-report - # path: playwright-report/ - # retention-days: 30