Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract init-script contents out of 'develocity-gradle.yml' #40

Merged
merged 4 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/build-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,29 @@ env:
GITLAB_PROJECT_ID: 48766853

jobs:
verify-outputs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run the build
run: ./build.sh

- name: Verify Changed files
uses: tj-actions/verify-changed-files@v20
id: verify-changed-files

- name: Fail if generated files are not up-to-date
if: steps.verify-changed-files.outputs.files_changed == 'true'
env:
CHANGED_FILES: ${{ steps.verify-changed-files.outputs.changed_files }}
run: |
echo "Generated files are not up-to-date: $CHANGED_FILES"
exit 1

unit-test:
needs: verify-outputs
name: Unit test scripts
runs-on: ubuntu-latest
steps:
Expand All @@ -16,7 +38,9 @@ jobs:
- name: Unit test
id: test
run: ./test_maven.sh

verification:
needs: verify-outputs
name: Smoke test on GitLab
runs-on: ubuntu-latest
steps:
Expand Down
16 changes: 16 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

mkdir -p build

# Copy the init-scripts to the build directory and indent them for inclusion in the 'develocity-gradle.yml' file.
sed -e 's/^/ /' src/gradle/init-scripts/build-result-capture.init.gradle > build/build-result-capture.init.gradle
sed -e 's/^/ /' src/gradle/init-scripts/develocity-injection.init.gradle > build/develocity-injection.init.gradle

# Construct the combined 'develocity-gradle.yml' file from the template and the init-script contents.
sed -e '/<<BUILD_RESULT_CAPTURE_INIT_GROOVY>>/{
r build/build-result-capture.init.gradle
d
}' -e '/<<DEVELOCITY_INJECTION_INIT_GRADLE>>/{
r build/develocity-injection.init.gradle
d
}' src/gradle/develocity-gradle.template.yml > develocity-gradle.yml
Loading
Loading