Skip to content

Feature: CI Automation #154

Feature: CI Automation

Feature: CI Automation #154

Workflow file for this run

name: MacOS 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
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
jobs:
BuildNugetPackages-MacOS:
strategy:
matrix:
# os: [self-hosted-macos-arm64,self-hosted-macos-x64]
os: [self-hosted-macos-arm64]
include:
- os: self-hosted-macos-arm64
arch: arm64
# - os: self-hosted-macos-x64
# arch: 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: osx
steps:
- uses: actions/checkout@v3.0.0
with:
fetch-depth: 0
- name: Restore cached packages
id: build-packages-cache-restore
uses: actions/cache/restore@v3
with:
path: |
build-osx
.dotnet
key: ${{ runner.os }}-packages
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Fetch VCPKG packages
run: |
make -f vcpkg-makefile BUILD_ARCH=${{ matrix.arch }}
- name: Compile PROJ
run: |
make -f gdal-makefile proj BUILD_ARCH=${{ matrix.arch }}
- name: Compile GDAL
run: |
make -f gdal-makefile gdal BUILD_ARCH=${{ matrix.arch }}
- name: Collect deps
run: |
make -f collect-deps-makefile BUILD_ARCH=${{ matrix.arch }}
- name: Create packages
run: |
make -f publish-makefile pack BUILD_ARCH=${{ matrix.arch }} BUILD_NUMBER_TAIL=${{ github.run_number }}
- name: Store packages as artifact
uses: actions/upload-artifact@v3
with:
name: osx-packages
path: nuget/*.nupkg
- name: Save packages cache
id: build-packages-cache-save
uses: actions/cache/save@v3
with:
path: |
build-osx
.dotnet
key: ${{ steps.build-packages-cache-restore.outputs.cache-primary-key }}
TestAndPushPackages-MacOS:
strategy:
matrix:
# os: [self-hosted-macos-arm64,self-hosted-macos-x64]
os: [self-hosted-macos-arm64]
include:
- os: self-hosted-macos-arm64
arch: arm64
# - os: self-hosted-macos-x64
# arch: x64
needs: BuildNugetPackages-MacOS
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: osx
steps:
- uses: actions/checkout@v3.0.0
with:
fetch-depth: 0
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: osx-packages
path: nuget/
- 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 update source local.ci -s ${{ github.workspace}}/nuget/
- name: Test packages
run: |
make -f test-makefile BUILD_ARCH=${{ matrix.arch }} BUILD_NUMBER_TAIL=${{ github.run_number }}
- name: Push packages
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
make -f push-packages-makefile BUILD_ARCH=${{ matrix.arch }} BUILD_NUMBER_TAIL=${{ github.run_number }} API_KEY_GITHUB=${{ secrets.API_KEY_GITHUB }} API_KEY_NUGET=${{ secrets.API_KEY_NUGET }}