Skip to content

readme: deprecation notice (#10) #59

readme: deprecation notice (#10)

readme: deprecation notice (#10) #59

Workflow file for this run

name: CI (Go)
on:
push:
workflow_dispatch:
jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "1.21"
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run Go linters
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=15m --verbose --enable whitespace,gocritic,goimports,revive
skip-pkg-cache: true
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "1.21"
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: |
curl -sSf 'https://atlasgo.sh?test=1' | env ATLAS_DEBUG=true sh
- name: Run tests
run: |
go test -race ./...
integration-tests:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build
uses: docker/build-push-action@v2
with:
context: .
file: ./.github/workflows/Dockerfile
tags: local
load: true
- run: docker images
- name: sanity
id: sanity
uses: ./internal/action
with:
url: sqlite://internal/testdata/test.db
cloud-dir: deploy-action-test
cloud-token: ${{ secrets.ATLAS_CLOUD_TEST_TOKEN }}
- name: Check Error and Compare Current with Target
run: |
error_output="${{ steps.sanity.outputs.error }}"
pending_output="${{ steps.sanity.outputs.pending_count }}"
applied_output="${{ steps.sanity.outputs.applied_count }}"
# Check that the "error" output is empty
if [ -z "$error_output" ]; then
echo "No error occurred in the action."
else
echo "Error occurred: $error_output"
exit 1
fi
# Check that the "pending" output "0"
if [ "$pending_output" -eq "0" ]; then
echo "No pending migrations."
else
echo "Pending migrations: $pending_output"
exit 1
fi
# Check that the "applied" output is "0"
if [ "$applied_output" -eq "0" ]; then
echo "No migrations applied."
else
echo "Migrations applied: $applied_output"
exit 1
fi
docker:
runs-on: ubuntu-latest
needs: [golangci-lint, unit-tests, integration-tests]
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
file: ./.github/workflows/Dockerfile
tags: arigaio/atlas-deploy-action:latest