diff --git a/.github/actions/shared-job-steps/action.yml b/.github/actions/shared-job-steps/action.yml index 492ca53c48..68ba4b69d4 100644 --- a/.github/actions/shared-job-steps/action.yml +++ b/.github/actions/shared-job-steps/action.yml @@ -35,4 +35,4 @@ runs: npm ci env: CI: true - NODE_ENV: test + NODE_ENV: ${{ inputs.node-env }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b8ba024285..4e02199991 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: with: fetch-depth: 1 - - name: Setup Job + - name: Setup Shared Job Steps uses: './.github/actions/shared-job-steps' with: node-version: ${{ matrix.node-version }} @@ -33,7 +33,7 @@ jobs: with: fetch-depth: 1 - - name: Setup Job + - name: Setup Shared Job Steps uses: './.github/actions/shared-job-steps' with: node-version: ${{ matrix.node-version }} @@ -49,24 +49,13 @@ jobs: - uses: actions/checkout@v1 with: fetch-depth: 1 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + + - name: Setup Shared Job Steps + uses: './.github/actions/shared-job-steps' with: node-version: ${{ matrix.node-version }} - - name: Cache multiple paths - id: cache-package - uses: actions/cache@v2 - with: - path: | - **/node_modules - key: ${{ runner.os }}-${{ hashFiles('**/package.json') }} - - run: cp config.json.example config.json - - name: npm install - run: | - npm ci - env: - CI: true - NODE_ENV: test + node-env: 'test' + - run: npm run test:sanity common: @@ -78,17 +67,13 @@ jobs: - uses: actions/checkout@v1 with: fetch-depth: 1 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + + - name: Setup Shared Job Steps + uses: './.github/actions/shared-job-steps' with: node-version: ${{ matrix.node-version }} - - run: cp config.json.example config.json - - name: npm install - run: | - npm ci - env: - CI: true - NODE_ENV: test + node-env: 'test' + - run: npm run test:common content: runs-on: ubuntu-latest @@ -99,17 +84,13 @@ jobs: - uses: actions/checkout@v1 with: fetch-depth: 1 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + + - name: Setup Shared Job Steps + uses: './.github/actions/shared-job-steps' with: node-version: ${{ matrix.node-version }} - - run: cp config.json.example config.json - - name: npm install - run: | - npm ci - env: - CI: true - NODE_ENV: test + node-env: 'test' + - run: npm run test:content api-unit: @@ -122,22 +103,19 @@ jobs: - uses: actions/checkout@v1 with: fetch-depth: 1 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + + - name: Setup Shared Job Steps + uses: './.github/actions/shared-job-steps' with: node-version: ${{ matrix.node-version }} + node-env: 'test' + - name: Start MongoDB ${{ matrix.mongodb-version }} Replica Set uses: supercharge/mongodb-github-action@1.3.0 with: mongodb-version: ${{ matrix.mongodb-version }} mongodb-replica-set: rs - - run: cp config.json.example config.json - - name: npm install - run: | - npm ci - env: - CI: true - NODE_ENV: test + - run: npm run test:api:unit env: REQUIRES_SERVER=true: true @@ -151,22 +129,19 @@ jobs: - uses: actions/checkout@v1 with: fetch-depth: 1 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + + - name: Setup Shared Job Steps + uses: './.github/actions/shared-job-steps' with: node-version: ${{ matrix.node-version }} + node-env: 'test' + - name: Start MongoDB ${{ matrix.mongodb-version }} Replica Set uses: supercharge/mongodb-github-action@1.3.0 with: mongodb-version: ${{ matrix.mongodb-version }} mongodb-replica-set: rs - - run: cp config.json.example config.json - - name: npm install - run: | - npm ci - env: - CI: true - NODE_ENV: test + - run: npm run test:api-v3:integration env: REQUIRES_SERVER=true: true @@ -180,22 +155,19 @@ jobs: - uses: actions/checkout@v1 with: fetch-depth: 1 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + + - name: Setup Shared Job Steps + uses: './.github/actions/shared-job-steps' with: node-version: ${{ matrix.node-version }} + node-env: 'test' + - name: Start MongoDB ${{ matrix.mongodb-version }} Replica Set uses: supercharge/mongodb-github-action@1.3.0 with: mongodb-version: ${{ matrix.mongodb-version }} mongodb-replica-set: rs - - run: cp config.json.example config.json - - name: npm install - run: | - npm ci - env: - CI: true - NODE_ENV: test + - run: npm run test:api-v4:integration env: REQUIRES_SERVER=true: true @@ -209,17 +181,13 @@ jobs: - uses: actions/checkout@v1 with: fetch-depth: 1 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + + - name: Setup Shared Job Steps + uses: './.github/actions/shared-job-steps' with: node-version: ${{ matrix.node-version }} - - run: cp config.json.example config.json - - name: npm install - run: | - npm ci - env: - CI: true - NODE_ENV: test + node-env: 'test' + - run: npm run test:unit working-directory: ./website/client @@ -232,14 +200,9 @@ jobs: - uses: actions/checkout@v1 with: fetch-depth: 1 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + + - name: Setup Shared Job Steps + uses: './.github/actions/shared-job-steps' with: node-version: ${{ matrix.node-version }} - - run: cp config.json.example config.json - - name: npm install - run: | - npm install - env: - CI: true - NODE_ENV: production + node-env: 'production'