Skip to content

Commit

Permalink
Update CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
jonghwanhyeon committed Apr 10, 2024
1 parent 6acff62 commit e5a808a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 41 deletions.
65 changes: 29 additions & 36 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,27 @@ jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
CIBW_ARCHS_MACOS: "x86_64 arm64"
strategy:
matrix:
os: [ubuntu-20.04, macos-11]
cibw_archs: [auto64]
include:
- os: ubuntu-20.04
cibw_archs: aarch64
os: [ubuntu-latest, macos-13, macos-14]

steps:
- name: Set up QEMU
if: matrix.cibw_archs == 'aarch64'
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
- uses: actions/checkout@v4

- uses: actions/checkout@v3
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
fetch-depth: 0
platforms: all

- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_ARCHS_LINUX: auto aarch64

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_windows_wheels:
Expand All @@ -46,16 +39,14 @@ jobs:
MECAB_PATH: "C:\\mecab"
strategy:
matrix:
os: [windows-2019]
os: [windows-latest]
arch: [x86, AMD64, ARM64]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
Expand All @@ -66,50 +57,52 @@ jobs:
--wheel-dir {dest_dir}
{wheel}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_windows_wheels, build_sdist]
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
pattern: cibw-*
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@v1.8.11
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
skip-existing: true
skip_existing: true

upload_release:
needs: [build_wheels, build_windows_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
pattern: cibw-*
path: dist
merge-multiple: true

- name: Release
uses: softprops/action-gh-release@v1
Expand Down
3 changes: 0 additions & 3 deletions scripts/install_mecab_ko.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ def build(prefix: Optional[str] = None):
configure(*configure_options)

build_options = ["--jobs", str(os.cpu_count())]
if platform.system() == "Darwin":
# Add -arch options to support universal binary
build_options.append("CXXFLAGS=-O3 -Wall -arch x86_64 -arch arm64")
make(*build_options)


Expand Down
4 changes: 2 additions & 2 deletions scripts/repair_wheel_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from pathlib import Path
from typing import List

# Reference: https://github.com/actions/runner-images/blob/main/images/win/Windows2019-Readme.md
VISUAL_STUDIO_PATH = r"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"
# Reference: https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md
VISUAL_STUDIO_PATH = r"C:\Program Files\Microsoft Visual Studio\2022\Enterprise"


def parse_arguments() -> argparse.Namespace:
Expand Down

0 comments on commit e5a808a

Please sign in to comment.