Skip to content

Commit

Permalink
feat: add-gateway-build-to-the-ci
Browse files Browse the repository at this point in the history
feat: add gw build to the ci
ACDC-124
  • Loading branch information
regislegrand committed Sep 16, 2021
1 parent 772385a commit 5bd7f89
Showing 1 changed file with 102 additions and 0 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/build-gateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: build gateway

on:
push:
branches:
- 'main'
pull_request:
branches:
- main

jobs:
code_gw_change:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v3.4.0
with:
github_token: ${{ github.token }}
paths: '["code/gateway/**"]'
cancel_others: 'true'
do_not_skip: '["push", "workflow_dispatch"]'
docker_image:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install xmllint
run: sudo apt-get install libxml2-utils
- id: skip_check
run: |
if [[ $GITHUB_REF == refs/pull/* ]]; then
GW_EXISTS=false
else
pushd code
GW_EXISTS=$(make -s check-gw-image)
popd
fi
echo ::set-output name=should_skip::${GW_EXISTS}
build-gw:
needs:
- code_gw_change
- docker_image
if: ${{ needs.code_gw_change.outputs.should_skip != 'true' && needs.docker_image.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Install xmllint
run: sudo apt-get install libxml2-utils
-
name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: '16'
-
name: Prepare
id: prep
run: |
PUSH=FALSE
if [[ $GITHUB_REF == refs/heads/* ]]; then
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
if [ "${{ github.event.repository.default_branch }}" = "$BRANCH_NAME" ]; then
PUSH=TRUE
fi
elif [[ $GITHUB_REF == refs/pull/* ]]; then
BRANCH_NAME=$(echo ${{ github.event.pull_request.head.ref }} | sed -r 's#/+#-#g')
if [[ $BRANCH_NAME == release-* ]]; then
PUSH=TRUE
SUFFIX=rc
else
SUFFIX=pr-${{ github.event.number }}
fi
fi
echo ::set-output name=push::${PUSH}
echo ::set-output name=suffix::${SUFFIX}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
if: ${{ steps.prep.outputs.push == 'true' }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
run: |
cd code
make build-gw SUFFIX=${{ steps.prep.outputs.suffix }} PUBLISH=${{ steps.prep.outputs.push }}

0 comments on commit 5bd7f89

Please sign in to comment.