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
32 changes: 32 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 2

updates:
# Security fixes arrive as dependency bumps, so an unattended project needs
# something that opens the pull request on its own.
- package-ecosystem: cargo
directory: "/"
schedule:
interval: weekly
day: saturday
time: "08:00"
timezone: Europe/Paris
open-pull-requests-limit: 5
groups:
minor-and-patch:
update-types: [minor, patch]

# The actions in the workflows are dependencies too, and the ones that go
# stale quietly are the ones nobody thinks of.
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
day: saturday
time: "08:00"
timezone: Europe/Paris
ignore:
# The branches of this action are toolchain names, not releases: @stable
# installs stable and @1.97 installs 1.97. Dependabot reads the second as
# a version and offers to raise it, which would quietly stop the job from
# testing the minimum toolchain Cargo.toml promises.
- dependency-name: dtolnay/rust-toolchain
8 changes: 8 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!-- What changes, and why. -->

## Checklist

- [ ] `cargo test`, `cargo clippy --all-targets -- -D warnings` and `cargo fmt --all -- --check` pass
- [ ] The window builds what it shows: no picture or drawing fetched or committed, no one else's data in the repository
- [ ] Everything the window shows is in English
- [ ] The README says what changed, if it changes what cellstage shows or how it runs
110 changes: 110 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: CI

on:
push:
branches: [main]
pull_request:

# A new push replaces the run it supersedes instead of queueing behind it.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# The workflow only reads the repository. Nothing here needs write access.
permissions:
contents: read

env:
CARGO_TERM_COLOR: always
# A warning that nobody reads is a warning that does not exist.
RUSTFLAGS: -D warnings

jobs:
lint:
name: Format, lints and docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2

# What winit links against to open a window on Linux.
- name: System libraries
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends libwayland-dev libxkbcommon-dev

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

- name: Lints
run: cargo clippy --all-targets

# Catches broken intra-doc links.
- name: Documentation
run: cargo doc --no-deps
env:
RUSTDOCFLAGS: -D warnings

# cellstage shows only what it builds, and fetches what it reads,
# proteins and pathways, into the user's cache. Neither someone else's
# data nor a picture nor a drawing belongs in the repository.
- name: No data, pictures or drawings in the repository
run: |
if git ls-files | grep -E -i '\.(csv|tsv|xlsx|xls|parquet|h5|hdf5|mat|pdb|cif|bcif|png|jpe?g|gif|webp|tiff?|svg)$'; then
echo "data, pictures or drawings are committed: cellstage fetches what it reads and builds what it shows"
exit 1
fi

test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: System libraries
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends libwayland-dev libxkbcommon-dev
# No test opens a window or reaches the network, so none needs a display.
- name: Tests
run: cargo test

msrv:
name: Oldest supported Rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# The ref is the toolchain: this installs Rust 1.97. Keep it in step with
# rust-version in Cargo.toml, which is the value that binds. Dependabot is
# told to leave it alone in dependabot.yml.
- uses: dtolnay/rust-toolchain@1.97
- uses: Swatinem/rust-cache@v2

# The ref above and rust-version state the same fact in two places, and two
# places drift. This makes them disagree loudly instead of leaving the job
# quietly testing a toolchain nobody promised.
- name: The toolchain is the one the manifest promises
run: |
declared=$(sed -n 's/^rust-version *= *"\([^"]*\)".*/\1/p' Cargo.toml | head -1 | cut -d. -f1,2)
installed=$(rustc --version | cut -d' ' -f2 | cut -d. -f1,2)
echo "Cargo.toml says $declared, this runner has $installed"
if [ -z "$declared" ]; then
echo "::error::no rust-version found in Cargo.toml"
exit 1
fi
if [ "$declared" != "$installed" ]; then
echo "::error::Cargo.toml promises Rust $declared but CI installed $installed"
exit 1
fi

- name: System libraries
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends libwayland-dev libxkbcommon-dev

- name: Build
run: cargo check --all-targets
26 changes: 26 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Security

# Dependencies do not have to change for the news about them to change. An
# advisory published against a crate that has been in Cargo.lock for months is
# exactly the case a push-triggered workflow never catches, hence the schedule.
on:
push:
branches: [main]
pull_request:
schedule:
# Saturday morning, Paris time, in step with dependabot.yml.
- cron: "0 6 * * 6"
workflow_dispatch:

permissions:
contents: read

jobs:
deny:
name: Advisories, licences, sources
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ rustc-ice-*.txt
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Cargo settings local to one machine, such as which pkg-config to use
/.cargo
Loading
Loading