Feature: CI Automation #272
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: 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/ | |
DOTNET_VERSION: '8.0.x' | |
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg-archives/ | |
jobs: | |
BuildNugetPackages-MacOS: | |
strategy: | |
matrix: | |
os: [self-hosted-macos-arm64,self-hosted-macos-x64] | |
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: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Restore cached packages | |
id: build-packages-cache-restore | |
uses: maxnowack/local-cache@main | |
with: | |
path: | | |
${{ github.workspace }}/build-osx/ | |
${{ github.workspace }}/.dotnet/ | |
${{ github.workspace }}/vcpkg-archives/ | |
key: ${{ runner.os }}-packages-${{ matrix.os }} | |
- name: Set up Homebrew | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Install CMake | |
run: | | |
python3 -m pip install cmake | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Install deps | |
run: | | |
${{ github.workspace }}/osx/before-install.sh | |
- name: Fetch VCPKG packages | |
run: | | |
mkdir -p ${{ github.workspace }}/vcpkg-archives/ | |
make -f vcpkg-makefile BUILD_ARCH=${{ matrix.arch }} build_cleanup | |
make -f vcpkg-makefile BUILD_ARCH=${{ matrix.arch }} | |
- name: Compile HDF | |
run: | | |
make -f gdal-makefile hdf-force BUILD_ARCH=${{ matrix.arch }} | |
- name: Compile PROJ | |
run: | | |
make -f gdal-makefile proj-force BUILD_ARCH=${{ matrix.arch }} | |
- name: Compile GDAL | |
run: | | |
make -f gdal-makefile gdal-force 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 metadata as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: metadata-osx-${{ matrix.arch }} | |
path: shared/bundle/targets/ | |
- name: Store packages as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages-osx-${{ matrix.arch }} | |
path: nuget/*.nupkg | |
TestAndPushPackages-MacOS: | |
strategy: | |
matrix: | |
os: [self-hosted-macos-arm64,self-hosted-macos-x64,macos-latest] | |
include: | |
- os: self-hosted-macos-arm64 | |
arch: arm64 | |
- os: self-hosted-macos-x64 | |
arch: x64 | |
- os: macos-latest | |
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: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: packages-osx-${{ matrix.arch }} | |
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 || true | |
dotnet nuget remove source local.ci || true | |
dotnet nuget add source "${{ github.workspace}}/nuget/" --name local.ci --configfile ../nuget.config | |
- name: Test packages | |
run: | | |
make -f test-makefile BUILD_ARCH=${{ matrix.arch }} BUILD_NUMBER_TAIL=${{ github.run_number }} |