Skip to content

Bump actions/download-artifact from 1 to 4.1.7 in /.github/workflows #1

Bump actions/download-artifact from 1 to 4.1.7 in /.github/workflows

Bump actions/download-artifact from 1 to 4.1.7 in /.github/workflows #1

Workflow file for this run

# Name of the workflow
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request events
on:
push:
branches: [ master, release/*, feature/* ]
paths-ignore:
- '**/*.md'
pull_request:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Run the build first
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
# Install .NET Core SDK
# TOOO: Remove this workaround once https://github.com/actions/setup-dotnet/issues/25 gets fixed
- name: Setup .NET Core
uses: coderpatros/setup-dotnet@sxs
with:
dotnet-version: 2.1.808,3.1.302
# Install Nerdbank.GitVersioning
- name: install nbgv
run: dotnet tool install --tool-path . nbgv
# Set version
- name: set version
run: ./nbgv cloud -p ./src/MSBuild.Sdk.SqlProj/ --all-vars
# Build command line tool
- name: dotnet build DacpacTool
run: dotnet build ./src/DacpacTool/DacpacTool.csproj -c Release
# Run tests for command line tool
- name: dotnet test
run: dotnet test ./test/DacpacTool.Tests/DacpacTool.Tests.csproj -c Release
# Run build for SDK package
- name: dotnet build SDK
run: dotnet build ./src/MSBuild.Sdk.SqlProj/MSBuild.Sdk.SqlProj.csproj -c Release
# Ensure that test project builds
- name: dotnet build TestProject
run: dotnet build ./test/TestProject/TestProject.csproj -c Release
# Package SDK
- name: dotnet pack SDK
run: dotnet pack -c Release src/MSBuild.Sdk.SqlProj/MSBuild.Sdk.SqlProj.csproj
# Upload SDK package
- name: upload SDK
uses: actions/upload-artifact@v1
with:
name: nuget-packages
path: ./src/MSBuild.Sdk.SqlProj/bin/Release/
# Package TestProject
- name: dotnet pack TestProject
run: dotnet pack -c Release ./test/TestProject/TestProject.csproj
# Upload TestProject package
- name: upload TestProject
uses: actions/upload-artifact@v1
with:
name: nuget-packages
path: ./test/TestProject/bin/Release/
# Run tests in parallel
test:
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
os: [ "ubuntu-18.04", "macos-10.15", "windows-2019" ]
dotnet: [ '2.1.808', '3.1.302' ]
fail-fast: false
steps:
# Fetch sources
- uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
# Setup .NET SDK
- uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
# Install Nerdbank.GitVersioning
- name: install nbgv
run: dotnet tool install --tool-path . nbgv
# Set version
- name: set version
run: ./nbgv cloud -p ./src/MSBuild.Sdk.SqlProj/ --all-vars
id: nbgv
# Replace tokens
- uses: cschleiden/replace-tokens@v1
name: replace tokens
with:
files: 'test/TestProjectWithSDKRef/TestProjectWithSDKRef.csproj'
# Download artifact
- name: download-artifact
uses: actions/[email protected]
with:
name: nuget-packages
path: test/TestProjectWithSDKRef/nuget-packages
# Restore packages
- name: dotnet restore
run: dotnet restore ./test/TestProjectWithSDKRef/TestProjectWithSDKRef.csproj --verbosity n
# Build the project using exact version number
- name: build project (exact version / MSBuild resolution)
run: dotnet build ./test/TestProjectWithSDKRef/TestProjectWithSDKRef.csproj /bl /p:DependencyVersion="$Env:NBGV_NuGetPackageVersion" /warnaserror:SQL71502
shell: pwsh
# Build the project using fallback method of resolving version via path
- name: build project (exact version / path resolution)
run: dotnet build ./test/TestProjectWithSDKRef/TestProjectWithSDKRef.csproj /bl /p:DependencyVersion="$Env:NBGV_NuGetPackageVersion" /p:PkgTestProject="" /warnaserror:SQL71502
shell: pwsh
# Upload binary log
- name: upload
uses: actions/upload-artifact@v1
with:
name: binary-log-${{ matrix.os }}-${{ matrix.dotnet }}-exact-version
path: ./msbuild.binlog
# Build the project using single wildcard (i.e. 1.x.x-*)
- name: build project (single floating version)
run: dotnet build ./test/TestProjectWithSDKRef/TestProjectWithSDKRef.csproj /bl /p:DependencyVersion="${Env:NBGV_Version}-*" /warnaserror:SQL71502
shell: pwsh
# Build the project using double wildcard (i.e. 1.*-*)
- name: build project (double floating version / dotnet 3)
if: ${{ matrix.dotnet == '3.1.302' }}
run: dotnet build ./test/TestProjectWithSDKRef/TestProjectWithSDKRef.csproj /bl /p:DependencyVersion="1.*-*" /warnaserror:SQL71502
shell: pwsh
# Upload dacpac
- name: upload
uses: actions/upload-artifact@v1
with:
name: dacpac-package
path: ./test/TestProjectWithSDKRef/bin/Debug/netstandard2.0/
# Upload binary log
- name: upload
uses: actions/upload-artifact@v1
with:
name: binary-log-${{ matrix.os }}-${{ matrix.dotnet }}-floating-version
path: ./msbuild.binlog
# Attempt to deploy the resulting dacpac's to a SQL Server instance running in a container using SqlPackage.exe
deploy-sqlpackage:
runs-on: ubuntu-18.04
needs: test
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: JdMsKZPBBA8kVFXVrj8d
ports:
- 1433:1433
options: >-
--health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'JdMsKZPBBA8kVFXVrj8d' -Q 'SELECT 1' || exit 1"
--health-interval 10s
--health-timeout 3s
--health-retries 10
--health-start-period 10s
steps:
# Download artifacts
- name: download-artifact
uses: actions/[email protected]
with:
name: dacpac-package
path: ~/dacpac-package
# Download sqlpackage
- name: download sqlpackage
run: >
curl -L https://go.microsoft.com/fwlink/?linkid=2113331 --output sqlpackage.zip &&
unzip sqlpackage.zip -d ~/sqlpackage &&
chmod a+x ~/sqlpackage/sqlpackage
# Run sqlpackage
- name: sqlpackage publish
run: >
~/sqlpackage/sqlpackage
/Action:Publish
/SourceFile:~/dacpac-package/TestProjectWithSDKRef.dacpac
/Properties:IncludeCompositeObjects=True
/TargetServerName:localhost
/TargetUser:sa
/TargetPassword:JdMsKZPBBA8kVFXVrj8d
/TargetDatabaseName:TestProjectWithSDKRef
# Dump logs of the container if something failed
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v1
# Attempt to deploy a project to a SQL Server instance running in a container using dotnet publish
deploy-publish:
runs-on: ubuntu-18.04
needs: test
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: JdMsKZPBBA8kVFXVrj8d
ports:
- 1433:1433
options: >-
--health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'JdMsKZPBBA8kVFXVrj8d' -Q 'SELECT 1' || exit 1"
--health-interval 10s
--health-timeout 3s
--health-retries 10
--health-start-period 10s
steps:
# Fetch sources
- uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
# Download artifact
- name: download-artifact
uses: actions/[email protected]
with:
name: nuget-packages
path: test/TestProjectWithSDKRef/nuget-packages
# Setup .NET SDK
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.302'
# Install Nerdbank.GitVersioning
- name: install nbgv
run: dotnet tool install --tool-path . nbgv
# Set version
- name: set version
run: ./nbgv cloud -p ./src/MSBuild.Sdk.SqlProj/ --all-vars
id: nbgv
# Replace tokens
- uses: cschleiden/replace-tokens@v1
name: replace tokens
with:
files: 'test/TestProjectWithSDKRef/TestProjectWithSDKRef.csproj'
env:
DependencyVersion: '1.*-*'
# Publish the project
- name: publish project
run: dotnet publish ./test/TestProjectWithSDKRef/TestProjectWithSDKRef.csproj /p:TargetUser=sa /p:TargetPassword=JdMsKZPBBA8kVFXVrj8d /bl /p:DependencyVersion="1.*-*" /warnaserror:SQL71502
# Upload binary log
- name: upload
uses: actions/upload-artifact@v1
with:
name: binary-log-publish
path: ./msbuild.binlog
# Dump logs of the container if something failed
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v1
# Publish the NuGet package to NuGet.org when building master branch
publish:
runs-on: ubuntu-18.04
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')
needs:
- deploy-sqlpackage
- deploy-publish
steps:
# Setup .NET SDK
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.302'
# Download artifacts
- name: download-artifact
uses: actions/[email protected]
with:
name: nuget-packages
path: ~/nuget-packages
# Push
- name: dotnet nuget push
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
working-directory: ~/nuget-packages/