Skip to content

Commit

Permalink
Split pr and normal build (java-native-access#127)
Browse files Browse the repository at this point in the history
Motivation:

We should better use seperate workflows for PR and normal builds

Modifications:

- Split workflows

Result:

Cleanup
  • Loading branch information
normanmaurer authored Dec 23, 2020
1 parent 5a50e91 commit da8b007
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 17 deletions.
15 changes: 15 additions & 0 deletions .github/scripts/check_leak.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

if [ "$#" -ne 1 ]; then
echo "Expected build log as argument"
exit 1
fi

if grep -q 'LEAK:' $1 ; then
echo "Leak detected, please inspect build log"
exit 1
else
echo "No Leak detected"
exit 0
fi

17 changes: 0 additions & 17 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Build project
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

schedule:
- cron: '30 7 * * 1' # At 07:30 on Monday, every Monday.
Expand All @@ -30,23 +28,8 @@ jobs:
run: docker-compose -f docker/docker-compose.centos-6.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.centos-6.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.centos-6.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:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build project

on:
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

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

# Enable caching of Docker layers
- uses: satackey/[email protected]
continue-on-error: true
with:
key: pr-linux-x86_64-docker-cache-{hash}
restore-keys: |
pr-linux-x86_64-docker-cache-
- name: Build docker image
run: docker-compose -f docker/docker-compose.centos-6.yaml -f docker/docker-compose.centos-6.18.yaml build

- name: Build project with leak detection
run: docker-compose -f docker/docker-compose.centos-6.yaml -f docker/docker-compose.centos-6.18.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/"

0 comments on commit da8b007

Please sign in to comment.