Skip to content

Build

Build #681

Workflow file for this run

name: Build
on:
workflow_dispatch: {}
push:
branches:
- "main"
- "release-*"
jobs:
build_and_test:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: info
uses: konveyor/get-env-info@v1
- uses: actions/setup-go@v2
with:
go-version: ${{ steps.info.outputs.go_version }}
- name: install upx to compress binaries
run: sudo apt-get install -y upx
- run: make ci
- run: make test-coverage
- name: upload coverage
uses: codecov/codecov-action@v1
- if: failure()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: "#BD3232"
SLACK_ICON: https://github.com/actions.png?size=48
SLACK_MESSAGE: "Build and test failed for move2kube-api ${{ github.ref }}"
SLACK_TITLE: Failed
SLACK_USERNAME: GitHubActions
image_build:
needs: [build_and_test]
name: Image build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: info
uses: konveyor/get-env-info@v1
- id: image_tag
run: |
BRANCH="${GITHUB_REF#refs/heads/}"
if [ "$BRANCH" == 'main' ] ; then
echo "tag=latest" >> $GITHUB_OUTPUT
else
echo "tag=$BRANCH" >> $GITHUB_OUTPUT
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Pull latest image to reuse layers
run: |
docker pull quay.io/konveyor/move2kube-api:latest || true
docker pull quay.io/konveyor/move2kube-api-builder:latest || true
- run: echo "${{ secrets.QUAY_BOT_PASSWORD }}" | docker login --username "${{ secrets.QUAY_BOT_USERNAME }}" --password-stdin quay.io
- name: build image
run: VERSION='${{ steps.image_tag.outputs.tag }}' GO_VERSION='${{ steps.info.outputs.go_version }}' make cmultibuildpush
- name: success slack notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_ICON: https://github.com/actions.png?size=48
SLACK_MESSAGE: "Built and pushed quay.io/konveyor/move2kube-api:${{ steps.image_tag.outputs.tag }}"
SLACK_TITLE: Success
SLACK_USERNAME: GitHubActions
- if: failure()
name: failure slack notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: "#BD3232"
SLACK_ICON: https://github.com/actions.png?size=48
SLACK_MESSAGE: "Failed to build and push image quay.io/konveyor/move2kube-api:${{ steps.image_tag.outputs.tag }}"
SLACK_TITLE: Failed
SLACK_USERNAME: GitHubActions
- name: trigger move2kube-ui build
uses: actions/github-script@v3
with:
github-token: ${{ secrets.MOVE2KUBE_PATOKEN }}
script: |
const other_repo = 'move2kube-ui';
const build_workflow = 'build.yml';
await github.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: other_repo,
workflow_id: build_workflow,
ref: context.ref,
});