Skip to content

Use fetch tags from latest checkout action #769

Use fetch tags from latest checkout action

Use fetch tags from latest checkout action #769

name: Validate and test
on:
pull_request:
push:
branches: [ main ]
tags-ignore: [ v* ]
concurrency:
# Only run once for latest commit per ref and cancel other (previous) runs.
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
formatting-check:
name: Checks
runs-on: ubuntu-latest
if: github.repository == 'apache/incubator-pekko-http'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Set up Scala on JDK 8
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
- name: Cache Coursier cache
uses: coursier/cache-action@v6
- name: Cache Build Target
uses: actions/cache@v3
with:
path: project/**/target
key: build-target-${{ hashFiles('**/*.sbt', 'project/build.properties', 'project/**/*.scala') }}
- name: Check code is formatted
run: sbt javafmtCheckAll
- name: Check for missing formatting
run: git diff --exit-code --color
#- name: FOSSA policy check
# if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == 'apache/incubator-pekko-http' }}
# run: |-
# curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/spectrometer/master/install.sh | bash
# fossa analyze && fossa test
# env:
# FOSSA_API_KEY: "${{secrets.FOSSA_API_KEY}}"
compile-and-test:
name: Compile and test
runs-on: ubuntu-latest
if: github.repository == 'apache/incubator-pekko-http'
strategy:
fail-fast: false
matrix:
SCALA_VERSION: [2.12, 2.13, 3.3]
JDK: [8, 11]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Set up JDK ${{ matrix.JDK }}
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.JDK }}
- name: Cache Coursier cache
uses: coursier/cache-action@v6
- name: Cache Build Target
uses: actions/cache@v3
with:
path: project/**/target
key: build-target-${{ hashFiles('**/*.sbt', 'project/build.properties', 'project/**/*.scala') }}
- name: Enable jvm-opts
run: cp .jvmopts-ci .jvmopts
- name: Compile everything
run: sbt ++${{ matrix.SCALA_VERSION }} Test/compile
# Quick testing for PR validation
- name: Validate pull request for JDK ${{ matrix.JDK }}, Scala ${{ matrix.SCALA_VERSION }}
if: ${{ github.event_name == 'pull_request' }}
run: sbt -Dpekko.http.parallelExecution=false -Dpekko.test.timefactor=2 ++${{ matrix.SCALA_VERSION }} validatePullRequest
# Full testing for pushes
- name: Run all tests JDK ${{ matrix.JDK }}, Scala ${{ matrix.SCALA_VERSION }}
if: ${{ github.event_name == 'push' }}
run: sbt -Dpekko.http.parallelExecution=false -Dpekko.test.timefactor=2 ++${{ matrix.SCALA_VERSION }} mimaReportBinaryIssues test
- name: Upload test results
uses: actions/upload-artifact@v3 # upload test results
if: success() || failure() # run this step even if previous step failed
with:
name: test-results-${{ matrix.JDK }}-${{ matrix.SCALA_VERSION }}
path: '**/target/test-reports/*.xml'