From 3da64c1746457c86ee81145a7bbc7f33220ee468 Mon Sep 17 00:00:00 2001 From: Ahmad El Sayed Date: Thu, 1 Feb 2024 16:30:50 +0100 Subject: [PATCH 01/10] Enable macOS 13 arm64 build on master barnch --- .github/workflows/build-macos.yml | 42 ++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 2f5c89358..6718a47b7 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -17,12 +17,9 @@ on: workflow_dispatch: jobs: - - build: - - # Build strategy + + setup: strategy: - fail-fast: false matrix: platform: # - ubuntu-latest @@ -31,12 +28,33 @@ jobs: build_type: - 'Release' #- 'Debug' - #- 'DebugWithRelInfo ' + #- 'DebugWithRelInfo' - # Build platform runs-on: ${{ matrix.platform }} - name: ${{ matrix.platform }}-${{ matrix.build_type }} + outputs: + platform: ${{ matrix.platform }} + build_type: ${{ matrix.build_type }} + condition: ${{ steps.condition.outputs.condition }} + + steps: + - id: condition + run: | + if [[ ${{ matrix.platform }} == "macos-13-xlarge" && ${{ github.ref }} == ''refs/heads/master']]; then + echo "condition=true" >> $GITHUB_OUTPUT + else + echo "condition=false" >> $GITHUB_OUTPUT + fi + + build: + + needs: [setup] + + runs-on: ${{needs.setup.outputs.platform}} + + if: ${{ needs.setup.outputs.condition }} == 'true' + + name: ${{needs.setup.outputs.platform}}-${{needs.setup.outputs.build_type}} # The default compiler on macos is clang, switch to gcc 11. Specifying the version is necessary. # It seems like gcc and g++ are symbolic links to the default clang and clang++ compilers, respectively. @@ -89,7 +107,7 @@ jobs: pwsh ${{ github.workspace }}/scripts/install_netcdf_static.ps1 -WorkDir ${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/work -InstallDir ${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/install - -BuildType '${{ matrix.build_type }}' + -BuildType '${{ needs.setup.outputs.build_type }}' -ParallelJobs 10 # Step: Cache user-provided dependencies, executes only if no cache restored @@ -106,13 +124,13 @@ jobs: cmake -S ${{ github.workspace }} -B ${{ steps.paths.outputs.build_dir }} - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DCMAKE_BUILD_TYPE=${{ needs.setup.outputs.build_type }} -DCMAKE_PREFIX_PATH=${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/install/netcdf-c -DCMAKE_INSTALL_PREFIX=${{ steps.paths.outputs.install_dir }} # Step: CMake build - name: Build - run: cmake --build ${{ steps.paths.outputs.build_dir }} --config ${{ matrix.build_type }} -j + run: cmake --build ${{ steps.paths.outputs.build_dir }} --config ${{ needs.setup.outputs.build_type }} -j # Step: Test # Works if runner.os == 'Linux' or runner.os == 'macOS' @@ -133,6 +151,6 @@ jobs: uses: actions/upload-artifact@v4 if: always() with: - name: meshkernel-${{ matrix.platform }}-${{ matrix.build_type }} + name: meshkernel-${{ needs.setup.outputs.platform }}-${{ needs.setup.outputs.build_type }} path: ${{ steps.paths.outputs.install_dir }} if-no-files-found: error From a37b6f18e5a15af28a6b233556adc2055fe8bf1f Mon Sep 17 00:00:00 2001 From: Ahmad El Sayed Date: Thu, 1 Feb 2024 16:33:40 +0100 Subject: [PATCH 02/10] Fix typo --- .github/workflows/build-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 6718a47b7..32c68b0a7 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -40,7 +40,7 @@ jobs: steps: - id: condition run: | - if [[ ${{ matrix.platform }} == "macos-13-xlarge" && ${{ github.ref }} == ''refs/heads/master']]; then + if [[ ${{ matrix.platform }} == 'macos-13-xlarge' && ${{ github.ref }} == 'refs/heads/master' ]]; then echo "condition=true" >> $GITHUB_OUTPUT else echo "condition=false" >> $GITHUB_OUTPUT From fc4831f8cbc0e9fe6af51310dc54f8a3521e8934 Mon Sep 17 00:00:00 2001 From: Ahmad El Sayed Date: Thu, 1 Feb 2024 16:48:22 +0100 Subject: [PATCH 03/10] Change condition to exclude feature branches and include everything else --- .github/workflows/build-macos.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 32c68b0a7..3bbea811d 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -19,6 +19,7 @@ on: jobs: setup: + strategy: matrix: platform: @@ -40,7 +41,7 @@ jobs: steps: - id: condition run: | - if [[ ${{ matrix.platform }} == 'macos-13-xlarge' && ${{ github.ref }} == 'refs/heads/master' ]]; then + if [[ ${{ matrix.platform }} == 'macos-13-xlarge' && ${{ github.ref }} != 'refs/heads/feature/*' ]]; then echo "condition=true" >> $GITHUB_OUTPUT else echo "condition=false" >> $GITHUB_OUTPUT From 55d2a6f07c527f4600f4a5d3a6dc63d168d00432 Mon Sep 17 00:00:00 2001 From: Ahmad El Sayed Date: Thu, 1 Feb 2024 16:49:20 +0100 Subject: [PATCH 04/10] Enable ubuntu platform and debug build for all platforms to check if matrix worls --- .github/workflows/build-macos.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 3bbea811d..a93db5520 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -23,12 +23,12 @@ jobs: strategy: matrix: platform: - # - ubuntu-latest + - ubuntu-latest - macos-latest - macos-13-xlarge build_type: - 'Release' - #- 'Debug' + - 'Debug' #- 'DebugWithRelInfo' runs-on: ${{ matrix.platform }} From 2980ac04b0157f5a2bb7a53eda84e1d8da2fc8cb Mon Sep 17 00:00:00 2001 From: Ahmad El Sayed Date: Thu, 1 Feb 2024 17:03:11 +0100 Subject: [PATCH 05/10] Improve the condition --- .github/workflows/build-macos.yml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index a93db5520..e970598db 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -27,9 +27,9 @@ jobs: - macos-latest - macos-13-xlarge build_type: - - 'Release' - - 'Debug' - #- 'DebugWithRelInfo' + - Release + - Debug + #- DebugWithRelInfo runs-on: ${{ matrix.platform }} @@ -41,12 +41,23 @@ jobs: steps: - id: condition run: | - if [[ ${{ matrix.platform }} == 'macos-13-xlarge' && ${{ github.ref }} != 'refs/heads/feature/*' ]]; then - echo "condition=true" >> $GITHUB_OUTPUT + if [ "${{ runner.os }}" == "macOS" ]; then + if [[ ${{ matrix.platform }} == 'macos-13-xlarge' && ${{ github.ref }} != 'refs/heads/feature/*' ]]; then + echo "condition=true" >> $GITHUB_OUTPUT + else + echo "condition=false" >> $GITHUB_OUTPUT + fi else - echo "condition=false" >> $GITHUB_OUTPUT + echo "condition=true" >> $GITHUB_OUTPUT fi + # run: | + # if [[ ${{ matrix.platform }} == 'macos-13-xlarge' && ${{ github.ref }} != 'refs/heads/feature/*' ]]; then + # echo "condition=true" >> $GITHUB_OUTPUT + # else + # echo "condition=false" >> $GITHUB_OUTPUT + # fi + build: needs: [setup] From 87b5b81e5e0735946c389a1b7c50285f77ed9914 Mon Sep 17 00:00:00 2001 From: Ahmad El Sayed Date: Thu, 1 Feb 2024 17:08:24 +0100 Subject: [PATCH 06/10] Use github.head_ref instead of github.ref --- .github/workflows/build-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index e970598db..6737ff1bf 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -42,7 +42,7 @@ jobs: - id: condition run: | if [ "${{ runner.os }}" == "macOS" ]; then - if [[ ${{ matrix.platform }} == 'macos-13-xlarge' && ${{ github.ref }} != 'refs/heads/feature/*' ]]; then + if [[ ${{ matrix.platform }} == 'macos-13-xlarge' && ${{ github.head_ref }} != 'feature/*' ]]; then echo "condition=true" >> $GITHUB_OUTPUT else echo "condition=false" >> $GITHUB_OUTPUT From 7637f34b64e7d445f4a2ae0f4363e29d4a4863b0 Mon Sep 17 00:00:00 2001 From: Ahmad El Sayed Date: Thu, 1 Feb 2024 17:14:00 +0100 Subject: [PATCH 07/10] Simpler condition --- .github/workflows/build-macos.yml | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 6737ff1bf..a42543f52 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -40,32 +40,32 @@ jobs: steps: - id: condition + # run: | + # if [ "${{ runner.os }}" == "macOS" ]; then + # if [[ ${{ matrix.platform }} == 'macos-13-xlarge' && ${{ github.head_ref }} != 'feature/*' ]]; then + # echo "condition=true" >> $GITHUB_OUTPUT + # else + # echo "condition=false" >> $GITHUB_OUTPUT + # fi + # else + # echo "condition=true" >> $GITHUB_OUTPUT + # fi + run: | - if [ "${{ runner.os }}" == "macOS" ]; then - if [[ ${{ matrix.platform }} == 'macos-13-xlarge' && ${{ github.head_ref }} != 'feature/*' ]]; then - echo "condition=true" >> $GITHUB_OUTPUT - else - echo "condition=false" >> $GITHUB_OUTPUT - fi + if [[ ${{ matrix.platform }} == 'macos-13-xlarge' && ${{ github.head_ref }} == 'feature/*' ]]; then + echo "condition=false" >> $GITHUB_OUTPUT else - echo "condition=true" >> $GITHUB_OUTPUT + echo "condition=true" >> $GITHUB_OUTPUT fi - # run: | - # if [[ ${{ matrix.platform }} == 'macos-13-xlarge' && ${{ github.ref }} != 'refs/heads/feature/*' ]]; then - # echo "condition=true" >> $GITHUB_OUTPUT - # else - # echo "condition=false" >> $GITHUB_OUTPUT - # fi - build: needs: [setup] - runs-on: ${{needs.setup.outputs.platform}} - if: ${{ needs.setup.outputs.condition }} == 'true' + runs-on: ${{needs.setup.outputs.platform}} + name: ${{needs.setup.outputs.platform}}-${{needs.setup.outputs.build_type}} # The default compiler on macos is clang, switch to gcc 11. Specifying the version is necessary. From d302daab17981da309f5f3edabd4eb46cc44fae9 Mon Sep 17 00:00:00 2001 From: Ahmad El Sayed Date: Thu, 1 Feb 2024 17:18:14 +0100 Subject: [PATCH 08/10] bash syntax --- .github/workflows/build-macos.yml | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index a42543f52..f9e4397c5 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -40,19 +40,8 @@ jobs: steps: - id: condition - # run: | - # if [ "${{ runner.os }}" == "macOS" ]; then - # if [[ ${{ matrix.platform }} == 'macos-13-xlarge' && ${{ github.head_ref }} != 'feature/*' ]]; then - # echo "condition=true" >> $GITHUB_OUTPUT - # else - # echo "condition=false" >> $GITHUB_OUTPUT - # fi - # else - # echo "condition=true" >> $GITHUB_OUTPUT - # fi - run: | - if [[ ${{ matrix.platform }} == 'macos-13-xlarge' && ${{ github.head_ref }} == 'feature/*' ]]; then + if [ "${{ matrix.platform }}" == "macos-13-xlarge" ] && [ "${{ github.head_ref }}" == "feature/*" ]; then echo "condition=false" >> $GITHUB_OUTPUT else echo "condition=true" >> $GITHUB_OUTPUT @@ -62,10 +51,10 @@ jobs: needs: [setup] - if: ${{ needs.setup.outputs.condition }} == 'true' - runs-on: ${{needs.setup.outputs.platform}} + if: ${{ needs.setup.outputs.condition }} == 'true' + name: ${{needs.setup.outputs.platform}}-${{needs.setup.outputs.build_type}} # The default compiler on macos is clang, switch to gcc 11. Specifying the version is necessary. From 6ed5dcbab5e9a2939ab0640807f581f25ef469f3 Mon Sep 17 00:00:00 2001 From: Ahmad El Sayed Date: Thu, 1 Feb 2024 17:36:14 +0100 Subject: [PATCH 09/10] Quoted all matrix strings --- .github/workflows/build-macos.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index f9e4397c5..6d5b6b7cd 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -23,13 +23,13 @@ jobs: strategy: matrix: platform: - - ubuntu-latest - - macos-latest - - macos-13-xlarge + - 'ubuntu-latest' + - 'macos-latest' + - 'macos-13-xlarge' build_type: - - Release - - Debug - #- DebugWithRelInfo + - 'Release' + - 'Debug' + #- 'DebugWithRelInfo' runs-on: ${{ matrix.platform }} From 717e187f1a6831962ca00367cf8247a08a860567 Mon Sep 17 00:00:00 2001 From: Ahmad El Sayed Date: Mon, 5 Feb 2024 13:26:09 +0100 Subject: [PATCH 10/10] Fix regex --- .github/workflows/build-macos.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 6d5b6b7cd..27a712cfa 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -23,12 +23,12 @@ jobs: strategy: matrix: platform: - - 'ubuntu-latest' - - 'macos-latest' - - 'macos-13-xlarge' + - ubuntu-latest + - macos-latest + - macos-13-xlarge build_type: - - 'Release' - - 'Debug' + - Release + - Debug #- 'DebugWithRelInfo' runs-on: ${{ matrix.platform }} @@ -41,7 +41,7 @@ jobs: steps: - id: condition run: | - if [ "${{ matrix.platform }}" == "macos-13-xlarge" ] && [ "${{ github.head_ref }}" == "feature/*" ]; then + if [ "${{ matrix.platform }}" == "macos-13-xlarge" ] && [ "${{ github.head_ref }}" == "feature/"* ]; then echo "condition=false" >> $GITHUB_OUTPUT else echo "condition=true" >> $GITHUB_OUTPUT