Skip to content

Checkpoint

Checkpoint #857

Workflow file for this run

# This GitHub action runs your tests for each commit push and/or PR. Optionally
# you can turn it on using a cron schedule for regular testing.
#
name: Tests
on:
push:
paths-ignore:
- 'README.md'
# For systems with an upstream API that could drift unexpectedly (like most SaaS systems, etc.),
# we recommend testing at a regular interval not necessarily tied to code changes. This will
# ensure you are alerted to something breaking due to an API change, even if the code did not
# change.
# schedule:
# - cron: '0 13 * * *'
jobs:
# ensure the code builds...
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 15
concurrency: github
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Get dependencies
run: |
go mod download
- name: Check go style
run: |
echo "If this command fails you should run go fmt \"./...\""
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
echo "Code style differences detected:"
gofmt -s -l -d .
exit 1
fi
- name: Build
run: |
go build -o ./bin/epcc -v ./
- name: Unit Tests
timeout-minutes: 15
env:
EPCC_CLIENT_ID: ${{ secrets.EPCC_CLIENT_ID }}
EPCC_CLIENT_SECRET: ${{ secrets.EPCC_CLIENT_SECRET }}
EPCC_API_BASE_URL: ${{ vars.EPCC_API_BASE_URL }}
run: |
go test -v -cover ./cmd/ ./external/...
- name: Runbook Smoke Test
timeout-minutes: 15
env:
EPCC_CLIENT_ID: ${{ secrets.EPCC_CLIENT_ID }}
EPCC_CLIENT_SECRET: ${{ secrets.EPCC_CLIENT_SECRET }}
EPCC_API_BASE_URL: ${{ vars.EPCC_API_BASE_URL }}
run: |
export PATH=./bin/:$PATH
./external/runbooks/run-all-runbooks.sh
- name: Run GoReleaser (for Linux build and Syntax check)
uses: goreleaser/goreleaser-action@v3
env:
GOOS: linux
GOARCH: amd64
with:
version: latest
args: build --single-target --snapshot
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
name: distribution
path: dist/epcc-cli_linux_amd64
retention-days: 5