Testing #4
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: Go | |
on: | |
push: | |
branches: [master, release*] | |
pull_request: | |
branches: [] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.20' | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Get dependencies | |
run: | | |
go get -v -t -d ./... | |
- name: Go lint | |
run: | | |
make fmt | |
- name: Test | |
id: test | |
run: | | |
export GOPATH=/home/runner/go | |
export PATH=$PATH:/usr/local/kubebuilder/bin:/home/runner/go/bin | |
wget -O $GOPATH/bin/yq https://github.com/mikefarah/yq/releases/download/v4.28.1/yq_linux_amd64 | |
chmod +x $GOPATH/bin/yq | |
make test | |
./coverage.sh | |
echo ::set-output name=coverage::$(./coverage.sh | tr -s '\t' | cut -d$'\t' -f 3) | |
- name: Print coverage | |
run: | | |
echo "Coverage output is ${{ steps.test.outputs.coverage }}" | |
- name: Update coverage badge | |
# The dash at the end makes this to never run, while we set up the ODH badge. | |
if: github.ref == 'refs/heads/master-' | |
uses: schneegans/dynamic-badges-action@v1.4.0 | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 5174bd748ac63a6e4803afea902e9810 | |
filename: coverage.json | |
label: coverage | |
message: ${{ steps.test.outputs.coverage }} | |
color: green |