Bump the ci group across 1 directory with 2 updates #832
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
GO_VERSION: 1.23.x | |
TERRAFORM_VERSION: 1.8.* | |
jobs: | |
# Ensure project builds before running testing matrix | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version: "${{env.GO_VERSION}}" | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 | |
with: | |
terraform_version: "${{env.TERRAFORM_VERSION}}" | |
terraform_wrapper: false | |
- name: Install tools | |
run: make tools | |
- name: Build | |
run: make build | |
- name: Generate docs | |
run: make docs | |
- name: Check if working tree is dirty | |
run: | | |
if [[ $(git diff --stat) != '' ]]; then | |
git diff | |
echo "run 'make build docs' and commit changes" | |
exit 1 | |
fi | |
# Run acceptance tests in a matrix with Terraform CLI versions | |
test: | |
name: Terraform Provider Acceptance Tests | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
terraform: | |
- '1.7.*' | |
- '1.8.*' | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version: "${{env.GO_VERSION}}" | |
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 | |
with: | |
terraform_version: ${{ matrix.terraform }} | |
terraform_wrapper: false | |
- name: Run tests | |
run: make testacc | |
e2e-flux-bootstrap-with-github: | |
runs-on: ubuntu-latest | |
needs: build | |
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version: "${{env.GO_VERSION}}" | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- name: Setup Flux CLI | |
uses: fluxcd/flux2/action@896e0fa46d5107a05e953dd0a5261d78a145ec8c # v2.3.0 | |
- name: Set outputs | |
id: vars | |
run: | | |
REPOSITORY_NAME=${{ github.event.repository.name }} | |
BRANCH_NAME=${GITHUB_REF##*/} | |
COMMIT_SHA=$(git rev-parse HEAD) | |
PSEUDO_RAND_SUFFIX=$(echo "${BRANCH_NAME}-${COMMIT_SHA}" | shasum | awk '{print $1}') | |
TEST_REPO_NAME="${REPOSITORY_NAME}-${PSEUDO_RAND_SUFFIX}" | |
echo "test_repo_name=$TEST_REPO_NAME" >> $GITHUB_OUTPUT | |
- name: Install Terraform | |
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 | |
with: | |
terraform_version: "${{env.TERRAFORM_VERSION}}" | |
terraform_wrapper: false | |
- name: Build provider | |
run: | | |
make build | |
make terraformrc | |
trc="${PWD}/.terraformrc" | |
echo "TF_CLI_CONFIG_FILE=${trc}" >> "$GITHUB_ENV" | |
- name: Apply Terraform | |
run: | | |
cd examples/github-via-ssh | |
terraform init | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Health check Flux | |
run: | | |
flux check | |
flux get all | |
- name: No-op apply Terraform | |
run: | | |
cd examples/github-via-ssh | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Teardown Flux | |
run: | | |
flux uninstall -s --keep-namespace | |
kubectl delete ns flux-system | |
- name: Restore Flux with Terraform | |
run: | | |
cd examples/github-via-ssh | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: No-op apply Terraform | |
run: | | |
cd examples/github-via-ssh | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Destroy Terraform | |
run: | | |
cd examples/github-via-ssh | |
terraform destroy -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Delete repository | |
if: ${{ always() }} | |
continue-on-error: true | |
run: | | |
gh repo delete fluxcd-testing/${{ steps.vars.outputs.test_repo_name }} --yes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
e2e-helm-install-with-github: | |
runs-on: ubuntu-latest | |
needs: build | |
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version: "${{env.GO_VERSION}}" | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- name: Setup Flux CLI | |
uses: fluxcd/flux2/action@896e0fa46d5107a05e953dd0a5261d78a145ec8c # v2.3.0 | |
- name: Set outputs | |
id: vars | |
run: | | |
REPOSITORY_NAME=${{ github.event.repository.name }} | |
BRANCH_NAME=${GITHUB_REF##*/} | |
COMMIT_SHA=$(git rev-parse HEAD) | |
PSEUDO_RAND_SUFFIX=$(echo "${BRANCH_NAME}-${COMMIT_SHA}" | shasum | awk '{print $1}') | |
TEST_REPO_NAME="${REPOSITORY_NAME}-${PSEUDO_RAND_SUFFIX}-helm-install" | |
echo "test_repo_name=$TEST_REPO_NAME" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Install Terraform | |
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 | |
with: | |
terraform_version: "${{env.TERRAFORM_VERSION}}" | |
terraform_wrapper: false | |
- name: Apply Terraform | |
run: | | |
cd examples/helm-install | |
terraform init | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Health check Flux | |
run: flux check | |
- name: Destroy Terraform | |
run: | | |
cd examples/helm-install | |
terraform destroy -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Delete repository | |
if: ${{ always() }} | |
continue-on-error: true | |
run: | | |
gh repo delete fluxcd-testing/${{ steps.vars.outputs.test_repo_name }} --yes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
e2e-flux-bootstrap-with-github-pat: | |
runs-on: ubuntu-latest | |
needs: build | |
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version: "${{env.GO_VERSION}}" | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- name: Setup Flux CLI | |
uses: fluxcd/flux2/action@896e0fa46d5107a05e953dd0a5261d78a145ec8c # v2.3.0 | |
- name: Set outputs | |
id: vars | |
run: | | |
REPOSITORY_NAME=${{ github.event.repository.name }} | |
BRANCH_NAME=${GITHUB_REF##*/} | |
COMMIT_SHA=$(git rev-parse HEAD) | |
PSEUDO_RAND_SUFFIX=$(echo "${BRANCH_NAME}-${COMMIT_SHA}" | shasum | awk '{print $1}') | |
TEST_REPO_NAME="${REPOSITORY_NAME}-${PSEUDO_RAND_SUFFIX}-using-pat" | |
echo "test_repo_name=$TEST_REPO_NAME" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Install Terraform | |
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 | |
with: | |
terraform_version: "${{env.TERRAFORM_VERSION}}" | |
terraform_wrapper: false | |
- name: Build provider | |
run: | | |
make build | |
make terraformrc | |
trc="${PWD}/.terraformrc" | |
echo "TF_CLI_CONFIG_FILE=${trc}" >> "$GITHUB_ENV" | |
- name: Apply Terraform | |
run: | | |
cd examples/github-via-pat | |
terraform init | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Health check Flux | |
run: flux check | |
- name: Destroy Terraform | |
run: | | |
cd examples/github-via-pat | |
terraform destroy -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Delete repository | |
if: ${{ always() }} | |
continue-on-error: true | |
run: | | |
gh repo delete fluxcd-testing/${{ steps.vars.outputs.test_repo_name }} --yes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} |