Skip to content

Basic Tests

Basic Tests #170

Workflow file for this run

name: Basic Tests
on:
workflow_call:
inputs:
go-changed:
description: "Whether Go files have changed"
required: false
type: boolean
default: true
make-changed:
description: "Whether Makefile has changed"
required: false
type: boolean
default: true
schedule:
# Run every 8 hours on the main branch to catch flakey tests
- cron: '0 */8 * * *'
jobs:
kubebuilder-diff:
name: Kubebuilder Diff
runs-on: ubuntu-latest
if: ${{ inputs.go-changed || inputs.make-changed }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- uses: ./.github/actions/nix-setup
- name: Generate manifests
run: make manifests
- name: Fail if there are uncommitted manifest changes
run: |
git diff --exit-code
git diff --cached --exit-code
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
if: ${{ inputs.go-changed || inputs.make-changed }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- uses: ./.github/actions/nix-setup
- name: Lint
run: make lint
go-mod-tidy:
name: Go Mod Tidy Check
runs-on: ubuntu-latest
if: ${{ inputs.go-changed }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- uses: ./.github/actions/nix-setup
- run: go mod tidy
- run: git diff --exit-code go.mod
- run: git diff --exit-code go.sum
go-fix:
name: Go Fix Check
runs-on: ubuntu-latest
if: ${{ inputs.go-changed }}
permissions:
contents: read
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- uses: ./.github/actions/nix-setup
- name: Run go fix
run: make go-fix
- name: Fail if there are uncommitted changes
run: git diff --exit-code
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
if: ${{ inputs.go-changed || inputs.make-changed || github.event_name == 'schedule' }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- uses: ./.github/actions/nix-setup
- name: Run unit tests
run: make test
- if: github.repository == 'ngrok/ngrok-operator'
name: Upload coverage reports to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}