Merge pull request #1411 from ral-facilities/renovate/node-20.x #2320
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: CI Build | |
on: | |
pull_request: | |
# By default, the pull_request event type is not triggered when a PR is merged into main or develop | |
push: | |
branches: | |
- main | |
- develop | |
jobs: | |
test: | |
name: Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4 | |
with: | |
node-version: 20 | |
cache: 'yarn' | |
- name: Install dependencies | |
# Ubuntu 16+ does not install libgconf-2-4 by default, so we need to install it ourselves (for Cypress) | |
run: | | |
sudo apt-get install libgconf-2-4 | |
yarn --immutable | |
- name: Run linting | |
run: yarn lint:js | |
- name: Run unit tests | |
run: yarn test | |
- name: Upload unit test coverage | |
if: success() | |
uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
- name: Run e2e tests | |
run: yarn e2e | |
docker: | |
# This job triggers only if all the other jobs succeed. It builds the Docker image and if successful, | |
# it pushes it to Harbor. | |
needs: [test] | |
name: Docker | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Login to Harbor | |
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0 | |
with: | |
registry: ${{ secrets.HARBOR_URL }} | |
username: ${{ secrets.HARBOR_USERNAME }} | |
password: ${{ secrets.HARBOR_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0 | |
with: | |
images: ${{ secrets.HARBOR_URL }}/scigateway | |
- name: Build and push Docker image to Harbor | |
uses: docker/build-push-action@0a97817b6ade9f46837855d676c4cca3a2471fc9 # v4.2.1 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |