add more infra #1
Workflow file for this run
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: 'Format code & API' | |
on: | |
push: | |
pull_request: | |
jobs: | |
cancel-previous-workflow: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # [email protected] | |
with: | |
access_token: ${{ github.token }} | |
format: | |
name: Build Job ${{ matrix.os }} - Java ${{ matrix.java }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
java: ['17'] | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: 'Set up Java: ${{ matrix.java }}' | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'temurin' | |
- name: Cache Gradle packages | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Generate API diff | |
run: make api | |
- name: Format | |
run: make format | |
# actions/checkout fetches only a single commit in a detached HEAD state. Therefore | |
# we need to pass the current branch, otherwise we can't commit the changes. | |
# GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs. | |
- name: Commit Formatted Code | |
run: ./scripts/commit-code.sh $GITHUB_HEAD_REF | |
- name: Make stop | |
run: make stop |