From 89a14dec1b32453b5ff13a89b92c52ae511b91db Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 17 Jun 2022 09:09:39 -0500 Subject: [PATCH 01/11] Use native job cancellation --- .github/workflows/build-aarch64.yml | 13 ++++++------- .github/workflows/build-m1-wheel.yml | 13 ++++++------- .github/workflows/build-test.yaml | 13 ++++++------- .github/workflows/build-wheels.yml | 13 ++++++------- .github/workflows/relic-nightly.yml | 13 ++++++------- 5 files changed, 30 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build-aarch64.yml b/.github/workflows/build-aarch64.yml index 1bc059e35..9b2d001f8 100644 --- a/.github/workflows/build-aarch64.yml +++ b/.github/workflows/build-aarch64.yml @@ -10,6 +10,11 @@ on: branches: - '**' +concurrency: + # SHA is added to the end if on `main` to let all main workflows run + group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main') && github.sha || '' }} + cancel-in-progress: true + jobs: build_wheels: name: Build wheel on ${{ matrix.os }} @@ -20,14 +25,8 @@ jobs: os: [[ARM64, Linux]] steps: - - name: Cancel previous runs on the same branch - if: ${{ github.ref != 'refs/heads/main' }} - uses: styfle/cancel-workflow-action@0.9.1 - with: - access_token: ${{ github.token }} - - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/build-m1-wheel.yml b/.github/workflows/build-m1-wheel.yml index 6700e8d34..1a7ecee59 100644 --- a/.github/workflows/build-m1-wheel.yml +++ b/.github/workflows/build-m1-wheel.yml @@ -10,6 +10,11 @@ on: branches: - '**' +concurrency: + # SHA is added to the end if on `main` to let all main workflows run + group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main') && github.sha || '' }} + cancel-in-progress: true + jobs: build_wheels: name: Build wheel on Mac M1 @@ -18,14 +23,8 @@ jobs: fail-fast: false steps: - - name: Cancel previous runs on the same branch - if: ${{ github.ref != 'refs/heads/main' }} - uses: styfle/cancel-workflow-action@0.9.1 - with: - access_token: ${{ github.token }} - - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index d53f46027..4c781bdfc 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -10,6 +10,11 @@ on: branches: - '**' +concurrency: + # SHA is added to the end if on `main` to let all main workflows run + group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main') && github.sha || '' }} + cancel-in-progress: true + jobs: build_wheels: name: Build and Test on ${{ matrix.os }} CPython ${{ matrix.python }} @@ -21,14 +26,8 @@ jobs: python: ['3.7', '3.8', '3.9', '3.10'] steps: - - name: Cancel previous runs on the same branch - if: ${{ github.ref != 'refs/heads/main' }} - uses: styfle/cancel-workflow-action@0.9.1 - with: - access_token: ${{ github.token }} - - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - uses: actions/setup-python@v2 name: Install Python diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index ae8ed403d..d125bc028 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -10,6 +10,11 @@ on: branches: - '**' +concurrency: + # SHA is added to the end if on `main` to let all main workflows run + group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main') && github.sha || '' }} + cancel-in-progress: true + jobs: build_wheels: name: Build wheel on ${{ matrix.os }} @@ -20,14 +25,8 @@ jobs: os: [macos-latest, ubuntu-latest, windows-latest] steps: - - name: Cancel previous runs on the same branch - if: ${{ github.ref != 'refs/heads/main' }} - uses: styfle/cancel-workflow-action@0.9.1 - with: - access_token: ${{ github.token }} - - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/relic-nightly.yml b/.github/workflows/relic-nightly.yml index cc8c032a4..fce5d697d 100644 --- a/.github/workflows/relic-nightly.yml +++ b/.github/workflows/relic-nightly.yml @@ -5,6 +5,11 @@ on: - cron: "0 11 * * *" workflow_dispatch: +concurrency: + # SHA is added to the end if on `main` to let all main workflows run + group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main') && github.sha || '' }} + cancel-in-progress: true + jobs: build_wheels: name: Build and Test with Relic Nightly @@ -15,14 +20,8 @@ jobs: os: [macos-latest, ubuntu-latest] steps: - - name: Cancel previous runs on the same branch - if: ${{ github.ref != 'refs/heads/main' }} - uses: styfle/cancel-workflow-action@0.9.1 - with: - access_token: ${{ github.token }} - - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Ubuntu build C++ and test Relic at origin/main if: startsWith(matrix.os, 'ubuntu') From fe0ddc292ed6c81e65d8a5a47aab0b8b7383e506 Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 17 Jun 2022 09:15:53 -0500 Subject: [PATCH 02/11] Add start to js bindings workflow --- .github/workflows/js-bindings.yml | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/js-bindings.yml diff --git a/.github/workflows/js-bindings.yml b/.github/workflows/js-bindings.yml new file mode 100644 index 000000000..371d1428e --- /dev/null +++ b/.github/workflows/js-bindings.yml @@ -0,0 +1,42 @@ +name: Build & Publish JS Bindings + +on: + push: + branches: + - main + tags: + - '**' + pull_request: + branches: + - '**' + +concurrency: + # SHA is added to the end if on `main` to let all main workflows run + group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main') && github.sha || '' }} + cancel-in-progress: true + +jobs: + js_bindings: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Build JS + run: ./js_build.sh + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: js-bindings + path: ${{ github.workspace }}/js_build/js-bindings + + - name: Publish + if: startsWith(github.ref, 'refs/tags/') + working-directory: ${{ github.workspace }}/js_build/js-bindings + run: npm publish From 8f0f1f8a095c39a91c7dc728a0e6ebfb9bb2a129 Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 17 Jun 2022 09:21:51 -0500 Subject: [PATCH 03/11] Get the version info for a tag and replace in package.json --- .github/workflows/js-bindings.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/js-bindings.yml b/.github/workflows/js-bindings.yml index 371d1428e..bacc032e2 100644 --- a/.github/workflows/js-bindings.yml +++ b/.github/workflows/js-bindings.yml @@ -27,6 +27,18 @@ jobs: with: node-version: 16 + - name: Get the version + id: version_info + run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} + + - name: Update version in package.json + if: startsWith(github.ref, 'refs/tags/') + working-directory: ${{ github.workspace }}/js_build/js-bindings + env: + SOURCE_TAG: ${{ steps.version_info.outputs.SOURCE_TAG }} + run: | + jq --arg VER "$SOURCE_TAG" '.version=$VER' package.json > temp.json && mv temp.json package.json + - name: Build JS run: ./js_build.sh From 2c8f09abf6138c03d8152ab2fd64fcc278447d28 Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 17 Jun 2022 09:27:51 -0500 Subject: [PATCH 04/11] Add/update setup-emsdk action --- .github/workflows/build-test.yaml | 2 +- .github/workflows/js-bindings.yml | 3 +++ .github/workflows/relic-nightly.yml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 4c781bdfc..178fde85b 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -70,7 +70,7 @@ jobs: python python-impl/impl-test.py - name: Install emsdk - uses: mymindstorm/setup-emsdk@v9 + uses: mymindstorm/setup-emsdk@v11 - name: Test javascript bindings run: | diff --git a/.github/workflows/js-bindings.yml b/.github/workflows/js-bindings.yml index bacc032e2..d1effe360 100644 --- a/.github/workflows/js-bindings.yml +++ b/.github/workflows/js-bindings.yml @@ -27,6 +27,9 @@ jobs: with: node-version: 16 + - name: Install emsdk + uses: mymindstorm/setup-emsdk@v11 + - name: Get the version id: version_info run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} diff --git a/.github/workflows/relic-nightly.yml b/.github/workflows/relic-nightly.yml index fce5d697d..2a9ef6715 100644 --- a/.github/workflows/relic-nightly.yml +++ b/.github/workflows/relic-nightly.yml @@ -68,7 +68,7 @@ jobs: python python-impl/impl-test.py - name: Install emsdk - uses: mymindstorm/setup-emsdk@v9 + uses: mymindstorm/setup-emsdk@v11 - name: Test javascript bindings run: | From d4c80cc9154f0d214125d84658eb6ad870ccc54e Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 17 Jun 2022 09:33:24 -0500 Subject: [PATCH 05/11] Update artifact dir --- .github/workflows/js-bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/js-bindings.yml b/.github/workflows/js-bindings.yml index d1effe360..b50f40ba3 100644 --- a/.github/workflows/js-bindings.yml +++ b/.github/workflows/js-bindings.yml @@ -49,7 +49,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: js-bindings - path: ${{ github.workspace }}/js_build/js-bindings + path: ${{ github.workspace }}/js_build - name: Publish if: startsWith(github.ref, 'refs/tags/') From 5bbaa57fe6b00f140b319bc7e8f37f652233fc56 Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 17 Jun 2022 09:40:58 -0500 Subject: [PATCH 06/11] Set NPM TOKEN in the publish step --- .github/workflows/js-bindings.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/js-bindings.yml b/.github/workflows/js-bindings.yml index b50f40ba3..06036d474 100644 --- a/.github/workflows/js-bindings.yml +++ b/.github/workflows/js-bindings.yml @@ -54,4 +54,6 @@ jobs: - name: Publish if: startsWith(github.ref, 'refs/tags/') working-directory: ${{ github.workspace }}/js_build/js-bindings + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: npm publish From 0bd3b63b0be37f567f5d8d961da5bdee121858bd Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 17 Jun 2022 09:43:24 -0500 Subject: [PATCH 07/11] Remove upload artifacts --- .github/workflows/js-bindings.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/js-bindings.yml b/.github/workflows/js-bindings.yml index 06036d474..d12bfc150 100644 --- a/.github/workflows/js-bindings.yml +++ b/.github/workflows/js-bindings.yml @@ -45,12 +45,6 @@ jobs: - name: Build JS run: ./js_build.sh - - name: Upload Artifacts - uses: actions/upload-artifact@v3 - with: - name: js-bindings - path: ${{ github.workspace }}/js_build - - name: Publish if: startsWith(github.ref, 'refs/tags/') working-directory: ${{ github.workspace }}/js_build/js-bindings From c8ddf79ebc458804a80b59c5dac7ef4b17b66b5f Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 17 Jun 2022 09:45:59 -0500 Subject: [PATCH 08/11] Fix dir --- .github/workflows/js-bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/js-bindings.yml b/.github/workflows/js-bindings.yml index d12bfc150..f0dfdfb90 100644 --- a/.github/workflows/js-bindings.yml +++ b/.github/workflows/js-bindings.yml @@ -36,7 +36,7 @@ jobs: - name: Update version in package.json if: startsWith(github.ref, 'refs/tags/') - working-directory: ${{ github.workspace }}/js_build/js-bindings + working-directory: ${{ github.workspace }}/js-bindings env: SOURCE_TAG: ${{ steps.version_info.outputs.SOURCE_TAG }} run: | From 33067bc06b1e53e2952cfef3cb573a8efc31eed1 Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 17 Jun 2022 09:56:37 -0500 Subject: [PATCH 09/11] publish packages as public --- .github/workflows/js-bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/js-bindings.yml b/.github/workflows/js-bindings.yml index f0dfdfb90..5eacc98aa 100644 --- a/.github/workflows/js-bindings.yml +++ b/.github/workflows/js-bindings.yml @@ -50,4 +50,4 @@ jobs: working-directory: ${{ github.workspace }}/js_build/js-bindings env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npm publish + run: npm publish --access public From c7c9491ef8c358bf0d75b0e8c94d92f7405568ef Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 17 Jun 2022 10:07:50 -0500 Subject: [PATCH 10/11] Actually use npm token --- .github/workflows/js-bindings.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/js-bindings.yml b/.github/workflows/js-bindings.yml index 5eacc98aa..df3666f59 100644 --- a/.github/workflows/js-bindings.yml +++ b/.github/workflows/js-bindings.yml @@ -50,4 +50,11 @@ jobs: working-directory: ${{ github.workspace }}/js_build/js-bindings env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npm publish --access public + run: | + echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc + npm publish --access public + + - name: Cleanup + if: always() + run: + rm .npmrc || true From 92265f899f53cde4a593118552e29e544a9e1df0 Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Fri, 17 Jun 2022 10:13:55 -0500 Subject: [PATCH 11/11] Fix cleanup file location --- .github/workflows/js-bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/js-bindings.yml b/.github/workflows/js-bindings.yml index df3666f59..887c8df3d 100644 --- a/.github/workflows/js-bindings.yml +++ b/.github/workflows/js-bindings.yml @@ -57,4 +57,4 @@ jobs: - name: Cleanup if: always() run: - rm .npmrc || true + rm ${{ github.workspace }}/js_build/js-bindings/.npmrc || true