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

Create build once workflow #31

Merged
merged 21 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
28 changes: 27 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,36 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Read Plugin Version
uses: madhead/read-java-properties@latest
id: version
with:
file: gradle.properties
property: version
default: latest
- name: Set Artifact Name
id: artifactName
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
echo "artifact_name=${{ github.ref_name }}" >>$GITHUB_OUTPUT
else
echo "artifact_name=PR-${{ github.event.pull_request.number }}" >>$GITHUB_OUTPUT
fi
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
- name: Run Gradle Build
run: ./gradlew build -x containerTest
id: build
run: ./gradlew clean build -x containerTest
- name: Add Artifacts To Local Repository
id: artifactCopy
run: ./gradlew publishMavenPublicationToArtifactsRepository
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifactName.outputs.artifact_name }}
path: |
build/artifacts/de/tracetronic/jenkins/plugins/ecutestexecution/${{ steps.version.outputs.value }}
if-no-files-found: error
2 changes: 1 addition & 1 deletion .github/workflows/reuse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: REUSE Compliance Check
on: [push, pull_request]

jobs:
test:
reuse-compliance-check:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- .github/labels.yml

jobs:
build:
sync-repo-labels:
name: Sync Labels
runs-on: ubuntu-latest
steps:
Expand Down
37 changes: 23 additions & 14 deletions Jenkinsfile.internal
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,41 @@ pipeline {
}

agent {
node {
label 'ecutest && windows && docker'
}
label 'windows && docker'
}

stages {
stage ('Prepare Resources') {
steps {
copyArtifacts fingerprintArtifacts: true, projectName: '../prepareContainerTestData', selector: lastSuccessful()
}
}
stage ('ContainerTest') {
steps {
withGradle {
bat './gradlew clean containerTest'
stage('Run Parallel') {
failFast false
parallel {
stage('System Tests') {
steps {
build job: '../systemTests', parameters: [string(name: 'artifactName', value: "${JOB_BASE_NAME}"), string(name: 'commitHash', value: "${GIT_COMMIT}")]
}
}
stage('Container Tests') {
stages {
stage('Prepare Resources') {
steps {
copyArtifacts fingerprintArtifacts: true, projectName: '../prepareContainerTestData', selector: lastSuccessful()
}
}
stage('Run Container Tests') {
steps {
bat './gradlew clean containerTest'
}
}
}
}
}
}
}

post {
unsuccessful {
mail to: "${env.EMAIL_RECIPIENTS}",
subject: "${JOB_NAME} - Build #${BUILD_NUMBER} - ${currentBuild.currentResult}",
body: "Check console output at ${BUILD_URL} to view the results."
}
}


}
11 changes: 9 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ description = 'This plugin enables a platform-independent test execution. Due to
jenkinsPlugin {
jenkinsVersion = "${project.properties['jenkinsVersion']}"
shortName = 'ecu-test-execution'
group = 'io.jenkins.plugins'
group = "${group}"
displayName = 'TraceTronic ECU-TEST-Execution Plugin'

url = 'https://plugins.jenkins.io/ecu-test-execution/'
Expand Down Expand Up @@ -94,6 +94,10 @@ configurations.testRuntimeOnly {
publishing {
publications {
maven(MavenPublication) {
artifactId = "ecutestexecution"
groupId = "${group}"
version = "${version}"

from components.java

pom {
Expand Down Expand Up @@ -162,6 +166,10 @@ publishing {
password = project.findProperty('jenkinsPwd')
}
}
maven {
name = "Artifacts"
url = uri("file://${buildDir}/artifacts")
}
}
}

Expand Down Expand Up @@ -208,7 +216,6 @@ task containerTest(type: Test) {
includeTestsMatching('*ContainerTest')
}
useJUnitPlatform()
dependsOn test
}

jacocoTestReport {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ---versions--- #
version=3.0.0-SNAPSHOT
version=3.0-SNAPSHOT
jpiVersion=0.43.0
jenkinsVersion=2.332.3
gradleVersion=7.3
Expand All @@ -11,4 +11,4 @@ depCheckVersion=7.4.1
failBuildOnCVSS=9.0
# --- Disabling SHA256 and SHA512 checksums when releasing a plugin ---#
# --- see https://github.com/jenkinsci/gradle-jpi-plugin/blob/master/README.md#disabling-sha256-and-sha512-checksums-when-releasing-a-plugin ---#
org.gradle.internal.publish.checksums.insecure=true
systemProp.org.gradle.internal.publish.checksums.insecure=true