Try to build on Apple Silicon #228
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [push] | |
env: | |
HOST_NODE_VERSION: v18.20.7 | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: | |
- windows-2022 | |
- ubuntu-22.04 | |
- ubuntu-22.04-arm | |
- macos-13 # x86 | |
- macos-14 # arm | |
arch: | |
- 64 | |
- 32 | |
exclude: | |
- os: ubuntu-22.04 | |
arch: 32 | |
- os: ubuntu-22.04-arm | |
arch: 32 | |
- os: macos-13 | |
arch: 32 | |
- os: macos-14 | |
arch: 32 | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- if: ${{ runner.os == 'Windows' }} | |
shell: powershell | |
run: | | |
echo NVM_HOME=$env:ProgramData\nvm | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
echo NVM_SYMLINK=$env:ProgramFiles\nodejs | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
echo $env:ProgramData\nvm | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
Remove-Item $env:ProgramFiles\nodejs -Recurse -Force -ErrorAction SilentlyContinue | |
- if: ${{ runner.os == 'Windows' }} | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.NVM_HOME }} | |
key: nvm-windows | |
- if: ${{ runner.os == 'Linux' }} | |
run: | | |
echo NVM_DIR=$HOME/.nvm >>$GITHUB_ENV | |
sudo apt-get install libxinerama-dev libxtst-dev | |
- if: ${{ runner.os == 'macOS' }} | |
run: | | |
echo NVM_DIR=$HOME/.nvm >>$GITHUB_ENV | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash | |
echo PYTHON=/usr/local/bin/python >>$GITHUB_ENV | |
- if: ${{ runner.os == 'Windows' }} | |
run: | | |
choco install nvm | |
echo "Waiting for nvm installer to complete..." | |
until nvm root >/dev/null 2>&1; do sleep 1; echo .; done | |
nvm debug | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- env: | |
ARCH: ${{ runner.os == 'Windows' && matrix.arch || '' }} | |
run: | | |
[ -e "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" | |
nvm install $HOST_NODE_VERSION $ARCH | |
nvm use $HOST_NODE_VERSION $ARCH && sleep 3 | |
npm ci --ignore-scripts | |
npm run build | |
npm run test:ci | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact | |
path: prebuilds/ | |
if-no-files-found: error | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo NPM_CACHE=$HOME/.npm >>$GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ env.NPM_CACHE }} | |
key: npm-linux | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: prebuilds | |
- run: | | |
npm ci --ignore-scripts | |
GITHUB_TOKEN=${{ github.token }} node ./publish-release.js |