diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f5f56584f..3894b445ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ on: [push, pull_request] # branches: main jobs: - build: + tests: runs-on: ubuntu-latest env: # The ci step will test the dspace-angular code against DSpace REST. @@ -31,16 +31,19 @@ jobs: # https://github.com/actions/checkout - name: Checkout codebase uses: actions/checkout@v1 + # https://github.com/actions/setup-node - name: Install Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} + - name: Install latest Chrome (for e2e tests) run: | sudo apt-get update sudo apt-get --only-upgrade install google-chrome-stable -y google-chrome --version + # https://github.com/actions/cache/blob/main/examples.md#node---yarn - name: Get Yarn cache directory id: yarn-cache-dir-path @@ -53,14 +56,19 @@ jobs: # Cache key is hash of yarn.lock. Therefore changes to yarn.lock will invalidate cache key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: ${{ runner.os }}-yarn- + - name: Install Yarn dependencies run: yarn install --frozen-lockfile + - name: Run lint run: yarn run lint + - name: Run build run: yarn run build:prod + - name: Run specs (unit tests) run: yarn run test:headless + # Using docker-compose start backend using CI configuration # and load assetstore from a cached copy - name: Start DSpace REST Backend via Docker (for e2e tests) @@ -68,10 +76,13 @@ jobs: docker-compose -f ./docker/docker-compose-ci.yml up -d docker-compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli docker container ls + - name: Run e2e tests (integration tests) run: yarn run e2e:ci + - name: Shutdown Docker containers run: docker-compose -f ./docker/docker-compose-ci.yml down + # NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286 # Upload coverage reports to Codecov (for Node v12 only) # https://github.com/codecov/codecov-action