tests: add Atlas migration tests #170
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: CD - Build and Publish NuGet Package | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
env: | |
# Disable the .NET logo in the console output. | |
DOTNET_NOLOGO: true | |
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build. | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
# Disable sending .NET CLI telemetry to Microsoft. | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
# Set the build number in MinVer. | |
MINVERBUILDMETADATA: build.${{ github.run_number }} | |
jobs: | |
build: | |
name: Build on Windows | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: Install .NET Core SDK | |
uses: actions/[email protected] | |
with: | |
dotnet-version: '8.0.x' | |
- name: List SDKs | |
shell: pwsh | |
run: dotnet --list-sdks | |
- name: Dotnet Tool Restore | |
shell: pwsh | |
run: dotnet tool restore | |
- name: Dotnet restore | |
shell: pwsh | |
run: dotnet restore | |
- name: Dotnet Cake CI | |
shell: pwsh | |
run: dotnet cake --target=CI | |
- name: Publish artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts | |
path: "./artifacts" | |
test-tool: | |
name: Test tool on ${{ matrix.os }} - ${{ matrix.dialect }} | |
needs: build | |
strategy: | |
matrix: | |
os: [windows-latest, macos-latest] | |
dialect: [sqlite] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: Install .NET Core SDK | |
uses: actions/[email protected] | |
with: | |
dotnet-version: | | |
6.0.x | |
8.0.x | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-artifacts | |
path: "./artifacts" | |
- name: Install AtlasEF | |
shell: pwsh | |
run: dotnet tool install --prerelease --add-source ./artifacts atlas-ef | |
- name: Print SQL from Demo project | |
shell: pwsh | |
working-directory: ./src/Atlas.Provider.Demo | |
run: dotnet atlas-ef -- sqlserver | |
- name: Install Atlas CLI (Windows) | |
shell: bash | |
if: startsWith(runner.os, 'Windows') | |
run: | | |
mkdir "${{ runner.temp }}/bin" | |
curl -fSL https://release.ariga.io/atlas/atlas-windows-amd64-latest.exe -o "${{ runner.temp }}\bin\atlas.exe" | |
echo "${{ runner.temp }}\bin" >> $GITHUB_PATH | |
- name: Install Atlas CLI (Ubuntu / MacOS) | |
shell: pwsh | |
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') | |
run: curl -sSf 'https://atlasgo.sh?test=1' | sh | |
- name: Verify Atlas CLI version | |
shell: pwsh | |
run: atlas version | |
- name: Check migrations for ${{ matrix.dialect }} | |
working-directory: ./src/Atlas.Provider.Demo | |
run: | | |
atlas migrate diff --env ef --var dialect=${{ matrix.dialect }} | |
env: | |
ATLAS_TOKEN: ${{ secrets.ATLAS_TOKEN }} | |
- name: Verify migrations generated | |
shell: bash | |
run: | | |
if git status --porcelain | grep -vq 'dotnet-tools.json' ; then | |
echo "you need to run 'atlas migrate diff --env ef' and commit the changes" | |
git --no-pager diff | |
exit 1 | |
fi |