Skip to content

Commit 124e9d6

Browse files
committed
initial PR pull GH action
1 parent 836666d commit 124e9d6

File tree

2 files changed

+133
-0
lines changed

2 files changed

+133
-0
lines changed

.github/workflows/maven-pr-3.0.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build Test PR 3.0
2+
3+
on:
4+
pull_request:
5+
branches: [ "3.0.0" ]
6+
7+
jobs:
8+
build_pr_30:
9+
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
java: [ 8, 11, 17 ]
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
name: git checkout 3.0.0
18+
with:
19+
ref: 3.0.0
20+
- name: Set up Java
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: ${{ matrix.java }}
24+
distribution: temurin
25+
cache: maven
26+
- name: preliminary checks
27+
run: |
28+
docker login --username=${{ secrets.DOCKERHUB_SB_USERNAME }} --password=${{ secrets.DOCKERHUB_SB_PASSWORD }}
29+
set -e
30+
# fail if templates/generators contain carriage return '\r'
31+
/bin/bash ./bin/utils/detect_carriage_return.sh
32+
# fail if generators contain merge conflicts
33+
/bin/bash ./bin/utils/detect_merge_conflict.sh
34+
# fail if generators contain tab '\t'
35+
/bin/bash ./bin/utils/detect_tab_in_java_class.sh
36+
- uses: s4u/[email protected]
37+
name: setup maven settings.xml
38+
with:
39+
servers: |
40+
[{
41+
"id": "sonatype-nexus-staging",
42+
"username": "${{ secrets.OSSRH_USERNAME }}",
43+
"password": "${{ secrets.OSSRH_TOKEN }}"
44+
},
45+
{
46+
"id": "sonatype-nexus-snapshots",
47+
"username": "${{ secrets.OSSRH_USERNAME }}",
48+
"password": "${{ secrets.OSSRH_TOKEN }}"
49+
}]
50+
- name: Build with Maven
51+
run: |
52+
# mvn clean install -Pdocker -Plinux -DJETTY_TEST_HTTP_PORT=8090 -DJETTY_TEST_STOP_PORT=8089
53+
mvn clean verify -U -DJETTY_TEST_HTTP_PORT=8070 -DJETTY_TEST_STOP_PORT=8069
54+
- name: Test samples
55+
if: ${{ matrix.java == 8 }}
56+
run: |
57+
mvn -q verify -U -Psamples -Dproject.build.sourceEncoding=UTF8 -Dfile.encoding=UTF8
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Build Test PR 3.0
2+
3+
on:
4+
push:
5+
branches: [ "3.0.0" ]
6+
7+
jobs:
8+
build_push_30:
9+
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
java: [ 8, 11, 17 ]
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
name: git checkout 3.0.0
18+
with:
19+
ref: 3.0.0
20+
- name: Set up Java
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: ${{ matrix.java }}
24+
distribution: temurin
25+
cache: maven
26+
- name: preliminary checks
27+
run: |
28+
docker login --username=${{ secrets.DOCKERHUB_SB_USERNAME }} --password=${{ secrets.DOCKERHUB_SB_PASSWORD }}
29+
set -e
30+
# fail if templates/generators contain carriage return '\r'
31+
/bin/bash ./bin/utils/detect_carriage_return.sh
32+
# fail if generators contain merge conflicts
33+
/bin/bash ./bin/utils/detect_merge_conflict.sh
34+
# fail if generators contain tab '\t'
35+
/bin/bash ./bin/utils/detect_tab_in_java_class.sh
36+
- uses: s4u/[email protected]
37+
name: setup maven settings.xml
38+
with:
39+
servers: |
40+
[{
41+
"id": "sonatype-nexus-staging",
42+
"username": "${{ secrets.OSSRH_USERNAME }}",
43+
"password": "${{ secrets.OSSRH_TOKEN }}"
44+
},
45+
{
46+
"id": "sonatype-nexus-snapshots",
47+
"username": "${{ secrets.OSSRH_USERNAME }}",
48+
"password": "${{ secrets.OSSRH_TOKEN }}"
49+
}]
50+
- name: Build with Maven
51+
run: |
52+
# mvn clean install -U -Pdocker -Plinux -DJETTY_TEST_HTTP_PORT=8090 -DJETTY_TEST_STOP_PORT=8089
53+
- name: Test samples
54+
if: ${{ matrix.java == 8 }}
55+
run: |
56+
mvn -q verify -U -Psamples -Dproject.build.sourceEncoding=UTF8 -Dfile.encoding=UTF8
57+
- name: docker cli and minimal build and push
58+
if: ${{ matrix.java == 17 }}
59+
run: |
60+
export MY_POM_VERSION=`mvn -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
61+
echo "POM VERSION" ${MY_POM_VERSION}
62+
export DOCKER_GENERATOR_IMAGE_NAME=swaggerapi/swagger-generator-v3-minimal
63+
export DOCKER_CODEGEN_CLI_IMAGE_NAME=swaggerapi/swagger-codegen-cli-v3
64+
if [[ $MY_POM_VERSION =~ ^.*SNAPSHOT$ ]];
65+
then
66+
mvn -DJETTY_TEST_HTTP_PORT=8090 -DJETTY_TEST_STOP_PORT=8089 clean deploy -Pdocker --settings $HOME/.m2/settings.xml
67+
docker build --rm=false -t $DOCKER_GENERATOR_IMAGE_NAME:unstable -f ./modules/swagger-generator/Dockerfile_minimal ./modules/swagger-generator
68+
docker tag $DOCKER_GENERATOR_IMAGE_NAME:unstable
69+
docker push $DOCKER_GENERATOR_IMAGE_NAME:unstable
70+
docker build --rm=false -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:unstable ./modules/swagger-codegen-cli
71+
docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:unstable
72+
docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME:unstable
73+
else
74+
echo "not building and pushing release docker image: " ${MY_POM_VERSION}
75+
fi
76+

0 commit comments

Comments
 (0)