Skip to content

refactor solve hangman #97

refactor solve hangman

refactor solve hangman #97

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: Build project
shell: bash
run: cargo build --verbose --release
- name: Run benchmark script
shell: bash
run: bash ./benchmark.sh
- name: Run benchmark script
shell: bash
run: bash ./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.10"
- 3.12
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 build
run: python3 -m pip install build
- name: Build python
run: python3 -m build
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 <>