Skip to content

CI

CI #63

Workflow file for this run

# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
---
# Terraform Provider testing workflow.
name: CI
# This GitHub action runs your tests for each pull request.
# Optionally, you can turn it on using a schedule for regular testing.
on:
push:
branches:
- main
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- ready_for_review
merge_group:
# schedule:
# - cron: "0 2 * * *"
workflow_dispatch:
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CLI_VERSION: ${{ github.sha }}
jobs:
build:
name: πŸ—οΈ Build
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
steps:
- name: ‡️ Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: 🚧 Setup Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version-file: go.mod
cache: true
- name: 🚧 Setup Task
uses: go-task/setup-task@0ab1b2a65bc55236a3bc64cde78f80e20e8885c2 # v1.0.0
- name: πŸ”€ Get dependencies
run: task deps:download
- name: πŸ”¨ Setup Build tools
run: task go:install:goreleaser
- name: πŸ—οΈ Build
run: task build
test:
name: πŸ§ͺ Unit Tests
runs-on: ubuntu-24.04
timeout-minutes: 20
permissions:
contents: read
pull-requests: read
checks: write
steps:
- name: ‡️ Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: 🚧 Setup Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version-file: go.mod
cache: true
- name: 🚧 Setup Task
uses: go-task/setup-task@0ab1b2a65bc55236a3bc64cde78f80e20e8885c2 # v1.0.0
- name: πŸ”€ Download Go dependencies
run: task deps:download
- name: πŸ”¨ Setup Test tools
run: task go:tools:test
- name: πŸ§ͺ Run Tests
run: task testunit
- name: πŸ“€ Upload unit test results
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: ${{ format('{0}-test-results', env.CLI_VERSION) }}
path: testresults.json
if-no-files-found: warn
overwrite: true
- name: πŸ“€ Upload unit test coverage results
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: ${{ format('{0}-test-coverage-results', env.CLI_VERSION) }}
path: |
coverage.html
coverage.json
coverage.out
coverage.txt
coverage.xml
if-no-files-found: warn
overwrite: true
- name: πŸ“’ Publish unit test results
if: github.ref == 'refs/heads/main' || github.event.pull_request.head.repo.full_name == github.repository
uses: dorny/test-reporter@fe45e9537387dac839af0d33ba56eed8e24189e8 # v2.3.0
with:
name: πŸ“œ Test results
reporter: golang-json
path: testresults.json
token: ${{ github.token }}
- name: βš™οΈ Get unit Coverage summary
if: always()
uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # v1.3.0
with:
filename: coverage.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: false
indicators: true
output: both
thresholds: 30 60
- name: πŸ“€ Upload unit Coverage summary
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: ${{ format('{0}-test-coverage-summary', env.CLI_VERSION) }}
path: |
code-coverage-results.md
if-no-files-found: warn
overwrite: true