diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml new file mode 100644 index 00000000..308fe392 --- /dev/null +++ b/.github/workflows/pr-build.yml @@ -0,0 +1,46 @@ +name: Build and test on PRs + +on: pull_request + +jobs: + test-pr: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Cache Maven dependencies + uses: actions/cache@v2 + env: + cache-name: cache-maven-dep + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Cache node_modules dependencies + uses: actions/cache@v2 + env: + cache-name: cache-node-modules-dep + with: + path: node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-modules- + + - name: Install Maven dependencies (if new ones were added) + run: ./mvnw dependency:go-offline --no-transfer-progress + + - name: Run backend&frontend tests + run: ./mvnw -Pprod clean verify --no-transfer-progress + + - name: Post coverage - Coveralls action + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: target/test-results/lcov.info diff --git a/package.json b/package.json index 71ee26c2..c99b04bc 100644 --- a/package.json +++ b/package.json @@ -176,6 +176,7 @@ "start-tls": "npm run webpack:dev -- --env.tls", "test": "TZ=UTC npm run lint && TZ=UTC jest --coverage --logHeapUsage -w=2 --config src/test/javascript/jest.conf.js", "coveralls": "jest --coverage --logHeapUsage -w=2 --config src/test/javascript/jest.conf.js && cat target/test-results/lcov.info | coveralls", + "coveralls-copy": "cat target/test-results/lcov.info | coveralls", "test:watch": "npm test -- --watch", "webpack:dev": "./env-config.sh && npm run webpack-dev-server -- --config webpack/webpack.dev.js --inline --port=9060 --env.stats=minimal", "webpack:dev-verbose": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --inline --port=9060 --profile --progress --env.stats=normal",