add encode_raw, fix emitter bugs, add round-trip tests #13
This file contains hidden or 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] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| # Build and test on native targets that developers use locally. | |
| test: | |
| name: Test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # rdkafka (spear-lib) requires cmake + curl headers on Linux. | |
| - name: Install build dependencies (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: sudo apt-get update && sudo apt-get install -y cmake libcurl4-openssl-dev | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.target }}-cargo- | |
| - name: Build | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Test | |
| run: cargo test --release --target ${{ matrix.target }} | |
| # Verify the musl target compiles on every push so issues don't | |
| # surface for the first time during a release build. | |
| # | |
| # spear-gen is pure Rust so musl-tools is sufficient here. | |
| # NOTE: when spear-gateway is added, this job will also need | |
| # cmake + libcurl4-openssl-dev (same as the test job above). | |
| check-musl: | |
| name: Check (x86_64-unknown-linux-musl) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install musl tools | |
| run: sudo apt-get update && sudo apt-get install -y musl-tools | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: x86_64-unknown-linux-musl | |
| - name: Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: musl-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| musl-cargo- | |
| - name: Check (musl) | |
| run: cargo check --target x86_64-unknown-linux-musl -p spear-gen | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # rdkafka (spear-lib) requires cmake + curl headers to compile. | |
| - name: Install build dependencies | |
| run: sudo apt-get update && sudo apt-get install -y cmake libcurl4-openssl-dev | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - name: Check formatting | |
| run: cargo fmt -- --check | |
| - name: Clippy | |
| run: cargo clippy -- -D warnings |