ci: run workflows on Ubuntu 22.04 as 20.04 has been retired #300
This file contains hidden or 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: Unit Tests | |
on: | |
push: | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore | |
paths-ignore: | |
- 'mise.toml' | |
- '.gitignore' | |
- '.github/**' | |
- '!.github/workflows/unit-tests.yml' | |
- 'docs/**' | |
- 'infra/**' | |
- 'src/main/config/*' | |
- 'src/main/scripts/**' | |
- '!src/main/scripts/execute-command.sh' | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions | |
permissions: | |
contents: read # for "git clone" | |
defaults: | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun | |
run: | |
# Enable fail-fast behavior using set -eo pipefail | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference | |
shell: bash | |
jobs: | |
run-jest: | |
name: Unit Tests (Java Script) | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Clone source code | |
uses: actions/[email protected] # https://github.com/actions/checkout | |
with: | |
# Whether to configure the token or SSH key with the local git config. Default: true | |
persist-credentials: false | |
- name: Install JDK | |
uses: actions/[email protected] # https://github.com/actions/setup-java | |
with: | |
distribution: 'adopt' # https://github.com/actions/setup-java#supported-distributions | |
java-version: '8' # https://github.com/actions/setup-java#supported-version-syntax | |
- name: Restore existing cache | |
uses: actions/[email protected] # https://github.com/actions/cache | |
with: | |
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#input-parameters-for-the-cache-action | |
key: maven-repository-${{ hashFiles('pom.xml') }} | |
path: ~/.m2/repository | |
restore-keys: maven-repository- | |
- name: Run Jest | |
run: ./src/main/scripts/execute-command.sh jest | |
run-unit-tests: | |
name: Unit Tests (Java) | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Clone source code | |
uses: actions/[email protected] # https://github.com/actions/checkout | |
with: | |
# Whether to configure the token or SSH key with the local git config. Default: true | |
persist-credentials: false | |
- name: Install JDK | |
uses: actions/[email protected] # https://github.com/actions/setup-java | |
with: | |
distribution: 'adopt' # https://github.com/actions/setup-java#supported-distributions | |
java-version: '8' # https://github.com/actions/setup-java#supported-version-syntax | |
- name: Restore existing cache | |
uses: actions/[email protected] # https://github.com/actions/cache | |
with: | |
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#input-parameters-for-the-cache-action | |
key: maven-repository-${{ hashFiles('pom.xml') }} | |
path: ~/.m2/repository | |
restore-keys: maven-repository- | |
- name: Run unit tests | |
run: ./src/main/scripts/execute-command.sh unit-tests |