Skip to content

Commit 8ee700a

Browse files
committed
TEST
Signed-off-by: marko-bekhta <[email protected]>
1 parent 2cef49a commit 8ee700a

File tree

2 files changed

+19
-87
lines changed

2 files changed

+19
-87
lines changed

.github/workflows/ci-report.yml

Lines changed: 19 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -17,69 +17,46 @@ env:
1717

1818
permissions:
1919
contents: read
20+
pull-requests: read
2021

2122
jobs:
2223
publish-build-scans:
2324
name: Publish Develocity build scans
24-
if: github.repository == 'hibernate/hibernate-validator' && github.event.workflow_run.conclusion != 'cancelled'
2525
runs-on: ubuntu-latest
2626
steps:
2727
# Different branches might have different versions of Develocity, and we want to make sure
2828
# that we publish with the one that we built the scan with in the first place:
2929
- name: Determine the Branch Reference for which the original action was triggered
3030
id: determine_branch_ref
31+
env:
32+
GH_TOKEN: ${{ github.token }}
3133
run: |
32-
if [ -n "${{ github.event.workflow_run.pull_requests[0].base.ref }}" ]; then
33-
BRANCH_REF="${{ github.event.workflow_run.pull_requests[0].base.ref }}"
34+
if [ "${{ github.event.workflow_run.event }}" == "pull_request" ]; then
35+
echo "::notice::Triggering workflow was executed for a pull request"
36+
37+
FORK_OWNER="${{ github.event.workflow_run.head_repository.owner.login }}"
38+
BRANCH_NAME="${{ github.event.workflow_run.head_branch }}"
39+
if [ "${{ github.event.workflow_run.head_repository.owner.login }}" != "${{ github.event.workflow_run.repository.owner.login }}" ]; then
40+
BRANCH_NAME="$FORK_OWNER:$BRANCH_NAME"
41+
fi
42+
TARGET_BRANCH=$(gh pr view "$BRANCH_NAME" --repo ${{ github.event.workflow_run.repository.full_name }} --json baseRefName -q .baseRefName)
43+
44+
echo "::notice::PR found. Target branch is: $TARGET_BRANCH"
45+
echo "original_branch_ref=$TARGET_BRANCH" >> "$GITHUB_OUTPUT"
3446
else
35-
BRANCH_REF="${{ github.event.workflow_run.head_branch }}"
47+
echo "::notice::PR not found. Defaulting to head_branch."
48+
echo "original_branch_ref=${{ github.event.workflow_run.head_branch }}" >> "$GITHUB_OUTPUT"
3649
fi
37-
echo "original_branch_ref=$BRANCH_REF" >> "$GITHUB_OUTPUT"
3850
# Checkout target branch which has trusted code
3951
- name: Check out target branch
4052
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
4153
with:
4254
persist-credentials: false
55+
# Different branches might have different versions of Develocity, and we want to make sure
56+
# that we publish with the one that we built the scan with in the first place:
4357
ref: ${{ steps.determine_branch_ref.outputs.original_branch_ref }}
4458
- name: Set up Java 21
4559
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # 4.7.1
4660
with:
4761
java-version: 21
4862
distribution: temurin
49-
# https://github.com/actions/cache/blob/main/examples.md#java---maven
50-
- name: Cache local Maven repository
51-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
52-
with:
53-
path: ~/.m2/repository
54-
# use a different key than workflows running untrusted code
55-
key: trusted-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
56-
restore-keys: |
57-
trusted-${{ runner.os }}-maven-
58-
- name: Set up Maven
59-
run: ./mvnw -v
60-
- name: Download GitHub Actions artifacts for the Develocity build scans
61-
id: downloadBuildScan
62-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # 4.3.0
63-
with:
64-
pattern: build-scan-data-*
65-
github-token: ${{ github.token }}
66-
repository: ${{ github.repository }}
67-
run-id: ${{ github.event.workflow_run.id }}
68-
path: /tmp/downloaded-build-scan-data/
69-
# Don't fail the build if there are no matching artifacts
70-
continue-on-error: true
71-
- name: Publish Develocity build scans for previous builds
72-
if: ${{ steps.downloadBuildScan.outcome != 'failure'}}
73-
run: |
74-
shopt -s nullglob # Don't run the loop below if there are no artifacts
75-
status=0
76-
mkdir -p ~/.m2/.develocity/
77-
for build_scan_data_directory in /tmp/downloaded-build-scan-data/*
78-
do
79-
rm -rf ~/.m2/.develocity/build-scan-data
80-
mv "$build_scan_data_directory" ~/.m2/.develocity/build-scan-data \
81-
&& ./mvnw $MAVEN_ARGS develocity:build-scan-publish-previous || status=1
82-
done
83-
exit $status
84-
env:
85-
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY_PR }}

.github/workflows/ci.yml

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -95,50 +95,5 @@ jobs:
9595
java-version: ${{ matrix.os.java.version }}
9696
distribution: temurin
9797
# https://github.com/actions/cache/blob/main/examples.md#java---maven
98-
- name: Cache local Maven repository
99-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
100-
with:
101-
path: ~/.m2/repository
102-
# use a different key than workflows running in trusted mode
103-
key: ${{ github.event_name == 'push' && 'trusted' || 'untrusted' }}-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
104-
restore-keys: |
105-
${{ github.event_name == 'push' && 'trusted' || 'untrusted' }}-${{ runner.os }}-maven-
10698
- name: Set up Maven
10799
run: ./mvnw -v
108-
109-
- name: Build code and run tests and basic checks (Standalone)
110-
run: |
111-
./mvnw $MAVEN_ARGS ${{ matrix.os.maven.args }} clean install \
112-
-Pjqassistant -Pdist
113-
env:
114-
DEVELOCITY_ACCESS_KEY: "${{ secrets.DEVELOCITY_ACCESS_KEY || '' }}"
115-
DEVELOCITY_BASE_URL: "${{ env.DEVELOCITY_BASE_URL || 'https://develocity.commonhaus.dev' }}"
116-
# For jobs running on 'pull_request', upload build scan data.
117-
# The actual publishing must be done in a separate job (see ci-report.yml).
118-
# We don't write to the remote cache as that would be unsafe.
119-
- name: Upload GitHub Actions artifact for the Develocity build scan
120-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # 4.6.2
121-
if: "${{ github.event_name == 'pull_request' && !cancelled() }}"
122-
with:
123-
name: build-scan-data-standalone-${{ matrix.os.name }}
124-
path: ~/.m2/.develocity/build-scan-data
125-
126-
- name: Run TCK tests in container mode
127-
run: |
128-
./mvnw $MAVEN_ARGS ${{ matrix.os.maven.args }} clean verify \
129-
-Pjqassistant -Pskip-checks \
130-
-am -pl :hibernate-validator-tck-runner \
131-
-Dincontainer -Dincontainer-prepared
132-
env:
133-
DEVELOCITY_ACCESS_KEY: "${{ secrets.DEVELOCITY_ACCESS_KEY || '' }}"
134-
DEVELOCITY_BASE_URL: "${{ env.DEVELOCITY_BASE_URL || 'https://develocity.commonhaus.dev' }}"
135-
136-
- name: Upload GitHub Actions artifact for the Develocity build scan
137-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # 4.6.2
138-
if: "${{ github.event_name == 'pull_request' && !cancelled() }}"
139-
with:
140-
name: build-scan-data-incontainer-${{ matrix.os.name }}
141-
path: ~/.m2/.develocity/build-scan-data
142-
143-
- name: Omit produced artifacts from build cache
144-
run: rm -r ~/.m2/repository/org/hibernate/validator

0 commit comments

Comments
 (0)