From 4a04e833bb9978faa2438b183eba5ba1147ace03 Mon Sep 17 00:00:00 2001 From: Matthieu Monsch <1216372+mtth@users.noreply.github.com> Date: Sat, 1 Jun 2024 10:11:37 -0700 Subject: [PATCH] feat: add Darwin ARM64 prebuild (#48) Also switch to using semantic releases. --- .github/workflows/ci.yml | 43 ++++++++++++------------------ .releaserc.yaml | 6 +++++ package.json | 3 +-- packages/highs-addon/README.md | 1 + packages/highs-addon/package.json | 2 +- packages/highs-solver/package.json | 2 +- 6 files changed, 27 insertions(+), 30 deletions(-) create mode 100644 .releaserc.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1adb457..8bfb805 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,10 @@ jobs: name: Test timeout-minutes: 10 runs-on: ubuntu-latest + permissions: + contents: write outputs: - tagged: ${{ format(steps.check-version.outputs.exists == 'false') }} + new-version: ${{ steps.bump-version.outputs.new_version }} steps: - name: Check out uses: actions/checkout@v4 @@ -42,31 +44,16 @@ jobs: - name: Test run: pnpm t - name: Upload coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} directory: out/coverage - - name: Extract version - id: extract-version - run: | - version="$(node -p 'require("./package.json").version')" - echo "version=$version" >>"$GITHUB_OUTPUT" - - name: Check if tag exists - uses: mukunku/tag-exists-action@v1.1.0 - id: check-version - with: - tag: v${{ steps.extract-version.outputs.version }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Create tag - if: steps.check-version.outputs.exists == 'false' - uses: pkgdeps/git-tag-action@v2 + - name: Bump version and create tag + id: bump-version + uses: mathieudutour/github-tag-action@v6.2 with: - git_commit_sha: ${{ github.sha }} - git_tag_prefix: v - github_repo: ${{ github.repository }} github_token: ${{ secrets.GITHUB_TOKEN }} - version: ${{ steps.extract-version.outputs.version }} + default_bump: false prebuild-native: strategy: matrix: @@ -75,12 +62,13 @@ jobs: os: ubuntu-22.04 - key: darwin-x64 os: macos-12 - # TODO: darwin-arm64 (https://github.com/github/roadmap/issues/528) + - key: darwin-arm64 + os: macos-14 name: Prebuild ${{ matrix.key }} timeout-minutes: 25 runs-on: ${{ matrix.os }} needs: test - if: needs.test.outputs.tagged == 'true' + if: needs.test.outputs.new-version != '' steps: - name: Check out uses: actions/checkout@v4 @@ -131,7 +119,7 @@ jobs: timeout-minutes: 90 runs-on: ubuntu-latest needs: test - if: needs.test.outputs.tagged == 'true' + if: needs.test.outputs.new-version != '' steps: - name: Check out uses: actions/checkout@v4 @@ -188,6 +176,7 @@ jobs: name: Publish packages timeout-minutes: 5 needs: + - test - prebuild-native - prebuild-docker runs-on: ubuntu-latest @@ -218,11 +207,13 @@ jobs: mv out/prebuilds/*/* packages/highs-addon/prebuilds ls packages/highs-addon/prebuilds - name: Point to NPM registry - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: cache: pnpm registry-url: https://registry.npmjs.org - name: Publish - run: pnpm -r exec pnpm publish + run: | + pnpm -r exec pnpm version ${{ needs.test.outputs.new-version }} + pnpm -r exec pnpm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.releaserc.yaml b/.releaserc.yaml new file mode 100644 index 0000000..4091257 --- /dev/null +++ b/.releaserc.yaml @@ -0,0 +1,6 @@ +plugins: + - - '@semantic-release/commit-analyzer' + - preset: conventionalcommits + parserOpts: + breakingHeaderPattern: '' + headerPattern: '/^(\w*)(?:\\((.*)\\))?!?: (.*)$/' diff --git a/package.json b/package.json index 907209b..8634620 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,11 @@ { "name": "highs-packages", - "version": "0.6.6", + "version": "0.0.0", "private": true, "repository": "github:opvious/highs.ts", "author": "Opvious Engineering ", "license": "Apache-2.0", "scripts": { - "bump": "pnpm -r --include-workspace-root exec npm version ${BUMP:-patch}", "clean": "pnpm -r -F !. run clean && rm -rf node_modules out", "fix": "prettier --write 'packages/*/*.ts' 'packages/*/{src,test}/**/*.ts' && pnpm run lint --fix", "lint": "eslint 'packages/*/*.ts' 'packages/*/{src,test}/**/*.ts'", diff --git a/packages/highs-addon/README.md b/packages/highs-addon/README.md index 2139dfe..23378df 100644 --- a/packages/highs-addon/README.md +++ b/packages/highs-addon/README.md @@ -15,6 +15,7 @@ This package ships with pre-built binaries for several common environments: | Platform | Architecture | C library | | --- | --- | --- | | `darwin` | `x64` | n/a | +| `darwin` | `arm64` | n/a | | `linux` | `x64` | `glibc` | | `linux` | `x64` | `musl` | | `linux` | `arm64` | `glibc` | diff --git a/packages/highs-addon/package.json b/packages/highs-addon/package.json index 9a8972f..670b168 100644 --- a/packages/highs-addon/package.json +++ b/packages/highs-addon/package.json @@ -1,6 +1,6 @@ { "name": "highs-addon", - "version": "0.6.6", + "version": "0.0.0", "repository": "github:opvious/highs.ts", "description": "Low-level Node.js binding for the HiGHS optimization solver", "keywords": [ diff --git a/packages/highs-solver/package.json b/packages/highs-solver/package.json index 2285cc0..245a3aa 100644 --- a/packages/highs-solver/package.json +++ b/packages/highs-solver/package.json @@ -1,6 +1,6 @@ { "name": "highs-solver", - "version": "0.6.6", + "version": "0.0.0", "repository": "github:opvious/highs.ts", "description": "Node.js binding for the HiGHS optimization solver", "keywords": [