mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-24 23:10:41 +02:00
github.head_ref is empty on tag pushes and manual runs (every run then shares one group and cancels the last) and collides across forks when two PRs share a branch name. pull_request.number is unique per PR; github.ref covers push/tag/dispatch. Applied to all workflows using the pattern, including pre-existing ones. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
85 lines
2.2 KiB
YAML
85 lines
2.2 KiB
YAML
name: "terraform: validate and test modules"
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
paths: ['terraform/**', '.github/workflows/terraform_ci.yml']
|
|
pull_request:
|
|
branches: [ master ]
|
|
paths: ['terraform/**', '.github/workflows/terraform_ci.yml']
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
validate:
|
|
name: fmt, validate, plan-level tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Set up OpenTofu
|
|
uses: opentofu/setup-opentofu@v2
|
|
with:
|
|
tofu_version: 1.12.1
|
|
|
|
- name: fmt check
|
|
working-directory: terraform
|
|
run: tofu fmt -recursive -check -diff
|
|
|
|
- name: validate core
|
|
working-directory: terraform/modules/core
|
|
run: |
|
|
tofu init -backend=false -input=false
|
|
tofu validate
|
|
|
|
- name: validate security
|
|
working-directory: terraform/modules/security
|
|
run: |
|
|
tofu init -backend=false -input=false
|
|
tofu validate
|
|
|
|
- name: plan-level tests (core)
|
|
working-directory: terraform/modules/core
|
|
run: tofu test
|
|
|
|
- name: validate examples
|
|
run: |
|
|
set -e
|
|
for ex in terraform/examples/*/; do
|
|
echo "== validate $ex =="
|
|
tofu -chdir="$ex" init -backend=false -input=false
|
|
tofu -chdir="$ex" validate
|
|
done
|
|
|
|
smoke:
|
|
name: local cluster smoke test (real weed)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v7
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Build weed
|
|
run: go build -o "$RUNNER_TEMP/weed" ./weed
|
|
|
|
- name: Set up OpenTofu
|
|
uses: opentofu/setup-opentofu@v2
|
|
with:
|
|
tofu_version: 1.12.1
|
|
|
|
- name: Run local cluster harness
|
|
working-directory: terraform/test/local
|
|
run: WEED="$RUNNER_TEMP/weed" ./run_local_cluster.sh
|
|
|
|
- name: Run local mTLS cluster harness
|
|
working-directory: terraform/test/local-secure
|
|
run: WEED="$RUNNER_TEMP/weed" ./run_local_secure.sh
|