Update rest of dependencies to ensure compatibility with recent deps … #210
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 | |
# TODO Looks like workflows ARE reusable now: https://docs.github.com/en/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow | |
# Controls when the action will run. | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# Specify defaults for all jobs' `run` blocks. | |
# See: | |
# https://github.community/t/use-working-directory-for-entire-job/16747/9 | |
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_iddefaultsrun | |
# https://github.community/t/github-actions-configure-defaults-option/18438/3 | |
defaults: | |
run: | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
gitUserName: ${{ github.actor }} | |
gitUserEmail: ${{ github.actor }}@users.noreply.github.com | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# Job 1. Handles everything related to the client/ folder | |
ci-build-and-upload-artifacts: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Specify defaults for all runs/steps. | |
defaults: | |
run: | |
# Specify directory in which to run all subsequent steps/commands | |
# | |
# If using a monolith with `./client/` and `./server/` directories: | |
# working-directory: ./client | |
working-directory: ./ | |
# outputs: | |
# ci-build-output: | |
# description: "CI - Cache build output" | |
# # value: | |
# 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 repository branch | |
uses: actions/checkout@v3 | |
- name: Set NodeJS version | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Client CI - Download cache | |
uses: actions/cache/restore@v3 | |
env: | |
cache-name: ci-cache | |
with: | |
path: | | |
node_modules | |
dist | |
package.json | |
package-lock.json | |
key: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles('package.json', './src/**', './test/**', './tests/**', './config/**', './mocks/**') }} | |
# Ensure old cache is deleted so that the build step's cache request isn't ignored | |
# | |
# See: | |
# - https://stackoverflow.com/questions/63521430/clear-cache-in-github-actions/64819132#64819132 | |
- name: Client CI - Clear caches | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
WORKFLOW_RUN_ID: ${{ github.run_id }} | |
CACHE_NAME: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles('package.json', './src/**', './test/**', './tests/**', './config/**', './mocks/**') }} | |
run: | | |
CACHES_API_URL="https://api.github.com/repos/$(gh repo view --json owner --jq '.owner.login')/$(gh repo view --json name --jq '.name')/actions/caches" | |
cacheIds=($(gh api "${CACHES_API_URL}" --jq ".actions_caches[] | select(.key | contains(\"${{ env.CACHE_NAME }}\")) | .id")) | |
echo "Deleting cache IDs: ${cacheIds[@]}..." | |
( for cacheId in ${cacheIds[@]}; do gh api --method DELETE "${CACHES_API_URL}/$cacheId"; done; ) | |
- name: Client Verify | |
# Import reusable GitHub Action logic via `uses` | |
uses: ./.github/workflows/actions/client | |
- name: Client cache build and install artifacts | |
id: ci-cache | |
uses: actions/cache/save@v3 | |
env: | |
cache-name: ci-cache | |
with: | |
path: | | |
node_modules | |
dist | |
package.json | |
package-lock.json | |
key: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles('package.json', './src/**', './test/**', './tests/**', './config/**', './mocks/**') }} | |
# restore-keys: | | |
# ${{ env.cache-name }}-${{ runner.os }}- | |
# ${{ env.cache-name }}- |