Skip to content

Firefly-2110 ESLint identified error fixes #59

Firefly-2110 ESLint identified error fixes

Firefly-2110 ESLint identified error fixes #59

Workflow file for this run

name: Tests
on:
pull_request:
branches: [dev]
permissions:
contents: read
concurrency:
group: tests-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
test:
name: unit tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
# compose.yml's build context is the checkout's parent, so the checkout
# has to live in a directory named `firefly`, same as build_publish.yml.
- uses: actions/checkout@v5
with:
path: firefly
- uses: docker/setup-buildx-action@v3
# buildx so the layers land in the Actions cache
- name: Build test image
uses: docker/build-push-action@v6
with:
context: .
file: firefly/docker/Dockerfile
target: base
tags: ipac/firefly-test-js:latest
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: JavaScript tests (jest)
id: js-tests
working-directory: firefly
run: docker compose run --rm test-js
- name: Upload reports
if: '!cancelled()'
uses: actions/upload-artifact@v7
with:
name: test-reports
path: firefly/build/dist/reports/firefly/
if-no-files-found: warn
retention-days: 14
- name: Summarize
if: '!cancelled()'
env:
COVERAGE: firefly/build/dist/reports/firefly/coverage-summary.json
run: |
{
echo "## Test results"
echo
echo "| suite | result |"
echo "| --- | --- |"
echo "| JavaScript (jest) | ${{ steps.js-tests.outcome }} |"
# Written by the json-summary reporter in __jest__/jest.base.config.js.
# Absent when the test step dies before jest writes its report.
if [ -f "$COVERAGE" ]; then
echo
echo "### Coverage"
echo
echo "| metric | covered | percent |"
echo "| --- | --- | --- |"
jq -r '.total as $t
| ["statements","branches","functions","lines"][]
| "| \(.) | \($t[.].covered)/\($t[.].total) | \($t[.].pct)% |"' "$COVERAGE"
else
echo
echo "_No coverage report was produced._"
fi
} >> "$GITHUB_STEP_SUMMARY"
eslint:
name: eslint
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
with:
path: firefly
- uses: docker/setup-buildx-action@v3
- name: Build test image
uses: docker/build-push-action@v6
with:
context: .
file: firefly/docker/Dockerfile
target: base
tags: ipac/firefly-test-js:latest
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: ESLint
working-directory: firefly
run: docker compose run --rm lint-js