Bump the npm-dependencies group across 1 directory with 3 updates (#87) #359
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: Build | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- 'releases/*' | |
env: | |
DV_URL: "https://ge.solutions-team.gradle.com" | |
DV_FAKE_ACCESS_KEY: "ge.solutions-team.gradle.com=foo" | |
MAVEN_SETUP_DIST: "dist/setup-maven" | |
MAVEN_PUBLISH_DIST: "dist/maven-publish-build-scan" | |
MAVEN_CAPTURE_EXTENSION_JAR: "dist/maven-build-scan-capture-extension/maven-build-scan-capture-extension.jar" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 8 | |
distribution: "temurin" | |
- name: Install Dependencies | |
run: npm ci | |
- name: Build | |
run: npm run all | |
- name: Check setup-maven dist | |
run: | | |
if [ "$(git diff --ignore-space-at-eol --text ${{ env.MAVEN_SETUP_DIST }} | wc -l)" -gt "0" ]; then | |
echo "Detected uncommitted changes after build. See status below:" | |
git diff --ignore-space-at-eol --text ${{ env.MAVEN_SETUP_DIST }} | |
exit 1 | |
fi | |
- name: Check maven-publish-build-scan dist | |
run: | | |
if [ "$(git diff --ignore-space-at-eol --text ${{ env.MAVEN_PUBLISH_DIST }} | wc -l)" -gt "0" ]; then | |
echo "Detected uncommitted changes after build. See status below:" | |
git diff --ignore-space-at-eol --text ${{ env.MAVEN_PUBLISH_DIST }} | |
exit 1 | |
fi | |
- name: Check maven-build-scan-capture-extension dist | |
run: | | |
# collect current jar content status (length, crc32, name of each entries) | |
unzip -vqq ${{ env.MAVEN_CAPTURE_EXTENSION_JAR }} | awk '{print $1,$7,$8}' | sort -k3 --ignore-case > current-jar-status.txt | |
# retrieve last jar version from repository | |
git restore ${{ env.MAVEN_CAPTURE_EXTENSION_JAR }} | |
# collect last from repo jar content status (length, crc32, name of each entries) | |
unzip -vqq ${{ env.MAVEN_CAPTURE_EXTENSION_JAR }} | awk '{print $1,$7,$8}' | sort -k3 --ignore-case > repo-jar-status.txt | |
if [ "$(diff current-jar-status.txt repo-jar-status.txt | wc -l)" -gt "0" ]; then | |
echo "Detected uncommitted changes after build. See status below:" | |
diff current-jar-status.txt repo-jar-status.txt | |
exit 1 | |
fi | |
test-capture: | |
runs-on: ubuntu-latest | |
if: "github.event_name == 'pull_request'" | |
needs: build | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Find PR Comment with publication summary | |
uses: peter-evans/find-comment@v3 | |
id: fc | |
with: | |
issue-number: ${{ github.event.number }} | |
body-includes: '###### Generated by gradle/develocity-actions' | |
- name: Delete PR Comment with publication summary | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
if [[ ! -z "${{ steps.fc.outputs.comment-id }}" ]]; then | |
echo "Removing PR Comment with publication summary" | |
gh api --method DELETE "repos/${GITHUB_REPOSITORY}/issues/comments/${{ steps.fc.outputs.comment-id }}" | |
fi | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Checkout Maven sample project | |
uses: actions/checkout@v4 | |
with: | |
repository: 'gradle/develocity-build-config-samples' | |
path: 'sample' | |
ref: 'main' | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Build Scan dump capture | |
uses: ./setup-maven | |
- name: Run Maven Build 1 | |
working-directory: ./sample/common-develocity-maven-configuration | |
run: mvn clean -B -X -Ddevelocity.url=${{ env.DV_URL }} | |
- name: Run Maven Build 2 | |
working-directory: ./sample/common-develocity-maven-configuration | |
run: mvn initialize -B -X -Ddevelocity.url=${{ env.DV_URL }} | |
test-publish: | |
runs-on: ubuntu-latest | |
if: "github.event_name == 'pull_request'" | |
needs: test-capture | |
permissions: | |
actions: write | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Build Scan link capture | |
uses: ./setup-maven | |
- name: Publish Build Scans | |
uses: ./maven-publish-build-scan | |
with: | |
develocity-url: ${{ env.DV_URL }} | |
develocity-access-key: ${{ env.DV_FAKE_ACCESS_KEY }} | |
assert-test: | |
runs-on: ubuntu-latest | |
if: "github.event_name == 'pull_request'" | |
needs: test-publish | |
steps: | |
- name: Find PR Comment with publication summary | |
uses: peter-evans/find-comment@v3 | |
id: fc | |
with: | |
issue-number: ${{ github.event.number }} | |
body-includes: '###### Generated by gradle/develocity-actions' | |
- name: Assert PR Comment with publication summary is present | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
if [[ -z "${{ steps.fc.outputs.comment-id }}" ]]; then | |
echo "Expected comment not found" | |
exit 1 | |
fi | |
- name: Assert PR Comment contains expected goals | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
trimmedComment=$(echo "${{ steps.fc.outputs.comment-body }}" | sed 's/^ *//g') | |
if [[ ! "$trimmedComment" == *clean* ]]; then | |
echo "Publication summary does not contain clean goals" | |
exit 1 | |
fi | |
if [[ ! "$trimmedComment" == *initialize* ]]; then | |
echo "Publication summary does not contain initialize goals" | |
exit 1 | |
fi |