Skip to content

Run js tests on Windows CI #831

Run js tests on Windows CI

Run js tests on Windows CI #831

Workflow file for this run

name: CI
on:
push:
paths-ignore:
- "*.md"
branches: [main]
tags:
- "*"
pull_request:
branches: [main]
env:
NODE_OPTIONS: "--max_old_space_size=4096"
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
# cache: 'npm'
# cache-dependency-path: '**/package-lock.json'
- name: Setup JDK 8
uses: actions/setup-java@v4
with:
java-version: "8"
distribution: "adopt"
cache: "sbt"
- name: Setup Sbt
uses: sbt/setup-sbt@v1
- name: Cache node_modules
uses: actions/cache@v4
with:
path: |
~/.npm
~/.nvm
~/work/farjs/farjs/node_modules
~/work/farjs/farjs/package-lock.json
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles('package.json') }}
restore-keys: |
${{ runner.os }}-node_modules-cache-v2-
- name: Extract Tag Name
run: echo "TAG_NAME=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
if: ${{ startsWith(github.ref, 'refs/tags') }}
- name: Run js tests
run: |
npm i
npx tsc
npx quick-lint-js ./**/*.mjs
npm run formatCheck
npm run sql-bundle
NODE_V8_COVERAGE=coverage0 npx c8 -r lcovonly --all --exclude "dist/**" --exclude "test/**" node --experimental-test-coverage ./test/all.mjs
if: ${{ env.TAG_NAME == '' }}
- name: Report js coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
parallel: true
flag-name: js
if: ${{ env.TAG_NAME == '' }}
- name: Run scala tests
run: sbt coverage test coverageReport
if: ${{ env.TAG_NAME == '' }}
- name: Report scala coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
parallel: true
flag-name: scala
files: ./app/target/scala-2.13/coverage-report/cobertura.xml
./archiver/target/scala-2.13/coverage-report/cobertura.xml
./copymove/target/scala-2.13/coverage-report/cobertura.xml
./filelist/target/scala-2.13/coverage-report/cobertura.xml
./fs/target/scala-2.13/coverage-report/cobertura.xml
format: cobertura
if: ${{ env.TAG_NAME == '' }}
- name: Close parallel build in Coveralls
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
if: ${{ env.TAG_NAME == '' }}
- name: Build SNAPSHOT artifact
run: |
sbt clean "project farjs-app" fullOptJS
npm pack
if: ${{ env.TAG_NAME == '' }}
- name: Upload SNAPSHOT artifact
uses: actions/upload-artifact@v4
with:
name: farjs-app-0.1.0-SNAPSHOT.tgz
path: farjs-app-0.1.0-SNAPSHOT.tgz
if: ${{ env.TAG_NAME == '' }}
- name: Publish RELEASE
run: |
VERSION="$(echo "$TAG_NAME" | cut -d'v' -f 2)"
echo "Publish a release version=$VERSION for tag $TAG_NAME"
sbt clean "project farjs-app" fullOptJS
npm --no-git-tag-version --allow-same-version version $VERSION
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
npm publish
if: ${{ env.TAG_NAME != '' }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}