-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | ||
|