fix: sanitize environment variables for PR SHA and number (#31) #90
This file contains hidden or 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: CI with Maven | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: '*' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: wagoid/commitlint-github-action@v6 | |
if: matrix.os == 'ubuntu-latest' | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: corretto | |
java-version: 8 | |
cache: maven | |
- name: Build with Maven (Windows) | |
run: mvn -U -ntp clean verify | |
shell: cmd | |
if: matrix.os == 'windows-latest' | |
- name: Build with Maven (not Windows) | |
run: mvn -U -ntp clean verify | |
if: matrix.os != 'windows-latest' | |
- name: Convert Jacoco to Cobertura | |
run: | | |
python3 ./.github/scripts/cover2cover.py target/jacoco-report/jacoco.xml src/main/java > target/jacoco-report/cobertura.xml | |
if: matrix.os == 'ubuntu-latest' | |
- name: Upload Coverage | |
uses: actions/upload-artifact@v4 | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
name: Coverage Report | |
path: target/jacoco-report | |
- 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 | |
if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' | |
- name: Upload files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pr | |
path: pr/ | |
if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' |