Skip to content

Commit

Permalink
💚 Enable CI for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Dec 5, 2024
1 parent ef7d035 commit e881fbe
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 7 deletions.
65 changes: 59 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,89 @@ permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
build:
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
shell: bash
- runs-on: macos-latest
shell: bash
# gyp only support msbuild/msvc,
# pkg-config --libs --msvc-syntax rime
# give path of rime.lib
# however, msys2 uses rime.dll.a
# force gyp to use make
# gyp tells no toolset found
# - runs-on: windows-latest
# shell: msys2
runs-on: ${{matrix.runs-on}}
defaults:
run:
shell: ${{matrix.shell}} {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
if: runner.os == 'Windows'
- name: Install dependencies
if: runner.os == 'Windows'
run: |
pacman -Sy --noconfirm mingw-w64-x86_64-pkg-config \
mingw-w64-x86_64-librime mingw-w64-x86_64-nodejs
- name: Enable corepack
run: |
corepack enable
- uses: actions/setup-node@v4
# if use cmd, not msys2
if: runner.os != 'Windows'
with:
node-version: latest
registry-url: https://registry.npmjs.org
cache: 'yarn'
- name: Install dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get -y update
sudo apt-get -y install librime-dev librime1
- uses: cachix/install-nix-action@v24
if: runner.os == 'macOS'
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{secrets.GITHUB_TOKEN}}
- name: Install dependencies
if: runner.os == 'macOS'
run: |
nix-env -if'<nixpkgs>' librime
- name: Build
run: |
yarn
yarn pack
PKG_CONFIG_PATH="$HOME/.nix-profile/lib/pkgconfig" yarn install
PKG_CONFIG_PATH="$HOME/.nix-profile/lib/pkgconfig" yarn pack
env:
NODE_ENV: production
- uses: actions/upload-artifact@v4
with:
name: artifact-${{matrix.runs-on}}
path: |
prebuilds/*
publish:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
pattern: artifact-*
merge-multiple: true
path: prebuilds
- uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: '*.tgz'
- name: Publish
env:
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
NODE_ENV: production
if: startsWith(github.ref, 'refs/tags/')
run: |
npm publish
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"coc": "^0.0.80"
},
"scripts": {
"install": "node-gyp clean && node-gyp configure -- -fcompile_commands_json && ln -s Release/compile_commands.json build && node-gyp configure -- -fmake && make -Cbuild",
"install": "node-gyp-build && node-gyp configure -- -fcompile_commands_json && ln -s Release/compile_commands.json build",
"lint": "eslint src --ext ts",
"clean": "rimraf lib",
"watch": "node esbuild.js --watch",
Expand Down

0 comments on commit e881fbe

Please sign in to comment.