From befbd6f54fcb37a3fb2e39d8baedb80a6be28e29 Mon Sep 17 00:00:00 2001 From: AntoineGautier Date: Fri, 15 Sep 2023 11:50:15 +0200 Subject: [PATCH 1/7] Add step for Windows --- .github/workflows/cmake.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6df4aac..48dc138 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -71,7 +71,7 @@ jobs: shell: bash run: ctest -C $BUILD_TYPE --verbose - - name: Push binaries + - name: Stage binaries if: | contains(matrix.os, 'latest') && contains(matrix.python-version, '3.9') && @@ -82,4 +82,21 @@ jobs: git config --global user.email $GH_USERNAME@users.noreply.github.com git config --global pull.rebase false git add ${{ github.workspace }}/pyfunnel/lib - git diff-index --quiet HEAD || { git commit -m "Add ${{ matrix.os }} binaries" && git pull && git push; } + + - name: Push Linux & macOS binaries + if: | + (matrix.os == 'ubuntu-latest || matrix.os == 'macos-latest') && + contains(matrix.python-version, '3.9') && + github.event_name == 'push' && + github.ref == 'refs/heads/master' + run: git diff-index --quiet HEAD || { git commit -m "Add ${{ matrix.os }} binaries" && git pull && git push; } + + - name: Push Windows binaries + if: | + matrix.os == 'windows-latest' && + contains(matrix.python-version, '3.9') && + github.event_name == 'push' && + github.ref == 'refs/heads/master' + run: | + git diff-index --quiet HEAD + if(-Not $?) { git commit -m "Add ${{ matrix.os }} binaries"; git pull; git push } From 323583822c103a63aabe13b77eb947d792cef999 Mon Sep 17 00:00:00 2001 From: AntoineGautier Date: Fri, 15 Sep 2023 11:51:50 +0200 Subject: [PATCH 2/7] TMP: simplify for testing only --- .github/workflows/cmake.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 48dc138..aac0b66 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -19,7 +19,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.8', '3.9'] + python-version: ['3.9'] steps: - uses: actions/checkout@v3 @@ -74,9 +74,7 @@ jobs: - name: Stage binaries if: | contains(matrix.os, 'latest') && - contains(matrix.python-version, '3.9') && - github.event_name == 'push' && - github.ref == 'refs/heads/master' + contains(matrix.python-version, '3.9') run: | git config --global user.name $GH_USERNAME git config --global user.email $GH_USERNAME@users.noreply.github.com @@ -86,17 +84,13 @@ jobs: - name: Push Linux & macOS binaries if: | (matrix.os == 'ubuntu-latest || matrix.os == 'macos-latest') && - contains(matrix.python-version, '3.9') && - github.event_name == 'push' && - github.ref == 'refs/heads/master' + contains(matrix.python-version, '3.9') run: git diff-index --quiet HEAD || { git commit -m "Add ${{ matrix.os }} binaries" && git pull && git push; } - name: Push Windows binaries if: | matrix.os == 'windows-latest' && - contains(matrix.python-version, '3.9') && - github.event_name == 'push' && - github.ref == 'refs/heads/master' + contains(matrix.python-version, '3.9') run: | git diff-index --quiet HEAD if(-Not $?) { git commit -m "Add ${{ matrix.os }} binaries"; git pull; git push } From 977414594edf140a31ded867da4a6f6ec86c3b16 Mon Sep 17 00:00:00 2001 From: AntoineGautier Date: Fri, 15 Sep 2023 11:53:30 +0200 Subject: [PATCH 3/7] Fix --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index aac0b66..5d1a162 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -83,7 +83,7 @@ jobs: - name: Push Linux & macOS binaries if: | - (matrix.os == 'ubuntu-latest || matrix.os == 'macos-latest') && + (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest') && contains(matrix.python-version, '3.9') run: git diff-index --quiet HEAD || { git commit -m "Add ${{ matrix.os }} binaries" && git pull && git push; } From 8484f8bc4f93b3d7751697b61017ff619cf32e65 Mon Sep 17 00:00:00 2001 From: AntoineGautier Date: Fri, 15 Sep 2023 12:14:08 +0200 Subject: [PATCH 4/7] Use stash before pull --- .github/workflows/cmake.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 5d1a162..6c4c6b3 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -66,10 +66,10 @@ jobs: shell: bash run: cmake --build . --target install --config $BUILD_TYPE - - name: Test - working-directory: ${{ github.workspace }}/build - shell: bash - run: ctest -C $BUILD_TYPE --verbose + # - name: Test + # working-directory: ${{ github.workspace }}/build + # shell: bash + # run: ctest -C $BUILD_TYPE --verbose - name: Stage binaries if: | @@ -79,18 +79,21 @@ jobs: git config --global user.name $GH_USERNAME git config --global user.email $GH_USERNAME@users.noreply.github.com git config --global pull.rebase false + git stash + git pull + git stash apply git add ${{ github.workspace }}/pyfunnel/lib - name: Push Linux & macOS binaries if: | (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest') && contains(matrix.python-version, '3.9') - run: git diff-index --quiet HEAD || { git commit -m "Add ${{ matrix.os }} binaries" && git pull && git push; } + run: | + git diff-index --quiet HEAD || { git commit -m "Add ${{ matrix.os }} binaries" && git push; } - name: Push Windows binaries if: | matrix.os == 'windows-latest' && contains(matrix.python-version, '3.9') run: | - git diff-index --quiet HEAD - if(-Not $?) { git commit -m "Add ${{ matrix.os }} binaries"; git pull; git push } + git diff-index --quiet HEAD; if(-not $?) { (git commit -m "Add ${{ matrix.os }} binaries") -and (git push) } From 495127497f7e65599504c747eb653c4d23b8cb62 Mon Sep 17 00:00:00 2001 From: AntoineGautier Date: Fri, 15 Sep 2023 12:17:34 +0200 Subject: [PATCH 5/7] Add branch ref --- .github/workflows/cmake.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6c4c6b3..4d36544 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -23,6 +23,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + ref: ${{ github.ref_name }} - name: Enable Developer Command Prompt uses: ilammy/msvc-dev-cmd@v1.12.1 From 6d64aaa24b4da03d195ad055fc1f404bd02ed0c8 Mon Sep 17 00:00:00 2001 From: AntoineGautier Date: Fri, 15 Sep 2023 12:20:19 +0200 Subject: [PATCH 6/7] Bump version of actions/checkout --- .github/workflows/cmake.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 4d36544..5eb4490 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -22,9 +22,7 @@ jobs: python-version: ['3.9'] steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.ref_name }} + - uses: actions/checkout@v4 - name: Enable Developer Command Prompt uses: ilammy/msvc-dev-cmd@v1.12.1 From f805ffa51e3e55c45a2b4d6041c4ad9a416ae0e8 Mon Sep 17 00:00:00 2001 From: AntoineGautier Date: Fri, 15 Sep 2023 12:22:45 +0200 Subject: [PATCH 7/7] Restore full workflow --- .github/workflows/cmake.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 5eb4490..31abe03 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -19,7 +19,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.9'] + python-version: ['3.8', '3.9'] steps: - uses: actions/checkout@v4 @@ -66,15 +66,17 @@ jobs: shell: bash run: cmake --build . --target install --config $BUILD_TYPE - # - name: Test - # working-directory: ${{ github.workspace }}/build - # shell: bash - # run: ctest -C $BUILD_TYPE --verbose + - name: Test + working-directory: ${{ github.workspace }}/build + shell: bash + run: ctest -C $BUILD_TYPE --verbose - name: Stage binaries if: | contains(matrix.os, 'latest') && - contains(matrix.python-version, '3.9') + contains(matrix.python-version, '3.9') && + github.event_name == 'push' && + github.ref == 'refs/heads/master' run: | git config --global user.name $GH_USERNAME git config --global user.email $GH_USERNAME@users.noreply.github.com @@ -87,13 +89,17 @@ jobs: - name: Push Linux & macOS binaries if: | (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest') && - contains(matrix.python-version, '3.9') + contains(matrix.python-version, '3.9') && + github.event_name == 'push' && + github.ref == 'refs/heads/master' run: | git diff-index --quiet HEAD || { git commit -m "Add ${{ matrix.os }} binaries" && git push; } - name: Push Windows binaries if: | matrix.os == 'windows-latest' && - contains(matrix.python-version, '3.9') + contains(matrix.python-version, '3.9') && + github.event_name == 'push' && + github.ref == 'refs/heads/master' run: | git diff-index --quiet HEAD; if(-not $?) { (git commit -m "Add ${{ matrix.os }} binaries") -and (git push) }