This repository has been archived by the owner on May 1, 2024. It is now read-only.
Bump docker/login-action from 2 to 3 #8
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
# Continuous Integration tests for NUsight | |
name: NUsight CI | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [main] | |
pull_request: | |
# Trigger for merge queue | |
merge_group: | |
types: [checks_requested] | |
# Ensure that only one instance of the workflow is run at a time for each branch/tag. | |
# Jobs currently running on the branch/tag will be cancelled when new commits are pushed. | |
# See https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#concurrency. | |
concurrency: | |
# `github.workflow` is the workflow name, `github.ref` is the current branch/tag identifier | |
group: ${{ format('{0}:{1}', github.workflow, github.ref) }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
# Set the yarn cache folder to a writable folder | |
env: | |
HOME: ${{ github.workspace }} | |
YARN_CACHE_FOLDER: ${{ github.workspace }}/.yarn | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# Detects changes to NUsight related files, for conditionally running other jobs | |
check_for_changes: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-20.04 | |
# Output the detected changes for conditionally running other jobs | |
outputs: | |
has_workflow_changes: ${{ steps.filter.outputs.workflow_changes }} | |
has_nusight_changes: ${{ steps.filter.outputs.nusight_changes }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Check for NUsight Changes | |
uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
workflow_changes: | |
- '.github/workflows/nusight.yaml' | |
nusight_changes: | |
- 'nusight2/**' | |
- 'shared/message/**/*.proto' | |
- 'nuclear/message/proto/**/*.proto' | |
# Build the NUsight code | |
build-nusight: | |
name: Build NUsight | |
needs: check_for_changes | |
# Run only if the workflow or NUsight related files have changed | |
if: > | |
needs.check_for_changes.outputs.has_workflow_changes == 'true' || | |
needs.check_for_changes.outputs.has_nusight_changes == 'true' | |
# The type of runner that the job will run on | |
runs-on: ubuntu-20.04 | |
# Run on the Node 14 (LTS) container | |
container: | |
image: node:lts-fermium | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# Get our yarn cache if it exists | |
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
# Check if the yarn cache directory is valid | |
- uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
# Check dependencies from cache and install any which weren't cached or were corrupted | |
- name: Install Dependencies | |
working-directory: nusight2 | |
run: yarn --prefer-offline | |
- name: Build NUsight | |
working-directory: nusight2 | |
run: yarn build:ci | |
# Build the NUsight Storybook code | |
build-nusight-storybook: | |
name: Build NUsight Storybook | |
needs: check_for_changes | |
# Run only if the workflow or NUsight related files have changed | |
if: > | |
needs.check_for_changes.outputs.has_workflow_changes == 'true' || | |
needs.check_for_changes.outputs.has_nusight_changes == 'true' | |
# The type of runner that the job will run on | |
runs-on: ubuntu-20.04 | |
# Run on the Node 14 (LTS) container | |
container: | |
image: node:lts-fermium | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# Get our yarn cache if it exists | |
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
# Check if the yarn cache directory is valid | |
- uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
# Check dependencies from cache and install any which weren't cached or were corrupted | |
- name: Install Dependencies | |
working-directory: nusight2 | |
run: yarn --prefer-offline | |
- name: Build NUsight | |
working-directory: nusight2 | |
run: yarn storybook:build | |
# Test the NUsight code | |
test-nusight: | |
name: Test NUsight | |
needs: check_for_changes | |
# Run only if the workflow or NUsight related files have changed | |
if: > | |
needs.check_for_changes.outputs.has_workflow_changes == 'true' || | |
needs.check_for_changes.outputs.has_nusight_changes == 'true' | |
# The type of runner that the job will run on | |
runs-on: ubuntu-20.04 | |
# Run on the Node 14 (LTS) container | |
container: | |
image: node:lts-fermium | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# Get our yarn cache if it exists | |
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
# Check if the yarn cache directory is valid | |
- uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
# Check dependencies from cache and install any which weren't cached or were corrupted | |
- name: Install Dependencies | |
working-directory: nusight2 | |
run: yarn --prefer-offline | |
- name: Build NUsight | |
working-directory: nusight2 | |
run: yarn test:ci |