Skip to content

atlasaction: added summary to migrate-lint #146

atlasaction: added summary to migrate-lint

atlasaction: added summary to migrate-lint #146

Workflow file for this run

name: Go Continuous Integration
on:
push:
branches:
- master
pull_request:
workflow_call:
jobs:
shim:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'npm'
- name: Install
run: |
npm i
npm i -g @vercel/ncc
npm run shim
- name: verify no git diff
run: |
status=$(git status --porcelain)
if [ -n "$status" ]; then
echo "you need to run 'npm run shim' and commit the changes"
echo "$status"
exit 1
fi
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Run Go linters
uses: golangci/golangci-lint-action@v3
with:
args: --verbose --timeout=5m
skip-pkg-cache: true
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: ariga/setup-atlas@v0
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Run tests
run: go test -race ./...
integration-test:
runs-on: ubuntu-latest
steps:
- uses: ariga/setup-atlas@v0
with:
cloud-token: ${{ secrets.INTEGRATION_ATLAS_CLOUD_TOKEN }}
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- run: go install ./cmd/atlas-action
- uses: ./migrate/apply
with:
dir: file://atlasaction/testdata/migrations
url: sqlite://file.db?mode=memory
- uses: ./migrate/push
id: push_action
with:
dir: file://atlasaction/testdata/migrations
dir-name: test-dir
dev-url: sqlite://file.db?mode=memory
- name: "Verify migrate/push output"
shell: bash
run: |
# Verifies that the output we got is a URL as expected
[[ "${{ steps.push_action.outputs.url }}" =~ ^https://[a-zA-Z-]*\.atlasgo\.[a-zA-Z-]*/.*$ ]]
- id: lint_success
uses: ./migrate/lint
with:
dir: file://atlasaction/testdata/migrations
dev-url: sqlite://file.db?mode=memory
dir-name: test-dir
- id: lint_failure
uses: ./migrate/lint
continue-on-error: true
with:
dir: file://atlasaction/testdata/migrations_destructive
dev-url: sqlite://file.db?mode=memory
dir-name: test-dir
- id: check-lint-failure
if: steps.lint_failure.outcome == 'success'
uses: actions/github-script@v3
with:
script: |
core.setFailed('lint did not when it was supposed to')
- name: "Verify migrate/lint output"
shell: bash
run: |
# Verifies that the output we got for lint tests are URLs as expected
[[ "${{ steps.lint_success.outputs.report-url }}" =~ ^https://[a-zA-Z-]*\.atlasgo\.[a-zA-Z-]*/.*$ ]]
[[ "${{ steps.lint_failure.outputs.report-url }}" =~ ^https://[a-zA-Z-]*\.atlasgo\.[a-zA-Z-]*/.*$ ]]