Skip to content

Improve CI workflow #73

Improve CI workflow

Improve CI workflow #73

Workflow file for this run

name: Build
on:
pull_request:
push:
branches:
- main
- 'releases/*'
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: Install Dependencies
run: npm ci
- name: Build
run: npm run all
test-capture:
runs-on: ubuntu-latest
if: "github.event_name == 'pull_request'"
needs: build
steps:
- 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 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- name: Setup Maven Build Scan dump capture
uses: ./build-scan-setup-maven
- name: Run Maven Build 1
working-directory: ./sample/common-develocity-maven-configuration
run: mvn clean -B -X -Dgradle.enterprise.url=https://ge.solutions-team.gradle.com
- name: Run Maven Build 2
working-directory: ./sample/common-develocity-maven-configuration
run: mvn initialize -B -X -Dgradle.enterprise.url=https://ge.solutions-team.gradle.com
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: ./build-scan-setup-maven
- name: Publish Build Scans
uses: ./build-scan-publish-maven
with:
develocity-url: 'https://ge.solutions-team.gradle.com/'
develocity-access-key: 'foo'
assert-summary:
runs-on: ubuntu-latest
if: "github.event_name == 'pull_request'"
needs: test-publish
steps:
- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.number }}
body-includes: '###### Generated by gradle/github-actions'
- name: Assert PR has been commented with publication summary
run: |
if [[ -z "${{ steps.fc.outputs.comment-id }}" ]]; then
echo "Expected comment not found"
exit 1
else
echo "Removing expected comment"
gh api --method DELETE "repos/${GITHUB_REPOSITORY}/issues/comments/${{ steps.fc.outputs.comment-id }}"
fi