Skip to content

SKARA-2348

SKARA-2348 #740

Workflow file for this run

#
# The pre-submit tests will only runs for forks of the TARGET_PROJECT defined below. This is set to "skara" by default,
# and can be changed by downstream projects if they also want to run pre-submit tests.
#
# The tests will attempt to merge the latest commits from TARGET_BRANCH before executing, to ensure that what is tested
# is as close as possible to what the final integration result will be. This is set to "master" by default, and can
# be changed by downstream projects that utilize multiple branches in order to select the correct one.
#
name: Pre-submit tests
on:
push:
branches-ignore:
- master
- pr/*
jobs:
prerequisites:
name: Prerequisites
runs-on: "ubuntu-latest"
env:
TARGET_PROJECT: skara
TARGET_BRANCH: master
outputs:
should_run: ${{ steps.check_submit.outputs.should_run }}
fetch_target_command: ${{ steps.merge_target.outputs.command }}
merge_target_command: ${{ steps.try_merge_target.outputs.command }}
steps:
- name: Determine target project name (fork source)
id: upstream_repo
uses: actions/github-script@v7
with:
result-encoding: string
script: "return (await github.rest.repos.get( {owner: context.repo.owner, repo: context.repo.repo })).data.source.name"
- name: Check if submit tests should actually run
id: check_submit
run: echo "should_run=${{ env.TARGET_PROJECT == steps.upstream_repo.outputs.result }}" >> $GITHUB_OUTPUT
- name: Checkout the source
uses: actions/checkout@v4
with:
fetch-depth: 1000
if: steps.check_submit.outputs.should_run != 'false'
- name: Determine merge target hash
id: merge_target
run: |
git fetch https://github.com/openjdk/${{ steps.upstream_repo.outputs.result }} ${TARGET_BRANCH}
echo "hash=`git rev-parse FETCH_HEAD`" >> $GITHUB_OUTPUT
echo "command=git fetch https://github.com/openjdk/${{ steps.upstream_repo.outputs.result }} ${TARGET_BRANCH}" >> $GITHUB_OUTPUT
if: steps.check_submit.outputs.should_run != 'false'
- name: Determine merge strategy
id: try_merge_target
run: >
(git -c user.name="presubmit" -c user.email="presubmit@github.actions" merge --no-edit ${{ steps.merge_target.outputs.hash }} &&
(echo "command=git -c user.name="presubmit" -c user.email="presubmit@github.actions" merge --no-edit ${{ steps.merge_target.outputs.hash }}") >> $GITHUB_OUTPUT) ||
(git merge --abort && git -c user.name="presubmit" -c user.email="presubmit@github.actions" rebase ${{ steps.merge_target.outputs.hash }} &&
(echo "command=git -c user.name="presubmit" -c user.email="presubmit@github.actions" rebase ${{ steps.merge_target.outputs.hash }}") >> $GITHUB_OUTPUT) ||
(echo "command=echo There are merge conflicts with the target that will have to be resolved before integration" >> $GITHUB_OUTPUT)
linux:
name: Linux x64
runs-on: "ubuntu-20.04"
needs: prerequisites
if: needs.prerequisites.outputs.should_run
steps:
- name: Checkout the source
uses: actions/checkout@v4
with:
fetch-depth: 1000
- name: Merge latest changes from target branch
run: |
${{ needs.prerequisites.outputs.fetch_target_command }}
${{ needs.prerequisites.outputs.merge_target_command }}
- name: Build and test
run: sh gradlew test --info --stacktrace
mac:
name: macOS x64
runs-on: "macos-12"
needs: prerequisites
steps:
- name: Checkout the source
uses: actions/checkout@v4
with:
fetch-depth: 1000
- name: Merge latest changes from target branch
run: |
${{ needs.prerequisites.outputs.fetch_target_command }}
${{ needs.prerequisites.outputs.merge_target_command }}
- name: Install Mercurial
run: brew install mercurial
- name: Build and test
run: sh gradlew test --info --stacktrace
win:
name: Windows x64
runs-on: "windows-2019"
needs: prerequisites
steps:
- name: Checkout the source
uses: actions/checkout@v4
with:
fetch-depth: 1000
- name: Merge latest changes from target branch
run: |
${{ needs.prerequisites.outputs.fetch_target_command }}
${{ needs.prerequisites.outputs.merge_target_command }}
- name: Build and test
run: gradlew.bat test --info --stacktrace
shell: cmd