Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# The schema test compares the checked-in schema byte-for-byte against the string the
# Rust model generates, which always uses LF. Without this, a Windows checkout rewrites
# the file to CRLF and `checked_in_schema_matches_the_model` fails on that alone.
*.json text eol=lf
*.rs text eol=lf
*.yml text eol=lf
82 changes: 82 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: CI

# Build and test on every push to main and every pull request.
#
# The `simplicityhl` git dependency dominates build time, so both jobs lean on
# `Swatinem/rust-cache` and run with `--locked`: the lock file pins that dependency to
# an exact rev, and a build that silently updated it would no longer be testing what a
# release builds.
on:
push:
branches: [main]
pull_request:

# A new push to a PR makes the in-flight run obsolete; don't pay to finish it.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
# Linux is the reference platform; Windows is what the project is developed on
# and what `tests/cli_parses_examples.rs` exercises path handling against.
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v5

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo build
uses: Swatinem/rust-cache@v2

# Plain `cargo test` (not `--all-targets`) so doc-tests run too. This also
# compiles `examples/`, which is what keeps `gen_schema` from bit-rotting.
#
# Deliberately NOT `--all-features`: the `simplicity_eval` feature needs the
# `compile_function` fork of SimplicityHL, and does not compile against the
# upstream master rev this workspace pins. See txmanifest_lib/Cargo.toml.
- name: Test
run: cargo test --workspace --locked

lint:
name: lint
runs-on: ubuntu-latest
timeout-minutes: 30
# NON-BLOCKING for now: the tree is not yet rustfmt-clean and clippy reports 18
# warnings (all warnings, no errors). This job exists to make both visible on a PR
# without gating merges on a cleanup nobody has done yet.
#
# To turn it into a real gate: run `cargo fmt --all`, clear the clippy warnings
# (`cargo clippy --fix` handles most), then delete this line and add
# `-- -D warnings` to the clippy step.
continue-on-error: true

steps:
- uses: actions/checkout@v5

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Cache cargo build
uses: Swatinem/rust-cache@v2

- name: Formatting
run: cargo fmt --all --check

- name: Clippy
# `--all-targets` so tests and examples are linted too — that is where the
# shadowed-binding and unused-variable classes of bug actually show up.
run: cargo clippy --workspace --all-targets --locked
4 changes: 4 additions & 0 deletions txmanifest_lib/tests/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ fn checked_in_schema_matches_the_model() {
path.display()
)
});
// A Windows checkout can rewrite the file to CRLF (see .gitattributes); the model
// always emits LF, so compare on normalized line endings rather than failing on
// the checkout config.
let on_disk = on_disk.replace("\r\n", "\n");

assert_eq!(
on_disk,
Expand Down
Loading