Graal CI workflow #851
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: CI Run | |
concurrency: | |
group: pr-ci_${{ github.event.pull_request.number }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- '*' | |
tags-ignore: | |
- v* | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pull-requests: read | |
actions: read | |
jobs: | |
check-for-pr: | |
runs-on: ubuntu-latest | |
outputs: | |
skip: ${{ steps.check.outputs.skip }} | |
steps: | |
- name: Check if PR exists | |
id: check | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
HEAD_REF: ${{ github.head_ref }} | |
run: | | |
if [ -z "${{ github.base_ref }}" ]; then | |
prs=$(gh pr list \ | |
--repo "$GITHUB_REPOSITORY" \ | |
--json baseRefName,headRefName \ | |
--jq ' | |
map(select(.baseRefName == "${{ github.base_ref }}" and .headRefName == "$HEAD_REF}")) | |
| length | |
') | |
if ((prs > 0)); then | |
echo "skip=true" >> "$GITHUB_OUTPUT" | |
fi | |
fi | |
check-formatting: | |
runs-on: ubuntu-22.04 | |
needs: check-for-pr | |
if: needs.check-for-pr.outputs.skip != 'true' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup OS | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang-format-11 | |
# we need this to make sure we are actually using clang-format v. 11 | |
sudo mv /usr/bin/clang-format /usr/bin/clang-format-14 | |
sudo mv /usr/bin/clang-format-11 /usr/bin/clang-format | |
- name: Cache Gradle Wrapper Binaries | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/wrapper/dists | |
key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} | |
restore-keys: | | |
gradle-wrapper-${{ runner.os }}- | |
- name: Cache Gradle User Home | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/caches | |
key: gradle-caches-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
gradle-caches-${{ runner.os }}- | |
- name: Check | |
run: | | |
./gradlew spotlessCheck --no-daemon --parallel --build-cache --no-watch-fs | |
test-matrix: | |
needs: check-formatting | |
if: needs.check-for-pr.outputs.skip != 'true' | |
uses: ./.github/workflows/test_workflow.yml | |
with: | |
configuration: '["debug"]' | |
gh-release: | |
if: startsWith(github.event.ref, 'refs/heads/release/') | |
runs-on: ubuntu-latest | |
needs: [test-matrix] | |
steps: | |
- name: Create Github Release | |
uses: ./.github/workflows/gh_release.yml@gh-release | |
with: | |
release_branch: ${GITHUB_REF_NAME} |