Skip to content

πŸ’© Disable macOS #123

πŸ’© Disable macOS

πŸ’© Disable macOS #123

Workflow file for this run

---
"on":
push:
paths-ignore:
- "**.md"
- docs/*
pull_request:
paths-ignore:
- "**.md"
- docs/*
workflow_dispatch:
# https://github.com/softprops/action-gh-release/issues/236
permissions:
contents: write
env:
files: dist/*
python-version: 3.x
cache: pip
jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
shell: bash
# SystemError: PyDescr_NewMember used with Py_RELATIVE_OFFSET
# - runs-on: macos-latest
# shell: bash
- runs-on: windows-latest
shell: msys2
runs-on: ${{matrix.runs-on}}
defaults:
run:
shell: ${{matrix.shell}} {0}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{env.python-version}}
cache: ${{env.cache}}
- uses: msys2/setup-msys2@v2
if: runner.os == 'Windows'
- name: Install dependencies
if: runner.os == 'Linux'
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
- name: Test
run: |
pip install .[dev]
pytest --cov
- uses: codecov/codecov-action@v4
build:
needs: test
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
shell: bash
# - runs-on: macos-latest
# shell: bash
- runs-on: windows-latest
shell: msys2
runs-on: ${{matrix.runs-on}}
defaults:
run:
shell: ${{matrix.shell}} {0}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{env.python-version}}
cache: ${{env.cache}}
- uses: msys2/setup-msys2@v2
if: runner.os == 'Windows'
- name: Install dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get -y update
sudo apt-get -y install librime-dev rename python3-build
- name: Install dependencies
if: runner.os == 'macOS'
run: |
brew tap tonyfettes/homebrew-rime
brew install librime python-build
- name: Install dependencies
if: runner.os == 'Windows'
run: |
pacman -Sy --noconfirm mingw-w64-x86_64-gcc \
mingw-w64-x86_64-pkg-config \
mingw-w64-x86_64-ninja \
mingw-w64-x86_64-librime \
mingw-w64-x86_64-python-build
- name: Build
run: |
perl -pi -e"s/(?<=version: ')[^']+/$GITHUB_REF_NAME/g" meson.build
pyproject-build
- if: runner.os == 'Linux'
run: |
rename s/linux/manylinux_2_17/ dist/*
- if: runner.os == 'Windows'
run: |
for file in dist/*
do
new_name=$(echo "$file" | sed 's/mingw_x86_64/win_amd64/g')
if [ "$file" != "$new_name" ]; then
mv "$file" "$new_name"
echo "Renamed $file to $new_name"
fi
done
- uses: actions/upload-artifact@v4
with:
name: artifact-${{matrix.runs-on}}
path: |
${{env.files}}
publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: artifact-*
merge-multiple: true
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.ref, 'refs/tags/')
with:
password: ${{secrets.PYPI_API_TOKEN}}
- uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
# body_path: build/CHANGELOG.md
files: |
${{env.files}}
deploy-aur:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: Freed-Wu/[email protected]
with:
package_name: python-pyrime
ssh_private_key: ${{secrets.AUR_SSH_PRIVATE_KEY}}
deploy-nur:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Trigger Workflow
run: >
curl -X POST -d '{"ref": "main"}'
-H "Accept: application/vnd.github.v3+json"
-H "Authorization: Bearer ${{secrets.GH_TOKEN}}"
https://api.github.com/repos/Freed-Wu/nur-packages/actions/workflows/version.yml/dispatches
deploy-ppa:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- name: Build
run: |
n="pyrime-$GITHUB_REF_NAME"
cd ..
mv pyrime "$n"
tar vcaf ./"$n".tar.gz "$n"
mv ./*.tar.* "$n"
mv "$n" pyrime
- uses: Freed-Wu/publish-ppa-package@main
with:
repository: freedwu/rime
extra_ppa: freedwu/rime
gpg_private_key: ${{secrets.GPG_PRIVATE_KEY}}
gpg_passphrase: ${{secrets.GPG_PASSPHRASE}}
tarball: ./*.tar.*
deb_email: ${{secrets.DEB_EMAIL}}
deb_fullname: freedwu
debmake_arguments: -b pyrime:python3