name: Build and Test
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build
- name: Test
run: cargo run --example is_utf8
- name: Test
run: |
echo "Current locale:"
cargo run --example run_subprocess -- target/debug/examples/is_utf8
echo "Setting locale to C:"
LC_ALL=C cargo run --example run_subprocess -- target/debug/examples/is_utf8
echo "Setting locale to en_US:"
LC_ALL=en_US cargo run --example run_subprocess -- target/debug/examples/is_utf8
echo "Setting locale to C.UTF-8:"
LC_ALL=C.UTF-8 cargo run --example run_subprocess -- target/debug/examples/is_utf8
build-macos:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build
- name: Test
run: cargo run --example is_utf8
- name: Test
run: |
echo "Current locale:"
cargo run --example run_subprocess -- target/debug/examples/is_utf8
echo "Setting locale to C:"
LC_ALL=C cargo run --example run_subprocess -- target/debug/examples/is_utf8
echo "Setting locale to en_US:"
LC_ALL=en_US cargo run --example run_subprocess -- target/debug/examples/is_utf8
echo "Setting locale to C.UTF-8:"
LC_ALL=C.UTF-8 cargo run --example run_subprocess -- target/debug/examples/is_utf8
build-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build
- name: Test
run: cargo run --example is_utf8
- name: Test
run: |
echo "Current code page:"
chcp
cargo run --example run_subprocess -- target/debug/examples/is_utf8
echo "Setting code page to 65001 (UTF-8):"
chcp 65001
cargo run --example run_subprocess -- target/debug/examples/is_utf8
echo "Setting code page to 1252 (Latin-1):"
chcp 1252
cargo run --example run_subprocess -- target/debug/examples/is_utf8
echo "Setting code page to 437 (DOS US):"
chcp 437
cargo run --example run_subprocess -- target/debug/examples/is_utf8