Defer coverage reports to the end of the CI pipeline (#535) #1620
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 | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
workflow_dispatch: {} | |
jobs: | |
shellcheck: | |
name: Shellcheck | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Run Shellcheck | |
uses: ludeeus/action-shellcheck@master | |
with: | |
check_together: 'yes' | |
scandir: ./scripts | |
validate-codecov: | |
name: Validate codecov.yml | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Validate codecov.yml | |
shell: bash | |
run: curl -vvv --fail --data-binary @- https://codecov.io/validate < codecov.yml | |
validate-checkstyle-and-license-headers: | |
name: Checkstyle and license headers | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 23 | |
distribution: temurin | |
cache: maven | |
- name: Validate | |
shell: bash | |
run: ./mvnw -B validate | |
build: | |
name: JDK ${{ matrix.java-version }} on ${{ matrix.os-name }} (${{ matrix.maven}} Maven) | |
runs-on: ${{ matrix.os-name }} | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
os-name: [ubuntu-latest] | |
java-version: [11, 23] | |
maven: [default] | |
include: | |
# Cross-OS tests | |
- os-name: macos-latest | |
java-version: 11 | |
maven: default | |
- os-name: windows-latest | |
java-version: 11 | |
maven: default | |
- os-name: ubuntu-latest | |
java-version: 11 | |
maven: 3.8.8 | |
- os-name: ubuntu-latest | |
java-version: 17 | |
maven: 4.0.0-rc-2 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java-version }} | |
distribution: 'temurin' | |
cache: maven | |
- name: Set Maven version | |
shell: bash | |
run: |- | |
case '${{ matrix.maven }}' in | |
default) :;; | |
*) version='${{ matrix.maven }}';; | |
esac | |
if [[ -n ${version+defined} ]]; then | |
./mvnw -B -T1 -q wrapper:wrapper "-Dmaven=${version}" | |
fi | |
./mvnw --version | |
- name: Install protoc to $PATH | |
shell: bash | |
run: scripts/install-protoc-to-github-runner.sh | |
- name: Build and test | |
shell: bash | |
run: ./mvnw -B -Dcheckstyle.skip -Dlicense.skip clean verify | |
- name: Publish code coverage | |
uses: codecov/codecov-action@v4 | |
continue-on-error: true | |
if: always() | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload build logs as artifacts | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: jdk-${{ matrix.java-version }}-${{ matrix.os-name }}-${{ matrix.maven }} | |
path: |- | |
**/build.log | |
**/maven-status/** | |
**/surefire-reports/**.txt | |
compression-level: 9 | |
retention-days: 7 | |
include-hidden-files: true | |
if-no-files-found: warn | |
pages: | |
name: Pages | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 23 | |
distribution: temurin | |
cache: maven | |
- name: Build Pages | |
shell: bash | |
run: |- | |
./mvnw -B site \ | |
-Dmaven.test.skip \ | |
-Dinvoker.skip \ | |
-Dcheckstyle.skip \ | |
-Dlicense.skip | |
- name: Upload generated site as artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: site | |
path: protobuf-maven-plugin/target/site/** | |
compression-level: 9 | |
retention-days: 7 | |
include-hidden-files: true | |
if-no-files-found: error | |
notify-coverage: | |
name: Notify of coverage | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
needs: | |
- build | |
- validate-codecov | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Publish code coverage | |
uses: codecov/codecov-action@v5 | |
continue-on-error: true | |
if: always() | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
run_command: send-notifications |