From 998e16ae0af25c74aee1869db6a79ec27d7f347a Mon Sep 17 00:00:00 2001 From: "Wu, Zhenyu" Date: Tue, 3 Dec 2024 10:59:21 +0800 Subject: [PATCH] :white_check_mark: Fix pytest on macos Fix #2 --- .github/workflows/main.yml | 41 ++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6690d8e..5350921 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,9 +27,8 @@ jobs: include: - runs-on: ubuntu-latest shell: bash - # SystemError: PyDescr_NewMember used with Py_RELATIVE_OFFSET - # - runs-on: macos-latest - # shell: bash + - runs-on: macos-latest + shell: bash - runs-on: windows-latest shell: msys2 runs-on: ${{matrix.runs-on}} @@ -49,20 +48,26 @@ jobs: run: | sudo apt-get -y update sudo apt-get -y install librime-dev - - name: Install dependencies - if: runner.os == 'macOS' - run: | - brew tap tonyfettes/homebrew-rime - brew install librime - 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-python-pip \ mingw-w64-x86_64-ninja mingw-w64-x86_64-gcc + - 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'' librime - name: Test run: | - pip install .[dev] + PKG_CONFIG_PATH="$HOME/.nix-profile/lib/pkgconfig" pip install .[dev] pytest --cov - uses: codecov/codecov-action@v4 @@ -95,11 +100,6 @@ jobs: run: | sudo apt-get -y update sudo apt-get -y install librime-dev - - name: Install dependencies - if: runner.os == 'macOS' - run: | - brew tap tonyfettes/homebrew-rime - brew install librime - name: Install dependencies if: runner.os == 'Windows' # Dist currently only works with Git or Mercurial repos @@ -109,6 +109,17 @@ jobs: mingw-w64-x86_64-ninja \ mingw-w64-x86_64-librime \ mingw-w64-x86_64-python-build git + - 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'' librime - name: Upgrade version if: startsWith(github.ref, 'refs/tags/') run: | @@ -134,7 +145,7 @@ jobs: pip install build - name: Build run: | - pyproject-build -w + PKG_CONFIG_PATH="$HOME/.nix-profile/lib/pkgconfig" pyproject-build -w - if: runner.os == 'Linux' run: | pyproject-build -s