Skip to content

ci: fix goreleaser not being found #218

ci: fix goreleaser not being found

ci: fix goreleaser not being found #218

Workflow file for this run

name: Kubectl trace build and tests
on: [push, pull_request]
jobs:
build_and_test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-latest]
env:
- TEST_KUBERNETES_BACKEND: minikube
- TEST_KUBERNETES_BACKEND: kind
steps:
- uses: actions/checkout@v4
- 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: Fetch Tags
run: |
git fetch --prune --unshallow
if [[ "$GIT_ORG" != iovisor ]]; then
git remote add upstream https://github.com/iovisor/kubectl-trace.git
git fetch upstream --tags
fi
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '>=1.19.0'
- 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/v1.31.2/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
- name: Run integration tests
env: ${{matrix.env}}
run: |
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