chore: added integration tests #392
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: Continuous Integration | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
permissions: | |
# Permission for checking out code | |
contents: read | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: '1.21' | |
- name: Run linters | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
args: --verbose | |
- name: Generate docs | |
run: go generate | |
- name: Check generated files | |
run: | | |
status=$(git status --porcelain) | |
if [ -n "$status" ]; then | |
echo "you need to run 'go generate' and commit the changes" | |
echo "$status" | |
exit 1 | |
fi | |
acceptance: | |
name: Acceptance Tests (Terraform ${{ matrix.terraform-version }}) | |
runs-on: ubuntu-latest | |
services: | |
mysql8prod: | |
image: mysql:8 | |
env: | |
MYSQL_DATABASE: test | |
MYSQL_ROOT_PASSWORD: pass | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd "mysqladmin ping -ppass" | |
--health-interval 10s | |
--health-start-period 10s | |
--health-timeout 5s | |
--health-retries 10 | |
mysql8dev: | |
image: mysql:8 | |
env: | |
MYSQL_DATABASE: test | |
MYSQL_ROOT_PASSWORD: pass | |
ports: | |
- 3307:3306 | |
options: >- | |
--health-cmd "mysqladmin ping -ppass" | |
--health-interval 10s | |
--health-start-period 10s | |
--health-timeout 5s | |
--health-retries 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
terraform-version: | |
- '1.2.*' | |
- '1.3.*' | |
- '1.4.*' | |
- '1.5.*' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: '1.21' | |
- uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: ${{ matrix.terraform-version }} | |
terraform_wrapper: false | |
- name: Install Atlas-CLI | |
run: | | |
curl -s -A "Terraform-Provider-CI" -o /usr/local/bin/atlas \ | |
https://release.ariga.io/atlas/atlas-linux-amd64-latest?test=1 | |
chmod +x /usr/local/bin/atlas | |
- run: go test -v -cover ./... | |
env: | |
TF_ACC: '1' | |
foo: | |
name: Foo (Terraform ${{ matrix.terraform-version }}) | |
runs-on: ubuntu-latest | |
services: | |
mysql8prod: | |
image: mysql:8 | |
env: | |
MYSQL_DATABASE: test | |
MYSQL_ROOT_PASSWORD: pass | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd "mysqladmin ping -ppass" | |
--health-interval 10s | |
--health-start-period 10s | |
--health-timeout 5s | |
--health-retries 10 | |
mysql8dev: | |
image: mysql:8 | |
env: | |
MYSQL_DATABASE: test | |
MYSQL_ROOT_PASSWORD: pass | |
ports: | |
- 3307:3306 | |
options: >- | |
--health-cmd "mysqladmin ping -ppass" | |
--health-interval 10s | |
--health-start-period 10s | |
--health-timeout 5s | |
--health-retries 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
terraform-version: | |
- '1.2.*' | |
- '1.3.*' | |
- '1.4.*' | |
- '1.5.*' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: '1.21' | |
- uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: ${{ matrix.terraform-version }} | |
terraform_wrapper: false | |
- name: Run GoReleaser | |
id: goreleaser | |
uses: goreleaser/[email protected] | |
with: | |
version: latest | |
args: build --single-target --skip=validate --clean | |
env: | |
GORELEASER_CURRENT_TAG: v0.0.0 | |
- name: Create Terraform config | |
run: | | |
echo "provider_installation { \ | |
filesystem_mirror { | |
path = \"$(pwd)/dist/terraform-provider-atlas_$(go env GOOS)_$(go env GOARCH)\" | |
include = [\"registry.terraform.io/ariga/atlas\"] | |
} | |
direct { | |
include = [\"registry.terraform.io/*/*\"] | |
} | |
}" > ~/.terraformrc | |
cat ~/.terraformrc |