Merge pull request #227 from kevin-lee/update-config #488
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: Build All | |
on: | |
push: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
scala: | |
- { name: "Scala 2", version: "2.12.18", binary-version: "2.12", java-version: "adopt@1.11", params: "" } | |
- { name: "Scala 2", version: "2.13.12", binary-version: "2.13", java-version: "adopt@1.11", params: "" } | |
- { name: "Scala 3.1", version: "3.3.1", binary-version: "3", java-version: "adopt@1.11", params: '' } | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: olafurpg/setup-scala@v14 | |
with: | |
java-version: ${{ matrix.scala.java-version }} | |
- name: Cache SBT | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.ivy2/cache | |
~/.cache/coursier | |
~/.sbt | |
key: ${{ runner.os }}-sbt-${{ matrix.scala.binary-version }}-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }} | |
restore-keys: | | |
${{ runner.os }}-sbt-${{ matrix.scala.binary-version }} | |
- name: "[Push] Build All for Scala ${{ matrix.scala.version }}" | |
if: github.event_name == 'push' | |
env: | |
CURRENT_BRANCH_NAME: ${{ github.ref }} | |
run: | | |
echo "[BEFORE]CURRENT_BRANCH_NAME=${CURRENT_BRANCH_NAME}" | |
export CURRENT_BRANCH_NAME="${CURRENT_BRANCH_NAME#refs/heads/}" | |
echo " [AFTER]CURRENT_BRANCH_NAME=${CURRENT_BRANCH_NAME}" | |
java -version | |
.github/workflows/sbt-build-all.sh ${{ matrix.scala.version }} "${{ matrix.scala.params }}" | |
- name: "[PR] Build All for Scala ${{ matrix.scala.version }}" | |
if: github.event_name == 'pull_request' | |
env: | |
CURRENT_BRANCH_NAME: ${{ github.base_ref }} | |
run: | | |
echo "Rull request to the '${CURRENT_BRANCH_NAME}' branch" | |
java -version | |
.github/workflows/sbt-build-all.sh ${{ matrix.scala.version }} "${{ matrix.scala.params }}" | |
scalafix: | |
runs-on: ubuntu-latest | |
env: | |
GH_JAVA_VERSION: "adopt@1.11" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: olafurpg/setup-scala@v14 | |
with: | |
java-version: ${{ env.GH_JAVA_VERSION }} | |
- name: Cache SBT | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.ivy2/cache | |
~/.cache/coursier | |
~/.sbt | |
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }} | |
restore-keys: | | |
${{ runner.os }}-sbt | |
- name: "sbt +scalafix" | |
run: | | |
sbt \ | |
-J-XX:MaxMetaspaceSize=1024m \ | |
-J-Xmx2048m \ | |
clean \ | |
+scalafixAll | |
build_with_test_coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache Coursier | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/coursier | |
key: ${{ runner.os }}-coursier-scala-2_13-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }} | |
restore-keys: | | |
${{ runner.os }}-coursier-scala-2_13- | |
- name: Cache Ivy | |
uses: actions/cache@v4 | |
with: | |
path: ~/.ivy2/cache | |
key: ${{ runner.os }}-ivy-scala-2_13-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }} | |
restore-keys: | | |
${{ runner.os }}-ivy-scala-2_13- | |
- name: "[Push] Build with Test Coverage - ${{ github.run_number }}" | |
if: github.event_name == 'push' | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
CURRENT_BRANCH_NAME: ${{ github.ref }} | |
RUN_ID: ${{ github.run_id }} | |
RUN_NUMBER: ${{ github.run_number }} | |
run: | | |
echo "[BEFORE]CURRENT_BRANCH_NAME=${CURRENT_BRANCH_NAME}" | |
export CURRENT_BRANCH_NAME="${CURRENT_BRANCH_NAME#refs/heads/}" | |
echo " [AFTER]CURRENT_BRANCH_NAME=${CURRENT_BRANCH_NAME}" | |
echo "RUN_ID=${RUN_ID}" | |
echo "RUN_NUMBER=${RUN_NUMBER}" | |
export CI_BRANCH=$CURRENT_BRANCH_NAME | |
.github/workflows/sbt-build-all-with-coverage.sh 2.13.12 | |
- name: "[PR] Build with Test Coverage - PR-#${{ github.event.pull_request.number }} - ${{ github.run_number }}" | |
if: github.event_name == 'pull_request' | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
CURRENT_BRANCH_NAME: ${{ github.base_ref }} | |
RUN_ID: ${{ github.run_id }} | |
RUN_NUMBER: ${{ github.run_number }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
run: | | |
export CI_BRANCH="PR-$CURRENT_BRANCH_NAME" | |
echo "RUN_ID=${RUN_ID}" | |
echo "RUN_NUMBER=${RUN_NUMBER}" | |
echo "PR #${PR_NUMBER}" | |
echo "Rull request to the '${CURRENT_BRANCH_NAME}' branch" | |
.github/workflows/sbt-build-all-with-coverage.sh 2.13.12 | |
- if: github.event_name == 'pull_request' | |
uses: codecov/codecov-action@v4 |