Add workflow for gradle enterprise (#15211)

* add workflow for gradle enterprise

* add xml files

* remove build cache

* install

* update

* just clean

* trigger build

* mvn clean install
This commit is contained in:
William Cheng 2023-04-18 11:38:53 +08:00 committed by GitHub
parent 91815bf555
commit 58425f54c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,42 @@
name: Gradle Enterprise
on:
push:
branches:
- master
- '[5-9]+.[0-9]+.x'
pull_request:
branches:
- master
- '[5-9]+.[0-9]+.x'
- 'gradle-enterprise**'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: 8
distribution: 'temurin'
- name: Cache maven dependencies
uses: actions/cache@v3
env:
cache-name: cache-maven-repository
with:
path: |
~/.m2/repository
~/.gradle
!~/.gradle/caches/*/plugin-resolution/
!~/.m2/repository/org/openapitools/
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
- name: Run maven
run: mvn clean install
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}

13
.mvn/extensions.xml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<extensions>
<extension>
<groupId>com.gradle</groupId>
<artifactId>gradle-enterprise-maven-extension</artifactId>
<version>1.16.6</version>
</extension>
<extension>
<groupId>com.gradle</groupId>
<artifactId>common-custom-user-data-maven-extension</artifactId>
<version>1.11.1</version>
</extension>
</extensions>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- Common gradle-enterprise.xml configuration for Maven shared between CI agents and developers building locally.
The build cache credentials required for CI builds to write to the remote build cache are read from environment variables.
Possibly, the credentials are configured in Jenkins via Credentials plugin (https://plugins.jenkins.io/credentials/) and
Credentials Binding plugin (https://plugins.jenkins.io/credentials-binding/), or the credentials are injected using the
vendor-specific mechanism of the CI server running the build.
Note: In the XML configuration below, you need to adjust
- the server url of your Gradle Enterprise server
- the name of the environment variable that reveals the build is running in a CI environment
- the names of the environment variables holding the build cache credentials
to the specifics of your CI server settings. -->
<gradleEnterprise
xmlns="https://www.gradle.com/gradle-enterprise-maven" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.gradle.com/gradle-enterprise-maven https://www.gradle.com/schema/gradle-enterprise-maven.xsd">
<server>
<url>https://ge.openapi-generator.tech/</url> <!-- adjust to your GE server -->
<allowUntrusted>false</allowUntrusted> <!-- ensure a trusted certificate is configured -->
</server>
<buildScan>
<captureGoalInputFiles>true</captureGoalInputFiles>
<backgroundBuildScanUpload>#{isFalse(env['CI'])}</backgroundBuildScanUpload> <!-- adjust to your CI provider -->
<publish>ALWAYS</publish>
<publishIfAuthenticated>true</publishIfAuthenticated>
</buildScan>
</gradleEnterprise>