Skip to content

Commit

Permalink
Add checking of 32-bit targets (temporary disable all other)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingun committed Jun 24, 2024
1 parent 5306c4a commit 9acb61a
Showing 1 changed file with 100 additions and 91 deletions.
191 changes: 100 additions & 91 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,103 +3,112 @@ name: Rust
on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check fmt
run: cargo fmt -- --check
# lint:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Check fmt
# run: cargo fmt -- --check

msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
- run: cargo check
# msrv:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/[email protected]
# - run: cargo check

minimal-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install tools
run: cargo install cargo-hack cargo-minimal-versions
- name: Install nightly rust
uses: dtolnay/rust-toolchain@nightly
- name: Check with minimal versions
run: cargo minimal-versions check
- name: Check with minimal versions (serialize)
run: cargo minimal-versions check --features serialize
- name: Check with minimal versions (encoding)
run: cargo minimal-versions check --features encoding
- name: Check with minimal versions (async-tokio)
run: cargo minimal-versions check --features async-tokio
# minimal-versions:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Install tools
# run: cargo install cargo-hack cargo-minimal-versions
# - name: Install nightly rust
# uses: dtolnay/rust-toolchain@nightly
# - name: Check with minimal versions
# run: cargo minimal-versions check
# - name: Check with minimal versions (serialize)
# run: cargo minimal-versions check --features serialize
# - name: Check with minimal versions (encoding)
# run: cargo minimal-versions check --features encoding
# - name: Check with minimal versions (async-tokio)
# run: cargo minimal-versions check --features async-tokio

test:
strategy:
matrix:
platform: [ubuntu-latest, windows-latest]
# test:
# strategy:
# matrix:
# platform: [ubuntu-latest, windows-latest]

runs-on: ${{ matrix.platform }}
# runs-on: ${{ matrix.platform }}

# Set variable to enable coverage
env:
RUSTFLAGS: -C instrument-coverage
# # Set variable to enable coverage
# env:
# RUSTFLAGS: -C instrument-coverage

steps:
- uses: actions/checkout@v4
- name: Install coverage reporter (llvm-tools-preview)
if: runner.os == 'Linux'
run: rustup component add llvm-tools-preview
- name: Install coverage reporter (grcov)
if: runner.os == 'Linux'
run: cargo install grcov
# steps:
# - uses: actions/checkout@v4
# - name: Install coverage reporter (llvm-tools-preview)
# if: runner.os == 'Linux'
# run: rustup component add llvm-tools-preview
# - name: Install coverage reporter (grcov)
# if: runner.os == 'Linux'
# run: cargo install grcov

- name: Build
run: cargo build
- name: Build benchmarks
run: cargo bench --no-run
- name: Build benchmarks (compare)
working-directory: compare
run: cargo bench --no-run
- name: Run tests + benchmarks
run: cargo test --all-features --benches --tests
# - name: Build
# run: cargo build
# - name: Build benchmarks
# run: cargo bench --no-run
# - name: Build benchmarks (compare)
# working-directory: compare
# run: cargo bench --no-run
# - name: Run tests + benchmarks
# run: cargo test --all-features --benches --tests

- name: Run tests (no features)
env:
LLVM_PROFILE_FILE: coverage/no-features-%p-%m.profraw
run: cargo test --no-default-features
- name: Run tests (serialize)
env:
LLVM_PROFILE_FILE: coverage/serialize-%p-%m.profraw
run: cargo test --features serialize
- name: Run tests (serialize+encoding)
env:
LLVM_PROFILE_FILE: coverage/serialize-encoding-%p-%m.profraw
run: cargo test --features serialize,encoding
- name: Run tests (serialize+escape-html)
env:
LLVM_PROFILE_FILE: coverage/serialize-escape-html-%p-%m.profraw
run: cargo test --features serialize,escape-html
- name: Run tests (all features)
env:
LLVM_PROFILE_FILE: coverage/all-features-%p-%m.profraw
run: cargo test --all-features
- name: Prepare coverage information for upload
if: runner.os == 'Linux'
run: |
grcov ./coverage \
-s . \
--binary-path ./target/debug/ \
--branch \
--ignore-not-existing \
--ignore 'tests/*' \
-o ./coverage.lcov
- name: Upload coverage to codecov.io
if: runner.os == 'Linux'
uses: codecov/codecov-action@v4
with:
files: ./coverage.lcov
flags: unittests
verbose: true
continue-on-error: true
# - name: Run tests (no features)
# env:
# LLVM_PROFILE_FILE: coverage/no-features-%p-%m.profraw
# run: cargo test --no-default-features
# - name: Run tests (serialize)
# env:
# LLVM_PROFILE_FILE: coverage/serialize-%p-%m.profraw
# run: cargo test --features serialize
# - name: Run tests (serialize+encoding)
# env:
# LLVM_PROFILE_FILE: coverage/serialize-encoding-%p-%m.profraw
# run: cargo test --features serialize,encoding
# - name: Run tests (serialize+escape-html)
# env:
# LLVM_PROFILE_FILE: coverage/serialize-escape-html-%p-%m.profraw
# run: cargo test --features serialize,escape-html
# - name: Run tests (all features)
# env:
# LLVM_PROFILE_FILE: coverage/all-features-%p-%m.profraw
# run: cargo test --all-features
# - name: Prepare coverage information for upload
# if: runner.os == 'Linux'
# run: |
# grcov ./coverage \
# -s . \
# --binary-path ./target/debug/ \
# --branch \
# --ignore-not-existing \
# --ignore 'tests/*' \
# -o ./coverage.lcov
# - name: Upload coverage to codecov.io
# if: runner.os == 'Linux'
# uses: codecov/codecov-action@v4
# with:
# files: ./coverage.lcov
# flags: unittests
# verbose: true
# continue-on-error: true

# Check that tests that are sensitive to target are passed
x86:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run some tests on 32-bit target
run: cargo test --target i686-unknown-linux-gnu --test issues
- name: Run some tests on 32-bit target (async-tokio)
run: cargo test --target i686-unknown-linux-gnu --features async-tokio --test async-tokio

0 comments on commit 9acb61a

Please sign in to comment.