feat: type narrowing with hasattr
#210
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- "doc/**" | |
- ".github/**" | |
- ".assets/**" | |
- ".cargo/**" | |
- "**.md" | |
- "**.yml" | |
- "LICENSE-**" | |
- ".gitmessage" | |
- ".pre-commit-config.yaml" | |
pull_request: | |
branches: [main] | |
paths-ignore: | |
- "doc/**" | |
- ".github/**" | |
- ".assets/**" | |
- ".cargo/**" | |
- "**.md" | |
- "**.yml" | |
- "LICENSE-**" | |
- ".gitmessage" | |
- ".pre-commit-config.yaml" | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11.3'] | |
runs-on: ${{ matrix.os }} | |
env: | |
RUST_BACKTRACE: full | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: Swatinem/rust-cache@v2 | |
- run: rustup update stable | |
- run: cargo test --features backtrace --all --exclude els --verbose -- --include-ignored --nocapture | |
# FIXME: Currently, when running ELS tests in the GitHub actions environment, | |
# the tests fail probabilistically on Windows and MacOS. | |
# This is likely due to a delay in processing timing. | |
# We will ignore this error and just retry until the ELS implementation is improved. | |
- run: cargo test --package els -- --nocapture || cargo test --package els -- --nocapture | |
build-check: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Swatinem/rust-cache@v2 | |
- run: rustup update stable | |
- run: cargo build --all --all-targets --verbose | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Swatinem/rust-cache@v2 | |
- run: rustup update stable | |
- name: cargo clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --all --all-targets --verbose -- -D warnings | |
publish-nightly: | |
runs-on: ubuntu-latest | |
if: contains(github.event.head_commit.message, 'update version (nightly') | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Swatinem/rust-cache@v2 | |
- run: rustup update stable | |
- name: Check semver | |
run: | | |
cargo install cargo-semver-checks --locked | |
cargo semver-checks --all | |
- name: cargo publish | |
run: | | |
cargo login ${{ secrets.CARGO_TOKEN }} | |
./cargo_publish.sh |