Unit Tests #1798
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: Unit Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- release-* | |
tags-ignore: [ v.* ] | |
schedule: | |
- cron: '0 2 * * *' # every day 2am | |
permissions: | |
contents: read | |
jobs: | |
test: | |
name: Build and Test | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { jdkVersion: "1.11.0", jvmName: "temurin:1.11.0", extraOpts: '-J-XX:+UnlockExperimentalVMOptions -J-XX:+UseJVMCICompiler' } | |
- { jdkVersion: "1.17.0", jvmName: "temurin:1.17.0", extraOpts: '' } | |
- { jdkVersion: "1.21.0", jvmName: "temurin:1.21", extraOpts: '' } | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: Checkout GitHub merge | |
if: github.event.pull_request | |
run: |- | |
git fetch origin pull/${{ github.event.pull_request.number }}/merge:scratch | |
git checkout scratch | |
- name: Cache Coursier cache | |
uses: coursier/[email protected] | |
- name: Set up JDK ${{ matrix.jdkVersion }} | |
uses: coursier/[email protected] | |
with: | |
jvm: ${{ matrix.jvmName }} | |
# FIXME default index not giving us access to JDK 21 (yet) | |
jvm-index: https://raw.githubusercontent.com/coursier/jvm-index/32d659500e6c65efb9eee91718a0fb0e797ad4ee/index.json | |
# hack to solve "Cannot assign requested address" issue - https://github.community/t/github-action-and-oserror-errno-99-cannot-assign-requested-address/173973/1 | |
- name: Add the current IP address, long hostname and short hostname record to /etc/hosts file | |
run: | | |
echo -e "$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)\t$(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts | |
- name: Run tests with default Scala and Java ${{ matrix.jdkVersion }} | |
run: sbt "test" ${{ matrix.extraOpts }} | |
- name: Print logs on failure | |
if: ${{ failure() }} | |
run: find . -name "*.log" -exec ./scripts/cat-log.sh {} \; |