Skip to content

build in ci

build in ci #155

Workflow file for this run

name: Check
on: [push, pull_request]
jobs:
test:
name: Run with test inputs
strategy:
fail-fast: false
matrix:
toolchain:
- stable
- beta
- nightly
cargo_args:
- ""
- "--release"
- "--all-features"
- "--all-features --release"
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Update env
shell: bash
run: echo 'CARGO_ARGS=${{ matrix.cargo_args }} --color=always' >> "${GITHUB_ENV}"
- name: Update rust
shell: bash
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Run tests
shell: bash
run: cargo test
- name: Build project
shell: bash
run: cargo build --verbose --release
- name: Run benchmark script
shell: bash
run: ./benchmark.sh
- name: Run benchmark script
shell: bash
run: ./benchmark.sh
lint_code:
name: Clippy
runs-on: ubuntu-latest
permissions: {}
strategy:
fail-fast: false
matrix:
toolchain:
- stable
cargo_args:
- ""
- "--all-features"
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Update rust
shell: bash
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Run cargo clippy
run: cargo clippy --color=always ${{ matrix.cargo_args }} -- -D warnings
build_python:
name: Build Python
runs-on: ubuntu-latest
permissions: {}
strategy:
fail-fast: false
matrix:
toolchain:
- stable
- beta
- nightly
python-version:
- "3.12"
- "3.13"
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Update rust
shell: bash
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: install
run: python3 -m pip install .
- name: import
run: |
set -xeu
if python3 -c 'import sys, hangman_solver as hs; print(*hs.solve("_____", ["a"], hs.Language.De, 999999).words, sep="\n")' | grep a ; then
echo "Failure"
exit 1
else
echo "Nothing found!"
fi
build_manylinux_wheels:
name: Build manylinux wheels
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: PyO3/maturin-action@v1
with:
command: build
args: --release
manylinux: "2014"
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
improve_code:
name: Improve and format the code
runs-on: ubuntu-latest
if: github.ref_type == 'branch'
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Update rust
shell: bash
run: rustup update stable && rustup default stable
- name: Improve the code
run: cargo clippy --fix || cargo clippy --fix --all-features
- name: Format the code
run: cargo fmt
- name: Update env
run: |
D=$(python -c "print((_dt:=__import__('datetime')).datetime.now(tz=_dt.timezone.utc).replace(minute=0, second=0, microsecond=0).isoformat())")
echo "GIT_AUTHOR_DATE=${D}" >> "${GITHUB_ENV}"
echo "GIT_COMMITTER_DATE=${D}" >> "${GITHUB_ENV}"
- name: Push changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "format code"
commit_user_name: Bot
commit_user_email:
commit_author: Bot <>