mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-06-30 18:42:58 +00:00
95 lines
2.5 KiB
YAML
95 lines
2.5 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
pull_request: {}
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 5
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Filter paths
|
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
go:
|
|
- '**/*.go'
|
|
|
|
- name: Setup Go
|
|
if: ${{ steps.filter.outputs.go == 'true' }}
|
|
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
|
|
with:
|
|
go-version-file: "go.mod"
|
|
cache-dependency-path: "**/*.sum"
|
|
|
|
- name: Get dependencies
|
|
if: ${{ steps.filter.outputs.go == 'true' }}
|
|
run: go mod download
|
|
|
|
- name: Build
|
|
if: ${{ steps.filter.outputs.go == 'true' }}
|
|
run: go vet . && go build -v .
|
|
|
|
test:
|
|
name: Unit Tests
|
|
needs: build
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Dump GitHub context
|
|
env:
|
|
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
run: echo "$GITHUB_CONTEXT"
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Filter paths
|
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
go:
|
|
- '**/*.go'
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
|
|
with:
|
|
go-version-file: "go.mod"
|
|
cache-dependency-path: "**/*.sum"
|
|
|
|
- name: Get dependencies
|
|
if: ${{ steps.filter.outputs.go == 'true' }}
|
|
run: go mod download
|
|
|
|
- name: Set up gotestfmt
|
|
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
|
|
|
|
- name: Unit tests
|
|
if: ${{ steps.filter.outputs.go == 'true' }}
|
|
timeout-minutes: 10
|
|
run: go test -json -v ./... 2>&1 | tee /tmp/gotest.log | gotestfmt -hide empty-packages
|
|
|
|
- name: Upload test log
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
if: ${{ steps.filter.outputs.go == 'true' }}
|
|
with:
|
|
name: test-log
|
|
path: /tmp/gotest.log
|
|
|
|
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3
|
|
|
|
- name: Check for uncommitted changes in generated docs
|
|
run: make docs && git diff --exit-code
|