Feature: CI Automation #140
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: Windows Build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
DOTNET_INSTALL_DIR: ${{ github.workspace }}/.dotnet | |
DOTNET_VERSION: '8.0.x' | |
jobs: | |
BuildNugetPackages-Windows: | |
strategy: | |
matrix: | |
os: [self-hosted-win-x64] | |
runs-on: ${{ matrix.os }} | |
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" | |
defaults: | |
run: | |
working-directory: win | |
steps: | |
- uses: actions/checkout@v3.0.0 | |
with: | |
fetch-depth: 0 | |
- name: Restore cached packages | |
id: build-packages-cache-restore | |
uses: maxnowack/local-cache@main | |
with: | |
path: | | |
${{ github.workspace }}/build-win | |
${{ github.workspace }}/.dotnet | |
key: ${{ runner.os }}-packages | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Compile GDAL and create packages | |
id: compile-source | |
run: | | |
./install.ps1 -buildNumberTail ${{ github.run_number }} | |
echo "GDAL_VERSION=$env:GDAL_VERSION" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
- name: Store metadata as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: metadata-win-x64 | |
path: shared/bundle/targets/ | |
- name: Store packages as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages-win-x64 | |
path: nuget/*.nupkg | |
outputs: | |
gdal-version: ${{ steps.compile-source.outputs.GDAL_VERSION }} | |
TestAndPushPackages-Windows: | |
strategy: | |
matrix: | |
os: [self-hosted-win-x64] | |
needs: BuildNugetPackages-Windows | |
runs-on: ${{ matrix.os }} | |
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" | |
defaults: | |
run: | |
working-directory: win | |
env: | |
GDAL_VERSION: ${{ needs.BuildNugetPackages-Windows.outputs.gdal-version }} | |
steps: | |
- uses: actions/checkout@v3.0.0 | |
with: | |
fetch-depth: 0 | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: packages-win-x64 | |
path: nuget/ | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: NuGet - Update credentials | |
run: | | |
dotnet nuget update source github --store-password-in-clear-text -u ${{ secrets.API_USER_GITHUB }} -p ${{ secrets.API_KEY_GITHUB }} --configfile ../nuget.config | |
dotnet nuget update source nuget.org --store-password-in-clear-text -u ${{ secrets.API_USER_NUGET }} -p ${{ secrets.API_KEY_NUGET }} --configfile ../nuget.config | |
dotnet nuget remove source local 1>$null | |
dotnet nuget remove source local.ci 1>$null | |
dotnet nuget add source "${{ github.workspace}}/nuget/" --name local.ci | |
shell: pwsh | |
- name: Test packages | |
run: ./test.ps1 -buildNumberTail ${{ github.run_number }} | |
shell: pwsh |