Use Github workflows for CI (#10879)

Motivation:

We should just use GitHub Actions for the CI

Modifications:

- Adjust docker / docker compose files 
- Add different workflows and jobs to deploy and build the project

Result:

Don't depend on external CI services
This commit is contained in:
Norman Maurer 2020-12-22 18:33:14 +01:00 committed by GitHub
parent ab8c4f22c6
commit 95b96126c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 261 additions and 312 deletions

180
.github/workflows/ci-build.yml vendored Normal file
View File

@ -0,0 +1,180 @@
name: Build project
on:
push:
branches: [ "4.1", master ]
pull_request:
branches: [ "4.1", master ]
schedule:
- cron: '30 1 * * 1' # At 01:30 on Monday, every Monday.
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
verify:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 8
# Cache .m2/repository
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: verify-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
verify-${{ runner.os }}-maven-
- name: Verify with Maven
run: mvn verify -B --file pom.xml -DskipTests=true
build-linux-x86_64-java8:
runs-on: ubuntu-latest
needs: verify
steps:
- uses: actions/checkout@v2
# Cache .m2/repository
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: build-linux-x86_64-java8-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
build-linux-x86_64-java8-${{ runner.os }}-maven-
# Enable caching of Docker layers
- uses: satackey/action-docker-layer-caching@v0.0.8
continue-on-error: true
with:
key: build-linux-x86_64-java8-docker-cache-{hash}
restore-keys: |
build-linux-x86_64-java8-docker-cache-
- name: Build docker image
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml build
- name: Build project without leak detection
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml run build
- name: Build project with leak detection
if: ${{ github.event_name == 'pull_request' }}
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml run build-leak | tee build-leak.output
- name: Checking for detected leak
if: ${{ github.event_name == 'pull_request' }}
run: |
if grep -q 'LEAK:' build-leak.output ; then
echo "Leak detected, please inspect build log"
exit 1
else
echo "No Leak detected"
fi
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: target
path: "**/target/"
build-linux-x86_64-java11:
runs-on: ubuntu-latest
needs: verify
steps:
- uses: actions/checkout@v2
# Cache .m2/repository
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: build-linux-x86_64-java11-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
build-linux-x86_64-java11-${{ runner.os }}-maven-
# Enable caching of Docker layers
- uses: satackey/action-docker-layer-caching@v0.0.8
continue-on-error: true
with:
key: build-linux-x86_64-java11-docker-cache-{hash}
restore-keys: |
build-linux-x86_64-java11-docker-cache-
- name: Build docker image
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml build
- name: Build project without leak detection
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml run build
- name: Build project with leak detection
if: ${{ github.event_name == 'pull_request' }}
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml run build-leak | tee build-leak.output
- name: Checking for detected leak
if: ${{ github.event_name == 'pull_request' }}
run: |
if grep -q 'LEAK:' build-leak.output ; then
echo "Leak detected, please inspect build log"
exit 1
else
echo "No Leak detected"
fi
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: target
path: "**/target/"
build-linux-x86_64-java15:
runs-on: ubuntu-latest
needs: verify
steps:
- uses: actions/checkout@v2
# Cache .m2/repository
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: build-linux-x86_64-java15-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
build-linux-x86_64-java15-${{ runner.os }}-maven-
# Enable caching of Docker layers
- uses: satackey/action-docker-layer-caching@v0.0.8
continue-on-error: true
with:
key: build-linux-x86_64-java15-docker-cache-{hash}
restore-keys: |
build-linux-x86_64-java15-docker-cache-
- name: Build docker image
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.115.yaml build
- name: Build project without leak detection
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.115.yaml run build
- name: Build project with leak detection
if: ${{ github.event_name == 'pull_request' }}
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.115.yaml run build-leak | tee build-leak.output
- name: Checking for detected leak
if: ${{ github.event_name == 'pull_request' }}
run: |
if grep -q 'LEAK:' build-leak.output ; then
echo "Leak detected, please inspect build log"
exit 1
else
echo "No Leak detected"
fi
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: target
path: "**/target/"

48
.github/workflows/ci-deploy.yml vendored Normal file
View File

@ -0,0 +1,48 @@
name: Deploy project
on:
push:
branches: [ "4.1", master ]
schedule:
- cron: '30 1 * * 1' # At 01:30 on Monday, every Monday.
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
deploy-linux-x86_64:
runs-on: ubuntu-latest
steps:
- uses: s4u/maven-settings-action@v2.2.0
with:
servers: |
[{
"id": "sonatype-nexus-snapshots",
"username": "${{ secrets.SONATYPE_USERNAME }}",
"password": "${{ secrets.SONATYPE_PASSWORD }}"
}]
- uses: actions/checkout@v2
# Cache .m2/repository
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: deploy-linux-x86_64-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
deploy-linux-x86_64-${{ runner.os }}-maven-
# Enable caching of Docker layers
- uses: satackey/action-docker-layer-caching@v0.0.8
continue-on-error: true
with:
key: deploy-linux-x86_64-docker-cache-{hash}
restore-keys: |
deploy-linux-x86_64-docker-cache-
- name: Build docker image
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml build
- name: Deploy snapshots
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml run deploy

View File

@ -1,7 +1,7 @@
ARG centos_version=6
FROM centos:$centos_version
# needed to do again after FROM due to docker limitation
ARG centos_version
FROM centos:6.10
# Update as we need to use the vault now.
RUN sed -i -e 's/^mirrorlist/#mirrorlist/g' -e 's/^#baseurl=http:\/\/mirror.centos.org\/centos\/$releasever\//baseurl=http:\/\/vault.centos.org\/6.10\//g' /etc/yum.repos.d/CentOS-Base.repo
# install dependencies
RUN yum install -y \

View File

@ -10,10 +10,10 @@ cd /path/to/netty/
docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml run test
```
## centos 7 with java 11
## centos 6 with java 11
```
docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-7.111.yaml run test
docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml run test
```
## aarch64 cross compile for transport-native-epoll on X86_64

View File

@ -6,7 +6,6 @@ services:
image: netty:centos-6-1.10
build:
args:
centos_version : "6"
java_version : "zulu@1.10.0-2"
test:

View File

@ -6,9 +6,14 @@ services:
image: netty:centos-6-1.11
build:
args:
centos_version : "6"
java_version : "adopt@1.11.0-9"
build:
image: netty:centos-6-1.11
build-leak:
image: netty:centos-6-1.11
test:
image: netty:centos-6-1.11

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-6-1.12
build:
args:
centos_version : "6"
java_version : "adopt@1.12.0-2"
test:
image: netty:centos-6-1.12
test-leak:
image: netty:centos-6-1.12
test-boringssl-static:
image: netty:centos-6-1.12
shell:
image: netty:centos-6-1.12

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-6-1.13
build:
args:
centos_version : "6"
java_version : "adopt@1.13.0-2"
test:
image: netty:centos-6-1.13
test-leak:
image: netty:centos-6-1.13
test-boringssl-static:
image: netty:centos-6-1.13
shell:
image: netty:centos-6-1.13

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-6-1.14
build:
args:
centos_version : "6"
java_version : "adopt@1.14.0-2"
test:
image: netty:centos-6-1.14
test-leak:
image: netty:centos-6-1.14
test-boringssl-static:
image: netty:centos-6-1.14
shell:
image: netty:centos-6-1.14

View File

@ -6,11 +6,16 @@ services:
image: netty:centos-6-1.15
build:
args:
centos_version : "6"
# use zulu and not adoptjdk for now as adoptjdk15 does not support centos6
# https://github.com/AdoptOpenJDK/openjdk-build/issues/2097
java_version : "zulu@1.15.0-1"
build:
image: netty:centos-6-1.15
build-leak:
image: netty:centos-6-1.15
test:
image: netty:centos-6-1.15

View File

@ -6,9 +6,14 @@ services:
image: netty:centos-6-1.8
build:
args:
centos_version : "6"
java_version : "adopt@1.8.0-272"
build:
image: netty:centos-6-1.8
build-leak:
image: netty:centos-6-1.8
test:
image: netty:centos-6-1.8

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-6-1.9
build:
args:
centos_version : "6"
java_version : "zulu@1.9.0-7"
test:
image: netty:centos-6-1.9
test-leak:
image: netty:centos-6-1.9
test-boringssl-static:
image: netty:centos-6-1.9
shell:
image: netty:centos-6-1.9

View File

@ -6,7 +6,6 @@ services:
image: netty:centos-6-1.11
build:
args:
centos_version : "6"
java_version : "graalvm-ce-java11@20.1.0"
test:

View File

@ -6,7 +6,6 @@ services:
image: netty:centos-6-1.8
build:
args:
centos_version : "6"
java_version : "graalvm-ce-java8@20.1.0"
test:

View File

@ -6,7 +6,6 @@ services:
image: netty:centos-6-openj9-1.11
build:
args:
centos_version : "6"
java_version : "adopt-openj9@1.11.0-9"
test:

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-7-1.10
build:
args:
centos_version : "7"
java_version : "zulu@1.10.0-2"
test:
image: netty:centos-7-1.10
test-leak:
image: netty:centos-7-1.10
test-boringssl-static:
image: netty:centos-7-1.10
shell:
image: netty:centos-7-1.10

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-7-1.11
build:
args:
centos_version : "7"
java_version : "adopt@1.11.0-9"
test:
image: netty:centos-7-1.11
test-leak:
image: netty:centos-7-1.11
test-boringssl-static:
image: netty:centos-7-1.11
shell:
image: netty:centos-7-1.11

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-7-1.12
build:
args:
centos_version : "7"
java_version : "adopt@1.12.0-2"
test:
image: netty:centos-7-1.12
test-leak:
image: netty:centos-7-1.12
test-boringssl-static:
image: netty:centos-7-1.12
shell:
image: netty:centos-7-1.12

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-7-1.13
build:
args:
centos_version : "7"
java_version : "adopt@1.13.0-2"
test:
image: netty:centos-7-1.13
test-leak:
image: netty:centos-7-1.13
test-boringssl-static:
image: netty:centos-7-1.13
shell:
image: netty:centos-7-1.13

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-7-1.14
build:
args:
centos_version : "7"
java_version : "adopt@1.14.0-2"
test:
image: netty:centos-7-1.14
test-leak:
image: netty:centos-7-1.14
test-boringssl-static:
image: netty:centos-7-1.14
shell:
image: netty:centos-7-1.14

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-7-1.15
build:
args:
centos_version : "7"
java_version : "adopt@1.15.0-1"
test:
image: netty:centos-7-1.15
test-leak:
image: netty:centos-7-1.15
test-boringssl-static:
image: netty:centos-7-1.15
shell:
image: netty:centos-7-1.15

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-7-1.8
build:
args:
centos_version : "7"
java_version : "adopt@1.8.0-272"
test:
image: netty:centos-7-1.8
test-leak:
image: netty:centos-7-1.8
test-boringssl-static:
image: netty:centos-7-1.8
shell:
image: netty:centos-7-1.8

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-7-1.9
build:
args:
centos_version : "7"
java_version : "zulu@1.9.0-7"
test:
image: netty:centos-7-1.9
test-leak:
image: netty:centos-7-1.9
test-boringssl-static:
image: netty:centos-7-1.9
shell:
image: netty:centos-7-1.9

View File

@ -6,7 +6,7 @@ services:
image: netty:default
build:
context: .
dockerfile: Dockerfile.centos
dockerfile: Dockerfile.centos6
common: &common
image: netty:default
@ -17,6 +17,14 @@ services:
- ..:/code:delegated
working_dir: /code
build-leak:
<<: *common
command: /bin/bash -cl "./mvnw -Pleak clean install -Dio.netty.testsuite.badHost=netty.io"
build:
<<: *common
command: /bin/bash -cl "./mvnw clean install -Dio.netty.testsuite.badHost=netty.io"
test-leak:
<<: *common
command: /bin/bash -cl "./mvnw -Pleak clean install -Dio.netty.testsuite.badHost=netty.io -Dmaven.wagon.http.pool=false"
@ -31,43 +39,9 @@ services:
shell:
<<: *common
environment:
- SANOTYPE_USER
- SANOTYPE_PASSWORD
volumes:
- ~/.ssh:/root/.ssh:delegated
- ~/.gnupg:/root/.gnupg:delegated
- ..:/code:delegated
- ~/.m2:/root/.m2:delegated
entrypoint: /bin/bash
cross-compile-aarch64-runtime-setup:
image: netty:cross_compile_aarch64
build:
context: .
dockerfile: Dockerfile.cross_compile_aarch64
args:
gcc_version : "4.9-2016.02"
cross-compile-aarch64-shell:
image: netty:cross_compile_aarch64
depends_on: [cross-compile-aarch64-runtime-setup]
volumes:
- ~/.ssh:/root/.ssh:delegated
- ~/.gnupg:/root/.gnupg:delegated
- ..:/code:delegated
- ~/.m2:/root/.m2:delegated
entrypoint: /bin/bash
working_dir: /code
cross-compile-aarch64-build:
image: netty:cross_compile_aarch64
depends_on: [cross-compile-aarch64-runtime-setup]
volumes:
- ~/.ssh:/root/.ssh:delegated
- ~/.gnupg:/root/.gnupg:delegated
- ..:/code:delegated
- ~/.m2:/root/.m2:delegated
# Since we are cross compiling netty-transport-native-epoll as aarch64 which cannot be loaded on x86_64, we add `skipTests` here to skip the test.
command: /bin/bash -cl "pushd ./transport-native-unix-common && ../mvnw clean install -Plinux-aarch64 && popd && pushd ./transport-native-epoll && ../mvnw clean install -Plinux-aarch64 -DskipTests && popd"
working_dir: /code