Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow #18

Merged
merged 8 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/periodic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Periodic

on:
workflow_dispatch:
schedule:
- cron: 0 0 * * SUN

jobs:
test:
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
- runner: macOS-latest
target: x86_64-apple-darwin
- runner: macOS-latest
target: aarch64-apple-darwin
- runner: windows-latest
target: x86_64-pc-windows-msvc
toolchain: [stable, beta, nightly]
features: ["ipadic", "ko-dic", "cc-cedict"]
runs-on: ${{ matrix.platform.runner }}
steps:
- name: Run checkout
uses: actions/checkout@v4

- name: Install toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.platform.target }}
components: rustfmt, clippy

- name: Run test
run: cargo test --target "${{ matrix.platform.target }}" --features "${{ matrix.features }}"
85 changes: 85 additions & 0 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Regression

on:
workflow_dispatch:
push:
branches:
- main
pull_request:
types: [opened, synchronize]

jobs:
fmt:
name: Format
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
toolchain: [stable]
features: ["ipadic", "ko-dic", "cc-cedict"]
runs-on: ${{ matrix.platform.runner }}
steps:
- name: Run checkout
uses: actions/checkout@v4

- name: Install toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
components: rustfmt, clippy

- name: Check format
run: cargo fmt --all -- --check

check:
name: Check
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
toolchain: [stable]
features: ["ipadic", "ko-dic", "cc-cedict"]
runs-on: ${{ matrix.platform.runner }}
steps:
- name: Run checkout
uses: actions/checkout@v4

- name: Install toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
components: rustfmt, clippy

- name: Run check
run: cargo check --features "${{ matrix.features }}"

test:
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
- runner: macOS-latest
target: x86_64-apple-darwin
- runner: macOS-latest
target: aarch64-apple-darwin
- runner: windows-latest
target: x86_64-pc-windows-msvc
toolchain: [stable]
features: ["ipadic", "ko-dic", "cc-cedict"]
runs-on: ${{ matrix.platform.runner }}
steps:
- name: Run checkout
uses: actions/checkout@v4

- name: Install toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.platform.target }}
components: rustfmt, clippy

- name: Run test
run: cargo test --target "${{ matrix.platform.target }}" --features "${{ matrix.features }}"
61 changes: 49 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,22 @@ jobs:
- runner: ubuntu-latest
target: ppc64le
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Run checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --features=ipadic,ko-dic,cc-cedict
sccache: 'true'
manylinux: auto
# env:
# CFLAGS_aarch64_unknown_linux_gnu: ${{ matrix.platform.target == 'aarch64' && '-march=armv8-a' || '' }}

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
Expand All @@ -67,17 +70,22 @@ jobs:
- runner: ubuntu-latest
target: armv7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Run checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --features=ipadic,ko-dic,cc-cedict
sccache: 'true'
manylinux: musllinux_1_2

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
Expand All @@ -94,17 +102,22 @@ jobs:
- runner: windows-latest
target: x86
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Run checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: ${{ matrix.platform.target }}

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --features=ipadic,ko-dic,cc-cedict
sccache: 'true'

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
Expand All @@ -121,16 +134,21 @@ jobs:
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Run checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --features=ipadic,ko-dic,cc-cedict
sccache: 'true'

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
Expand All @@ -140,12 +158,15 @@ jobs:
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run checkout
uses: actions/checkout@v4

- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist

- name: Upload sdist
uses: actions/upload-artifact@v4
with:
Expand All @@ -165,11 +186,14 @@ jobs:
# Used to generate artifact attestation
attestations: write
steps:
- uses: actions/download-artifact@v4
- name: Download build artifacts
uses: actions/download-artifact@v4

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-path: 'wheels-*/*'

- name: Publish to PyPI
if: "startsWith(github.ref, 'refs/tags/')"
uses: PyO3/maturin-action@v1
Expand All @@ -178,3 +202,16 @@ jobs:
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*

- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
with:
files: ./dist/*
name: Release ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}