Merge pull request #2178 from clason/master
ci: build CLI for macos-arm64
This commit is contained in:
commit
978a2db239
2 changed files with 11 additions and 10 deletions
13
.github/workflows/build.yml
vendored
13
.github/workflows/build.yml
vendored
|
|
@ -26,6 +26,7 @@ jobs:
|
|||
- { name: linux-x86 , target: i686-unknown-linux-gnu , os: ubuntu-latest , use-cross: true }
|
||||
- { name: windows-x64 , target: x86_64-pc-windows-msvc , os: windows-latest }
|
||||
- { name: windows-x86 , target: i686-pc-windows-msvc , os: windows-latest }
|
||||
- { name: macos-arm64 , target: aarch64-apple-darwin , os: macos-latest }
|
||||
- { name: macos-x64 , target: x86_64-apple-darwin , os: macos-latest }
|
||||
|
||||
env:
|
||||
|
|
@ -121,34 +122,38 @@ jobs:
|
|||
esac
|
||||
|
||||
- name: Build C library
|
||||
if: "!contains(matrix.job.os, 'windows')" # Requires an additional adapted Makefile for `cl.exe` compiler
|
||||
if: ${{ !contains(matrix.job.os, 'windows') }} # Requires an additional adapted Makefile for `cl.exe` compiler
|
||||
run: make.sh CFLAGS="-Werror" -j
|
||||
|
||||
- name: Build wasm library
|
||||
if: ${{ !matrix.job.use-cross && matrix.job.name != 'macos-arm64' }} # Not used
|
||||
run: script/build-wasm
|
||||
|
||||
- name: Build CLI
|
||||
run: $BUILD_CMD build --release --target=${{ matrix.job.target }}
|
||||
|
||||
- name: Fetch fixtures
|
||||
if: ${{ matrix.job.name != 'macos-arm64' }} # Not used
|
||||
run: script/fetch-fixtures
|
||||
|
||||
- name: Generate fixtures
|
||||
if: ${{ matrix.job.name != 'macos-arm64' }} # Can't natively run CLI on runner's host
|
||||
run: script/generate-fixtures
|
||||
|
||||
- name: Generate WASM fixtures
|
||||
if: "!matrix.job.use-cross"
|
||||
if: ${{ !matrix.job.use-cross && matrix.job.name != 'macos-arm64' }} # Not used
|
||||
run: script/generate-fixtures-wasm
|
||||
|
||||
- name: Run main tests
|
||||
if: ${{ matrix.job.name != 'macos-arm64' }} # Can't natively run CLI on runner's host
|
||||
run: $BUILD_CMD test --target=${{ matrix.job.target }}
|
||||
|
||||
- name: Run wasm tests
|
||||
if: "!matrix.job.use-cross" # TODO: Install Emscripten into custom cross images
|
||||
if: ${{ !matrix.job.use-cross && matrix.job.name != 'macos-arm64' }} # Not used
|
||||
run: script/test-wasm
|
||||
|
||||
- name: Run benchmarks
|
||||
if: "!matrix.job.use-cross" # It doesn't make sense to benchmark something in an emulator
|
||||
if: ${{ !matrix.job.use-cross && matrix.job.name != 'macos-arm64' }} # Cross-compiled benchmarks make no sense
|
||||
run: $BUILD_CMD bench benchmark -p tree-sitter-cli --target=${{ matrix.job.target }}
|
||||
|
||||
- name: Upload CLI artifact
|
||||
|
|
|
|||
|
|
@ -16,14 +16,10 @@ const platformName = {
|
|||
let archName = {
|
||||
'x64': 'x64',
|
||||
'x86': 'x86',
|
||||
'ia32': 'x86'
|
||||
'ia32': 'x86',
|
||||
'arm64': 'arm64'
|
||||
}[process.arch];
|
||||
|
||||
// ARM macs can run x64 binaries via Rosetta. Rely on that for now.
|
||||
if (platformName === 'macos' && process.arch === 'arm64') {
|
||||
archName = 'x64';
|
||||
}
|
||||
|
||||
if (!platformName || !archName) {
|
||||
console.error(
|
||||
`Cannot install tree-sitter-cli for platform ${process.platform}, architecture ${process.arch}`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue