Compare commits
4 commits
ace6a0faf9
...
f30f7c48aa
Author | SHA1 | Date | |
---|---|---|---|
f30f7c48aa | |||
3b8876f39e | |||
3700c0ff49 | |||
2c1e173641 |
2 changed files with 106 additions and 8 deletions
98
.woodpecker.yml
Normal file
98
.woodpecker.yml
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
variables:
|
||||||
|
- &rust_image "docker.io/rust:1.76"
|
||||||
|
- &slow_check_paths
|
||||||
|
- path:
|
||||||
|
# rust source code
|
||||||
|
- "crates/**"
|
||||||
|
- "src/**"
|
||||||
|
- "tests/**"
|
||||||
|
- "**/Cargo.toml"
|
||||||
|
- "Cargo.lock"
|
||||||
|
# database migrations
|
||||||
|
- "migrations/**"
|
||||||
|
# config files and scripts used by ci
|
||||||
|
- ".woodpecker.yml"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
toml_fmt:
|
||||||
|
image: docker.io/tamasfe/taplo:0.8.1
|
||||||
|
commands:
|
||||||
|
- taplo format --check
|
||||||
|
|
||||||
|
|
||||||
|
cargo_fmt:
|
||||||
|
image: docker.io/rustlang/rust:nightly
|
||||||
|
environment:
|
||||||
|
# store cargo data in repo folder so that it gets cached between steps
|
||||||
|
CARGO_HOME: .cargo_home
|
||||||
|
commands:
|
||||||
|
# need make existing toolchain available
|
||||||
|
- cargo +nightly fmt -- --check
|
||||||
|
|
||||||
|
cargo_machete:
|
||||||
|
image: docker.io/rustlang/rust:nightly
|
||||||
|
commands:
|
||||||
|
- wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
|
||||||
|
- tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz
|
||||||
|
- cp cargo-binstall /usr/local/cargo/bin
|
||||||
|
- cargo binstall -y cargo-machete
|
||||||
|
- cargo machete
|
||||||
|
|
||||||
|
ignored_files:
|
||||||
|
image: docker.io/alpine:3
|
||||||
|
commands:
|
||||||
|
- apk add git
|
||||||
|
- IGNORED=$(git ls-files --cached -i --exclude-standard)
|
||||||
|
- if [[ "$IGNORED" ]]; then echo "Ignored files present:\n$IGNORED\n"; exit 1; fi
|
||||||
|
|
||||||
|
check:
|
||||||
|
image: *rust_image
|
||||||
|
environment:
|
||||||
|
CARGO_HOME: .cargo_home
|
||||||
|
commands:
|
||||||
|
- cargo check
|
||||||
|
when: *slow_check_paths
|
||||||
|
|
||||||
|
cargo_clippy:
|
||||||
|
image: *rust_image
|
||||||
|
environment:
|
||||||
|
CARGO_HOME: .cargo_home
|
||||||
|
commands:
|
||||||
|
- rustup component add clippy
|
||||||
|
- cargo clippy --tests --all-targets -- -D warnings
|
||||||
|
when: *slow_check_paths
|
||||||
|
|
||||||
|
cargo_build:
|
||||||
|
image: *rust_image
|
||||||
|
environment:
|
||||||
|
CARGO_HOME: .cargo_home
|
||||||
|
commands:
|
||||||
|
- cargo build
|
||||||
|
- mv target/debug/lemmy_server target/lemmy_server
|
||||||
|
when: *slow_check_paths
|
||||||
|
|
||||||
|
cargo_test:
|
||||||
|
image: *rust_image
|
||||||
|
environment:
|
||||||
|
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
|
||||||
|
RUST_BACKTRACE: "1"
|
||||||
|
CARGO_HOME: .cargo_home
|
||||||
|
commands:
|
||||||
|
- cargo test --no-fail-fast
|
||||||
|
when: *slow_check_paths
|
||||||
|
|
||||||
|
integration_test:
|
||||||
|
image: docker.io/debian-slim:latest
|
||||||
|
commands:
|
||||||
|
- ./test.sh
|
||||||
|
|
||||||
|
publish_to_crates_io:
|
||||||
|
image: *rust_image
|
||||||
|
commands:
|
||||||
|
- cargo login "$CARGO_REGISTRY_TOKEN"
|
||||||
|
- cargo publish --registry crates-io --no-verify --allow-branch "${CI_COMMIT_TAG}" --yes
|
||||||
|
secrets: [cargo_api_token]
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
|
16
justfile
16
justfile
|
@ -1,15 +1,15 @@
|
||||||
dist: target-release-skip
|
dist: target-release
|
||||||
if test ! -d dist ; then mkdir dist ; fi
|
if test ! -d dist ; then mkdir dist ; fi
|
||||||
cp target/release/skip dist/
|
cp target/release/skip dist/
|
||||||
|
|
||||||
inttest: target-debug-skip
|
target-release: unittest inttest
|
||||||
./test.sh
|
|
||||||
|
|
||||||
target-release-skip: unittest inttest
|
|
||||||
cargo build --release
|
cargo build --release
|
||||||
|
|
||||||
target-debug-skip:
|
inttest: target-debug
|
||||||
cargo build
|
./test.sh
|
||||||
|
|
||||||
unittest: target-debug-skip
|
unittest: target-debug
|
||||||
cargo test
|
cargo test
|
||||||
|
|
||||||
|
target-debug:
|
||||||
|
cargo build
|
||||||
|
|
Loading…
Reference in a new issue