Skip to content

feat: v5

feat: v5 #1353

Workflow file for this run

---
name: Unit test
on:
pull_request:
types: ['opened', 'reopened', 'synchronize', 'labeled']
merge_group:
workflow_dispatch:
inputs:
test_filter:
type: string
default: ''
description: Filter for the tests to run
required: false
terratest_log:
type: string
default: ''
description: Enable Terratest logging
required: false
permissions:
contents: read
pull-requests: read
id-token: write
actions: read
checks: read
deployments: read
concurrency:
group: unittest-${{ github.event.pull_request.head.repo.full_name }}/${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
unittest:
name: Unit test
runs-on: ubuntu-latest
environment: CSUTF-RO
if: |
(
github.event.pull_request.head.repo.full_name == 'Azure/terraform-azurerm-lz-vending'
)
||
(
github.event_name == 'workflow_dispatch'
)
||
(
github.event_name == 'merge_group'
)
strategy:
fail-fast: false
matrix:
azapi_version: ['latest', '2.2.0']
azurerm_version: ['latest', '4.0.0']
terraform_version: ['latest', '1.8.0']
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: ${{ matrix.terraform_version }}
terraform_wrapper: false
- name: Setup go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version-file: tests/go.mod
cache-dependency-path: tests/go.sum
- name: Set GOMAXPROCS to 2 * number of cores
run: |
CORES="$(grep -Pc '^processor\t' /proc/cpuinfo)"
((DOUBLE=CORES*2))
echo "Setting GOMAXPROCS to $DOUBLE"
echo "GOMAXPROCS=$DOUBLE" >> "$GITHUB_ENV"
- name: Go test
run: make TESTARGS='-v' TESTFILTER='${{ github.event.inputs.test_filter }}' test
env:
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
ARM_USE_OIDC: true
AZAPI_VERSION: ${{ matrix.azapi_version }}
AZURERM_VERSION: ${{ matrix.azurerm_version }}
TERRATEST_LOG: ${{ github.event.inputs.terratest_log }}