Skip to content

Release 0.16.1

Release 0.16.1 #1002

Workflow file for this run

name: build
on:
pull_request:
push:
branches:
- master
schedule:
- cron: '30 17 * * 5' # Every Friday at 17:30 UTC
env:
CARGO_TERM_COLOR: always
NPM_CONFIG_COLOR: always
FORCE_COLOR: 3
RUSTFLAGS: -D warnings
jobs:
# Here we check that we can run `cargo test` on modern versions of
# Rust. Below we check that we can build the library on an old
# version as well.
ubuntu:
name: Ubuntu
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- nightly
features:
- no default features
- all features
- default features
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install ${{ matrix.rust }} Rust
run: rustup default ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- name: Test with ${{ matrix.features }}
run: |
FLAG="${{ matrix.features }}"
if [[ "$FLAG" = "default features" ]]; then
FLAG='' # Needs no flag
else
FLAG="--${FLAG// /-}" # Turn 'foo bar' into '--foo-bar'
fi
cargo test $FLAG
windows:
name: Windows (stable, default features)
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Test with default features
run: cargo test
msrv:
name: Minimum supported Rust version
runs-on: ubuntu-latest
strategy:
matrix:
features:
- no default features
- all features
- default features
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust 1.56 # MSRV from Cargo.toml
run: rustup default 1.56
- uses: Swatinem/rust-cache@v2
- name: Build with ${{ matrix.features }}
run: |
FLAG="${{ matrix.features }}"
if [[ "$FLAG" = "default features" ]]; then
FLAG='' # Needs no flag
else
FLAG="--${FLAG// /-}" # Turn 'foo bar' into '--foo-bar'
fi
cargo build $FLAG
# This builds benchmarks, which are not covered above.
build-benchmarks:
name: Build benchmarks
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
workspaces: benchmarks -> target
- name: Build all benchmarks
run: cargo bench --no-run
working-directory: benchmarks
build-documentation:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Build documentation and check intra-doc links
env:
RUSTDOCFLAGS: --deny rustdoc::broken_intra_doc_links
run: cargo doc --all-features --no-deps
fuzz:
name: Fuzz test
runs-on: ubuntu-latest
strategy:
matrix:
fuzz-target:
- fill_first_fit
- fill_optimal_fit
- fill_fast_path
- wrap_first_fit
- wrap_optimal_fit
- wrap_optimal_fit_usize
- wrap_fast_path
- unfill
- refill
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install nightly Rust
run: rustup default nightly
- uses: Swatinem/rust-cache@v2
with:
workspaces: fuzz -> target
- name: Install cargo-fuzz
run: cargo install cargo-fuzz
- name: Cache fuzz corpus
uses: actions/cache@v3
with:
path: fuzz/corpus/${{ matrix.fuzz-target }}
key: fuzz-corpus-${{ matrix.fuzz-target }}-${{ github.run_id }}
restore-keys: |
fuzz-corpus-${{ matrix.fuzz-target }}
- name: Run fuzz test
run: cargo fuzz run ${{ matrix.fuzz-target }} -- -max_total_time=30
- name: Minimize fuzz corpus
run: cargo fuzz cmin ${{ matrix.fuzz-target }}
binary-sizes:
name: Compute binary sizes
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
workspaces: examples/binary-sizes -> target
- name: Make binary size table
run: cargo run --example make-table
working-directory: examples/binary-sizes
wasm-build:
name: Build Wasm demo
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: Swatinem/rust-cache@v2
with:
workspaces: examples/wasm -> target
- name: Build textwrap-wasm-demo
run: wasm-pack build
working-directory: examples/wasm
- name: Install textwrap-wasm-demo-app dependencies
run: npm install
working-directory: examples/wasm/www
- name: Bundle textwrap-wasm-demo-app
run: npm run build
working-directory: examples/wasm/www
- name: Upload bundled textwrap-wasm-demo-app
uses: actions/upload-artifact@v3
with:
name: textwrap-wasm-demo-app
path: examples/wasm/www/dist
wasm-deploy:
name: Deploy Wasm demo
needs: wasm-build
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
ref: gh-pages
- name: Cleanup previous deployment
run: rm *
- name: Download bundled textwrap-wasm-demo-app
uses: actions/download-artifact@v3
with:
name: textwrap-wasm-demo-app
- name: Add and remove changed files
id: git-add
run: |
git restore build-info.json
git add --verbose --all
if git diff --staged --quiet --exit-code; then
echo "No changes found in textwrap-wasm-demo-app"
echo 'has-changes=false' >> $GITHUB_OUTPUT
else
echo 'has-changes=true' >> $GITHUB_OUTPUT
fi
- name: Record build info
if: steps.git-add.outputs.has-changes == 'true'
run: |
cat > build-info.json <<EOM
{"date": "$(date --utc --iso-8601)", "commit": "$GITHUB_SHA"}
EOM
git add --verbose --all
- name: Configure Git user
if: steps.git-add.outputs.has-changes == 'true'
run: |
git config user.name "Martin Geisler"
git config user.email "martin@geisler.net"
- name: Commit textwrap-wasm-demo-app changes
if: steps.git-add.outputs.has-changes == 'true'
run: git commit -m "Update Wasm demo to ${GITHUB_SHA::7}"
- name: Deploy textwrap-wasm-demo-app
if: steps.git-add.outputs.has-changes == 'true'
run: git push origin