Skip to content

Commit

Permalink
Use matrix for job configurations (netty#10889)
Browse files Browse the repository at this point in the history
Motivation:

We can use the matrix feature to define our jobs. This reduces a lot of config

Modification:

Use job matrix

Result:

Easier to maintain
  • Loading branch information
normanmaurer authored Dec 23, 2020
1 parent 1a708ac commit 78fcd5c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 205 deletions.
99 changes: 20 additions & 79 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,29 @@ on:
workflow_dispatch:

jobs:

build-linux-x86_64-java8:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- setup: linux-x86_64-java8
docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml build"
docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml run build"
- setup: linux-x86_64-java11
docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml build"
docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml run build"
- setup: linux-x86_64-java15
docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-6.115.yaml build"
docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-6.115.yaml run build"

name: ${{ matrix.setup }}
steps:
- uses: actions/checkout@v2

# Cache .m2/repository
- uses: actions/cache@v2
env:
cache-name: build-linux-x86_64-java8-cache-m2-repository
cache-name: build-${{ matrix.setup }}-cache-m2-repository
with:
path: ~/.m2/repository
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
Expand All @@ -32,87 +45,15 @@ jobs:
- uses: satackey/[email protected]
continue-on-error: true
with:
key: build-linux-x86_64-java8-docker-cache-{hash}
key: build-${{ matrix.setup }}-docker-cache-{hash}
restore-keys: |
build-linux-x86_64-java8-docker-cache-
build-${{ matrix.setup }}-docker-cache-
- name: Build docker image
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml build
run: docker-compose ${{ matrix.docker-compose-build }}

- name: Build project without leak detection
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml run build

- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: target
path: "**/target/"

build-linux-x86_64-java11:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# Cache .m2/repository
- uses: actions/cache@v2
env:
cache-name: build-linux-x86_64-java11-cache-m2-repository
with:
path: ~/.m2/repository
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
# Enable caching of Docker layers
- uses: satackey/[email protected]
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
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml run build

- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: target
path: "**/target/"

build-linux-x86_64-java15:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# Cache .m2/repository
- uses: actions/cache@v2
env:
cache-name: build-linux-x86_64-java15-cache-m2-repository
with:
path: ~/.m2/repository
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
# Enable caching of Docker layers
- uses: satackey/[email protected]
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
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.115.yaml run build
run: docker-compose ${{ matrix.docker-compose-run }}

- uses: actions/upload-artifact@v2
if: ${{ failure() }}
Expand Down
150 changes: 24 additions & 126 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,33 @@ jobs:
- name: Verify with Maven
run: mvn verify -B --file pom.xml -DskipTests=true

build-linux-x86_64-java8:
build-pr:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- setup: linux-x86_64-java8
docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml build"
docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml run build-leak"
- setup: linux-x86_64-java11
docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml build"
docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml run build-leak"
- setup: linux-x86_64-java15
docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-6.115.yaml build"
docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-6.115.yaml run build-leak"
- setup: linux-x86_64-java11-boringssl
docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml build"
docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml run build-leak-boringssl-static"

name: ${{ matrix.setup }}
needs: verify
steps:
- uses: actions/checkout@v2

# Cache .m2/repository
- uses: actions/cache@v2
env:
cache-name: build-linux-x86_64-java8-cache-m2-repository
cache-name: build-${{ matrix.setup }}-cache-m2-repository
with:
path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
Expand All @@ -54,141 +71,22 @@ jobs:
- uses: satackey/[email protected]
continue-on-error: true
with:
key: build-linux-x86_64-java8-docker-cache-{hash}
key: build-${{ matrix.setup }}-docker-cache-{hash}
restore-keys: |
build-linux-x86_64-java8-docker-cache-
build-${{ matrix.setup }}-docker-cache-
- name: Build docker image
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml build
run: docker-compose ${{ matrix.docker-compose-build }}

- name: Build project with leak detection
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml run build-leak | tee build-leak.output
run: docker-compose ${{ matrix.docker-compose-run }} | tee build-leak.output

- name: Checking for detected leak
run: ./.github/scripts/check_leak.sh build-leak.output

- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: target
name: build-${{ matrix.setup }}-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@v2
env:
cache-name: build-linux-x86_64-java11-cache-m2-repository
with:
path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ env.cache-name }}-
${{ runner.os }}-pr-
# Enable caching of Docker layers
- uses: satackey/[email protected]
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 with leak detection
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
run: ./.github/scripts/check_leak.sh build-leak.output

- 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@v2
env:
cache-name: build-linux-x86_64-java15-cache-m2-repository
with:
path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ env.cache-name }}-
${{ runner.os }}-pr-
# Enable caching of Docker layers
- uses: satackey/[email protected]
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 with leak detection
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
run: ./.github/scripts/check_leak.sh build-leak.output

- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: target
path: "**/target/"

build-linux-x86_64-java11-boringssl:
runs-on: ubuntu-latest
needs: verify
steps:
- uses: actions/checkout@v2

# Cache .m2/repository
- uses: actions/cache@v2
env:
cache-name: build-linux-x86_64-java11-boringssl-cache-m2-repository
with:
path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ env.cache-name }}-
${{ runner.os }}-pr-
# Enable caching of Docker layers
- uses: satackey/[email protected]
continue-on-error: true
with:
key: build-linux-x86_64-java11-boringssl-docker-cache-{hash}
restore-keys: |
build-linux-x86_64-java11-boringssl-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 with leak detection
run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml run build-leak-boringssl-static | tee build-leak.output

- name: Checking for detected leak
run: ./.github/scripts/check_leak.sh build-leak.output

- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: target
path: "**/target/"

0 comments on commit 78fcd5c

Please sign in to comment.