Speedup CI (#3852)

* Speedup CI

* run tests in parallel

* restore cp

* main push

* no self update

* parallel format
This commit is contained in:
Nutomic 2023-08-08 16:35:03 +02:00 committed by GitHub
parent 33b2d67be6
commit ae438e148e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,16 +38,25 @@ pipeline:
- git submodule update - git submodule update
prettier_check: prettier_check:
group: format
image: tmknom/prettier:3.0.0 image: tmknom/prettier:3.0.0
commands: commands:
- prettier -c . '!**/volumes' '!**/dist' '!target' '!**/translations' - prettier -c . '!**/volumes' '!**/dist' '!target' '!**/translations'
toml_fmt: toml_fmt:
group: format
image: tamasfe/taplo:0.8.1 image: tamasfe/taplo:0.8.1
commands: commands:
- taplo format --check - taplo format --check
sql_fmt:
group: format
image: backplane/pgformatter:latest
commands:
- ./scripts/sql_format_check.sh
cargo_fmt: cargo_fmt:
group: format
image: *muslrust_image image: *muslrust_image
environment: environment:
# store cargo data in repo folder so that it gets cached between steps # store cargo data in repo folder so that it gets cached between steps
@ -55,22 +64,9 @@ pipeline:
commands: commands:
# need make existing toolchain available # need make existing toolchain available
- cp -n ~/.cargo . -r - cp -n ~/.cargo . -r
- rustup toolchain install nightly-2023-07-10 - rustup toolchain install nightly-2023-07-10 --no-self-update --profile minimal --component rustfmt
- rustup component add rustfmt --toolchain nightly-2023-07-10
- cargo +nightly-2023-07-10 fmt -- --check - cargo +nightly-2023-07-10 fmt -- --check
sql_fmt:
image: alpine:3
commands:
- apk add bash wget perl make git
- wget https://github.com/darold/pgFormatter/archive/refs/tags/v5.5.tar.gz
- tar xzf v5.5.tar.gz
- cd pgFormatter-5.5
- perl Makefile.PL
- make && make install
- cd ..
- ./scripts/./sql_format_check.sh
restore-cache: restore-cache:
image: meltwater/drone-cache:v1 image: meltwater/drone-cache:v1
pull: true pull: true
@ -176,7 +172,17 @@ pipeline:
-D clippy::indexing_slicing -D clippy::indexing_slicing
when: *slow_check_paths when: *slow_check_paths
cargo_build:
image: *muslrust_image
environment:
CARGO_HOME: .cargo
commands:
- cargo build
- mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
when: *slow_check_paths
cargo_test: cargo_test:
group: tests
image: *muslrust_image image: *muslrust_image
environment: environment:
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
@ -187,16 +193,8 @@ pipeline:
- cargo test --workspace --no-fail-fast - cargo test --workspace --no-fail-fast
when: *slow_check_paths when: *slow_check_paths
cargo_build:
image: *muslrust_image
environment:
CARGO_HOME: .cargo
commands:
- cargo build
- mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
when: *slow_check_paths
run_federation_tests: run_federation_tests:
group: tests
image: node:alpine image: node:alpine
environment: environment:
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432 LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
@ -231,7 +229,9 @@ pipeline:
- "api_tests/node_modules" - "api_tests/node_modules"
secrets: secrets:
[MINIO_ENDPOINT, MINIO_WRITE_USER, MINIO_WRITE_PASSWORD, MINIO_BUCKET] [MINIO_ENDPOINT, MINIO_WRITE_USER, MINIO_WRITE_PASSWORD, MINIO_BUCKET]
when: *slow_check_paths when:
- event: push
branch: main
publish_release_docker: publish_release_docker:
image: woodpeckerci/plugin-docker-buildx image: woodpeckerci/plugin-docker-buildx