makefile: Switch to using buildx to build images #206
Workflow file for this run
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
name: Kubectl trace build and tests | |
on: [push, pull_request] | |
jobs: | |
build_and_test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-18.04, ubuntu-latest] | |
env: | |
- TEST_KUBERNETES_BACKEND: minikube | |
- TEST_KUBERNETES_BACKEND: kind | |
steps: | |
- uses: actions/checkout@v2 | |
- run: git fetch --prune --unshallow # We want tags | |
- name: Initialize workflow variables | |
id: vars | |
shell: bash | |
run: | | |
if [ -n "${QUAY_TOKEN}" ];then | |
echo "Quay token is set, will push an image" | |
echo ::set-output name=QUAY_PUBLISH::true | |
else | |
echo "Quay token not set, skipping image push" | |
fi | |
git_org=$(dirname ${{ github.repository }}) | |
echo GIT_ORG=${git_org} >> $GITHUB_ENV | |
env: | |
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} | |
- name: Run tests | |
run: | | |
make test | |
- name: Build kubectl trace binary | |
run: | | |
make _output/bin/kubectl-trace | |
- name: Build docker images | |
run: | | |
if [[ "${{ github.ref }}" == refs/heads/* ]];then | |
./build/scripts/ci-build-image.sh ${{ github.ref }} | |
else | |
./build/scripts/ci-build-image.sh ${{ github.head_ref }} | |
fi | |
- name: Install minikube | |
env: ${{matrix.env}} | |
if: ${{ env.TEST_KUBERNETES_BACKEND == 'minikube' }} | |
run: | | |
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 | |
sudo install minikube-linux-amd64 /usr/local/bin/minikube | |
- name: Run integration tests | |
env: ${{matrix.env}} | |
run: | | |
sudo sysctl net/netfilter/nf_conntrack_max=131072 # https://github.com/kubernetes-sigs/kind/issues/2240 | |
make integration | |
# - name: Debug failure over SSH | |
# if: ${{ failure() }} | |
# uses: mxschmitt/action-tmate@v3 | |
- name: Build cross binaries | |
if: github.ref == 'refs/heads/master' | |
run: | | |
go install github.com/goreleaser/goreleaser@latest | |
make cross | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: ${{ matrix.os }}-kubectl-trace-dist | |
path: _output/bin/kubectl-trace | |
- uses: actions/upload-artifact@v1 | |
if: github.ref == 'refs/heads/master' | |
with: | |
name: ${{ matrix.os }}-kubectl-trace-cross-dist | |
path: dist | |
- name: Upload docker image | |
if: > | |
steps.vars.outputs.QUAY_PUBLISH | |
env: | |
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} | |
run: | | |
git status --porcelain --untracked-files=no | |
git reset --hard | |
git clean -f -d | |
if [[ "${{ github.ref }}" == refs/heads/* ]];then | |
./build/scripts/ci-release-image.sh ${{ github.ref }} | |
else | |
./build/scripts/ci-release-image.sh ${{ github.head_ref }} | |
fi |