ci: upgrade github actions (#221) #953
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: Java CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: wagoid/commitlint-github-action@v6 | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: corretto | |
java-version: 8 | |
cache: maven | |
- run: rm -rf /tmp/* | |
continue-on-error: true | |
- name: Build with Maven | |
env: | |
AWS_REGION: us-west-2 | |
run: mvn -ntp -U clean verify | |
- name: Upload Failed Test Report | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: Failed Test Report | |
path: target/surefire-reports | |
- name: Upload Coverage | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: Coverage Report | |
path: target/jacoco-report | |
- name: Upload unit test coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: target/jacoco-report | |
files: jacoco.xml | |
flags: unit | |
- name: Upload integration test coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: target/jacoco-report/jacoco-it | |
files: jacoco.xml | |
flags: integration | |
- name: Convert Jacoco unit test report to Cobertura | |
run: python3 .github/scripts/cover2cover.py target/jacoco-report/jacoco.xml src/main/java > target/jacoco-report/cobertura.xml | |
- name: Convert Jacoco integ test report to Cobertura | |
run: python3 .github/scripts/cover2cover.py target/jacoco-report/jacoco-it/jacoco.xml src/main/java > target/jacoco-report/cobertura-it.xml | |
- name: Save PR number | |
run: | | |
mkdir -p ./pr/jacoco-report | |
echo ${{ github.event.number }} > ./pr/NR | |
echo ${{ github.event.pull_request.head.sha }} > ./pr/SHA | |
cp target/jacoco-report/cobertura.xml ./pr/jacoco-report/cobertura.xml | |
cp target/jacoco-report/cobertura-it.xml ./pr/jacoco-report/cobertura-it.xml | |
if: github.event_name == 'pull_request' | |
- name: Upload files | |
uses: actions/upload-artifact@v2 | |
with: | |
name: pr | |
path: pr/ | |
if: github.event_name == 'pull_request' |