Skip to content

Merge pull request #84 from cloudsigma/feat/migrate-license-datasource #53

Merge pull request #84 from cloudsigma/feat/migrate-license-datasource

Merge pull request #84 from cloudsigma/feat/migrate-license-datasource #53

Workflow file for this run

name: Tests
on:
pull_request:
paths-ignore:
- "CHANGELOG.md"
- "README.md"
push:
branches: [main]
paths-ignore:
- "CHANGELOG.md"
- "README.md"
permissions:
contents: read
jobs:
build:
name: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Build provider
run: make build
unit-tests:
name: unit tests
runs-on: ubuntu-latest
needs: build
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Fix permissions for cache directories
run: |
chmod -R 0755 ~/.cache/go-build ~/go/pkg/mod || true
- name: Set up cache
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum', 'tools/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Install tools
run: make tools
- name: Lint source code
run: make lint
- name: Run unit tests
run: make test
acceptance-tests:
name: acceptance tests (terraform ${{ matrix.terraform-version }})
runs-on: ubuntu-latest
needs: build
timeout-minutes: 30
env:
CLOUDSIGMA_USERNAME: ${{ secrets.CLOUDSIGMA_USERNAME }}
CLOUDSIGMA_PASSWORD: ${{ secrets.CLOUDSIGMA_PASSWORD }}
CLOUDSIGMA_LOCATION: ${{ secrets.CLOUDSIGMA_LOCATION }}
strategy:
fail-fast: false
max-parallel: 1
matrix:
terraform-version:
- "1.7.*"
- "1.8.*"
- "1.9.*"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.terraform-version }}
terraform_wrapper: false
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Fix permissions for cache directories
run: |
chmod -R 0755 ~/.cache/go-build ~/go/pkg/mod || true
- name: Set up cache
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum', 'tools/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Install tools
run: make tools
- name: Run acceptance tests
run: make testacc
sweeper:
name: sweeper cleanup
runs-on: ubuntu-latest
needs: acceptance-tests
timeout-minutes: 15
env:
CLOUDSIGMA_USERNAME: ${{ secrets.CLOUDSIGMA_USERNAME }}
CLOUDSIGMA_PASSWORD: ${{ secrets.CLOUDSIGMA_PASSWORD }}
CLOUDSIGMA_LOCATION: ${{ secrets.CLOUDSIGMA_LOCATION }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Fix permissions for cache directories
run: |
chmod -R 0755 ~/.cache/go-build ~/go/pkg/mod || true
- name: Set up cache
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum', 'tools/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Run sweeper cleanup
run: make sweep
docs:
name: documentation
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Fix permissions for cache directories
run: |
chmod -R 0755 ~/.cache/go-build ~/go/pkg/mod || true
- name: Set up cache
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum', 'tools/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Install tools
run: make tools
- name: Validate provider docs
run: |
make docs
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference after code generation. Run 'make docs' and commit."; exit 1)