doc: copy readme from ariga/atlas repo #667
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@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: './go.mod' | |
- 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.5.*' | |
- '1.6.*' | |
- '1.7.*' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: './go.mod' | |
- 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 -sSf https://atlasgo.sh | sh | |
env: | |
ATLAS_DEBUG: "true" | |
ATLAS_FLAVOR: enterprise | |
- run: go test -v -cover ./... | |
env: | |
TF_ACC: '1' | |
build-dev: | |
name: Build provider bundles | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: './go.mod' | |
- uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
version: latest | |
args: release --clean --skip=validate,publish,sign | |
env: | |
GORELEASER_CURRENT_TAG: v0.0.0-pre.0 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: atlas-provider | |
path: ./dist/terraform-provider-atlas_0.0.0-pre.0_linux_amd64.zip | |
retention-days: 5 | |
if-no-files-found: error | |
integration: | |
name: Integration SQLite (Terraform ${{ matrix.terraform-version }}) | |
runs-on: ubuntu-latest | |
needs: [build-dev] | |
strategy: | |
fail-fast: false | |
matrix: | |
terraform-version: | |
- '1.5.*' | |
- '1.6.*' | |
- '1.7.*' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: './go.mod' | |
- uses: actions/download-artifact@v3 | |
with: | |
name: atlas-provider | |
path: ./dist | |
- uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: ${{ matrix.terraform-version }} | |
terraform_wrapper: false | |
- name: Install Atlas CLI | |
run: | | |
curl -sSf https://atlasgo.sh | sh | |
env: | |
ATLAS_DEBUG: "true" | |
ATLAS_FLAVOR: enterprise | |
- name: Terraform (sqlite) | |
working-directory: integration-tests/sqlite | |
run: | | |
../../scripts/local.sh ../../dist 0.0.0-pre.0 | |
terraform init | |
echo "Apply terraform plan" | |
terraform apply -no-color --auto-approve > stdout.txt | |
cat stdout.txt | grep --silent "Apply complete! Resources: 1 added, 0 changed, 0 destroyed." | |
echo "Ensure that there is no diff" | |
terraform plan -no-color > stdout.txt | |
cat stdout.txt | grep --silent "No changes. Your infrastructure matches the configuration." | |
- name: Terraform (no-dev-url) | |
working-directory: integration-tests/no-dev-url | |
run: | | |
../../scripts/local.sh ../../dist 0.0.0-pre.0 | |
terraform init > /dev/null | |
terraform plan -no-color | grep --silent "Warning: dev_url is unset" | |
- name: Terraform (no-version) | |
working-directory: integration-tests/no-version | |
run: | | |
../../scripts/local.sh ../../dist 0.0.0-pre.0 | |
terraform init > /dev/null | |
terraform plan -no-color | grep --silent "Warning: version is unset" | |
- name: Terraform (remote_dir) | |
working-directory: integration-tests/remote-dir | |
run: | | |
../../scripts/local.sh ../../dist 0.0.0-pre.0 | |
terraform init > /dev/null | |
terraform plan -no-color > stdout.txt | |
cat stdout.txt | grep --silent "Plan: 1 to add, 0 to change, 0 to destroy." | |
! cat stdout.txt | grep --silent "Warning: dev_url is unset" | |
! cat stdout.txt | grep --silent "Warning: version is unset" | |
env: | |
TF_VAR_atlas_token: ${{ secrets.ATLAS_TOKEN }} | |
integration-mysql: | |
name: Integration MySQL (Terraform ${{ matrix.terraform-version }}) | |
runs-on: ubuntu-latest | |
needs: [build-dev] | |
services: | |
mysql8prod: | |
image: mysql:8 | |
env: | |
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_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.5.*' | |
- '1.6.*' | |
- '1.7.*' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: './go.mod' | |
- uses: actions/download-artifact@v3 | |
with: | |
name: atlas-provider | |
path: ./dist | |
- uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: ${{ matrix.terraform-version }} | |
terraform_wrapper: false | |
- name: Install Atlas CLI | |
run: | | |
curl -sSf https://atlasgo.sh | sh | |
env: | |
ATLAS_DEBUG: "true" | |
ATLAS_FLAVOR: enterprise | |
- name: Terraform (skip-policy) | |
working-directory: integration-tests/skip-policy | |
run: | | |
../../scripts/local.sh ../../dist 0.0.0-pre.0 | |
terraform init > /dev/null | |
terraform apply --auto-approve | |
terraform plan -no-color -var schema="schema-t2" > stdout.txt | |
cat stdout.txt | grep --silent "Plan: 0 to add, 1 to change, 0 to destroy." | |
cat stdout.txt | grep --silent "DROP TABLE \`test\`.\`t2\`" | |
terraform plan -no-color -var schema="schema-t2" \ | |
-var "skip_drop_table=true" > stdout.txt | |
cat stdout.txt | grep --silent "Plan: 0 to add, 1 to change, 0 to destroy." | |
# Expect no drop table statement in the plan | |
! cat stdout.txt | grep --silent "DROP TABLE \`test\`.\`t2\`" | |
terraform apply --auto-approve -no-color -var="schema=schema-t2" -var="skip_drop_table=true" | |
# Confirm that the table was not dropped | |
atlas schema inspect \ | |
-u "mysql://root:pass@localhost:3306/" > actual.hcl | |
cmp -s "expected.hcl" "actual.hcl" | |
integration-postgres: | |
name: Integration PostgreSQL (Terraform ${{ matrix.terraform-version }}) | |
runs-on: ubuntu-latest | |
needs: [build-dev] | |
services: | |
postgres15: | |
image: postgres:15 | |
env: | |
POSTGRES_DB: test | |
POSTGRES_PASSWORD: pass | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
postgres15-dev: | |
image: postgres:15 | |
env: | |
POSTGRES_DB: test | |
POSTGRES_PASSWORD: pass | |
ports: | |
- 5433:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
strategy: | |
fail-fast: false | |
matrix: | |
terraform-version: | |
- '1.5.*' | |
- '1.6.*' | |
- '1.7.*' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: './go.mod' | |
- uses: actions/download-artifact@v3 | |
with: | |
name: atlas-provider | |
path: ./dist | |
- uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: ${{ matrix.terraform-version }} | |
terraform_wrapper: false | |
- name: Install Atlas CLI | |
run: | | |
curl -sSf https://atlasgo.sh | sh | |
env: | |
ATLAS_DEBUG: "true" | |
ATLAS_FLAVOR: enterprise | |
- name: Terraform (concurrent_index-policy) | |
working-directory: integration-tests/concurrent_index-policy | |
run: | | |
../../scripts/local.sh ../../dist 0.0.0-pre.0 | |
terraform init > /dev/null | |
terraform apply --auto-approve | |
terraform apply --auto-approve -var="schema=schema-2.hcl" | |
integration-sqlserver: | |
name: Integration SQL Server (Terraform ${{ matrix.terraform-version }}) | |
runs-on: ubuntu-latest | |
needs: [build-dev] | |
services: | |
sqlserver: | |
image: mcr.microsoft.com/mssql/server:2022-latest | |
env: | |
ACCEPT_EULA: Y | |
MSSQL_PID: Developer | |
MSSQL_SA_PASSWORD: P@ssw0rd0995 | |
ports: | |
- 1433:1433 | |
options: >- | |
--health-cmd "/opt/mssql-tools18/bin/sqlcmd -C -U sa -P \"${MSSQL_SA_PASSWORD}\" -Q \"SELECT 1\"" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
sqlserver-dev: | |
image: mcr.microsoft.com/mssql/server:2022-latest | |
env: | |
ACCEPT_EULA: Y | |
MSSQL_PID: Developer | |
MSSQL_SA_PASSWORD: P@ssw0rd0995 | |
ports: | |
- 1434:1433 | |
options: >- | |
--health-cmd "/opt/mssql-tools18/bin/sqlcmd -C -U sa -P \"${MSSQL_SA_PASSWORD}\" -Q \"SELECT 1\"" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
strategy: | |
fail-fast: false | |
matrix: | |
terraform-version: | |
- '1.5.*' | |
- '1.6.*' | |
- '1.7.*' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: './go.mod' | |
- uses: actions/download-artifact@v3 | |
with: | |
name: atlas-provider | |
path: ./dist | |
- uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: ${{ matrix.terraform-version }} | |
terraform_wrapper: false | |
- name: Install Atlas CLI | |
run: | | |
curl -sSf https://atlasgo.sh | sh | |
env: | |
ATLAS_DEBUG: "true" | |
ATLAS_FLAVOR: enterprise | |
- name: Terraform (login-feature) | |
working-directory: integration-tests/login-feature | |
run: | | |
../../scripts/local.sh ../../dist 0.0.0-pre.0 | |
terraform init > /dev/null | |
terraform apply --auto-approve | |
env: | |
TF_VAR_atlas_token : ${{ secrets.ATLAS_TOKEN }} |