Update dependency marked to v15 (main) #5490
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: Tests | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'src/**' | |
- 'yarn.lock' | |
- '.github/workflows/unit-tests.yml' | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths: | |
- 'src/**' | |
- 'yarn.lock' | |
- '.github/workflows/unit-tests.yml' | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
name: Type-checks, eslint, unit tests and SonarCloud | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
path: app-frontend | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Get yarn cache directory path | |
working-directory: app-frontend | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | |
- uses: actions/cache@v4 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: install dependencies | |
working-directory: app-frontend | |
run: yarn --immutable | |
- name: type-check | |
working-directory: app-frontend | |
run: yarn tsc | |
- name: run eslint | |
working-directory: app-frontend | |
run: yarn lint | |
- name: run tests | |
working-directory: app-frontend | |
run: yarn test --coverage --runInBand | |
- name: SonarCloud Scan | |
if: | | |
github.repository_owner == 'Altinn' && | |
(github.event_name != 'pull_request' && github.event.repository.fork == false) || | |
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) | |
with: | |
projectBaseDir: app-frontend | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |