mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-22 19:41:03 +00:00
Continue the Drone CI config
This commit is contained in:
parent
b2829908f1
commit
b26e785277
1 changed files with 102 additions and 40 deletions
142
.drone.jsonnet
142
.drone.jsonnet
|
@ -7,14 +7,6 @@
|
|||
// Its Dockerfile can be found at https://git.joinplu.me/plume/buildenv
|
||||
local plumeEnv = "plumeorg/plume-buildenv:v0.0.9";
|
||||
|
||||
// A utility function to generate a new pipeline
|
||||
local basePipeline(name, steps) = {
|
||||
kind: "pipeline",
|
||||
name: name,
|
||||
type: "docker",
|
||||
steps: steps
|
||||
};
|
||||
|
||||
// A pipeline step that restores the cache.
|
||||
// The cache contains all the cargo build files.
|
||||
// Thus, we don't have to download and compile all of our dependencies for each
|
||||
|
@ -74,50 +66,120 @@ local startDb(db) = if db == "postgres" then {
|
|||
}
|
||||
};
|
||||
|
||||
// A utility function to generate a new pipeline
|
||||
local basePipeline(name, steps) = {
|
||||
kind: "pipeline",
|
||||
name: name,
|
||||
type: "docker",
|
||||
steps: steps
|
||||
};
|
||||
|
||||
// And this function creates a pipeline with caching
|
||||
local cachedPipeline(name, commands) = basePipeline(
|
||||
name,
|
||||
[
|
||||
restoreCache,
|
||||
{
|
||||
name: name,
|
||||
image: plumeEnv,
|
||||
commands: commands,
|
||||
},
|
||||
saveCache
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
// Here starts the actual list of pipelines!
|
||||
|
||||
// First one: a pipeline that runs cargo fmt, and that fails if the style of
|
||||
// PIPELINE 1: a pipeline that runs cargo fmt, and that fails if the style of
|
||||
// the code is not standard.
|
||||
local CargoFmt() = basePipeline(
|
||||
local CargoFmt() = cachedPipeline(
|
||||
"cargo-fmt",
|
||||
[
|
||||
restoreCache,
|
||||
{
|
||||
name: "cargo-fmt",
|
||||
image: plumeEnv,
|
||||
commands: [ "cargo fmt --all -- --check" ],
|
||||
},
|
||||
saveCache,
|
||||
]
|
||||
[ "cargo fmt --all -- --check" ]
|
||||
);
|
||||
|
||||
local Clippy(db) = basePipeline(
|
||||
"clippy-" + db,
|
||||
[
|
||||
restoreCache,
|
||||
{
|
||||
local cmd(pkg, features=true) = if features then
|
||||
"cargo clippy --no-default-features --features " + db
|
||||
+ "--release -p " + pkg + " -- -D warnings"
|
||||
// PIPELINE 2: runs clippy, a tool that helps
|
||||
// you writing idiomatic Rust.
|
||||
|
||||
// Helper function:
|
||||
local cmd(db, pkg, features=true) = if features then
|
||||
"cargo clippy --no-default-features --features " + db + "--release -p "
|
||||
+ pkg + " -- -D warnings"
|
||||
else
|
||||
"cargo clippy --no-default-features --release -p "
|
||||
+ pkg + " -- -D warnings",
|
||||
name: "clippy",
|
||||
image: plumeEnv,
|
||||
commands: [
|
||||
cmd("plume"), cmd("plume-cli"), cmd("plume-front", false)
|
||||
],
|
||||
},
|
||||
saveCache,
|
||||
+ pkg + " -- -D warnings";
|
||||
|
||||
// The actual pipeline:
|
||||
local Clippy(db) = cachedPipeline(
|
||||
"clippy-" + db,
|
||||
[
|
||||
cmd(db, "plume"),
|
||||
cmd(db, "plume-cli"),
|
||||
cmd(db, "plume-front", false)
|
||||
]
|
||||
);
|
||||
|
||||
// TODO
|
||||
// PIPELINE 3: runs unit tests
|
||||
local Unit(db) = cachedPipeline(
|
||||
"unit-" + db,
|
||||
[
|
||||
"cargo test --all --exclude plume-front --exclude plume-macro"
|
||||
+ "--no-run --no-default-features --features=" + db
|
||||
]
|
||||
);
|
||||
|
||||
local Unit(db) = basePipeline("unit-" + db, []);
|
||||
local Integration(db) = basePipeline("integration-" + db, []);
|
||||
local Release(db) = basePipeline("release-" + db, []);
|
||||
local PushTranslations() = basePipeline("push-translations", []);
|
||||
// PIPELINE 4: runs integration tests
|
||||
// It installs a local instance an run integration test with Python scripts
|
||||
// that use Selenium (located in scripts/browser_test).
|
||||
local Integration(db) = cachedPipeline(
|
||||
"integration-" + db,
|
||||
[
|
||||
// Install the front-end
|
||||
"cargo web deploy -p plume-front",
|
||||
// Install the server
|
||||
'cargo install --debug --no-default-features --features="'
|
||||
+ db + '",test --force --path .',
|
||||
// Install plm
|
||||
'cargo install --debug --no-default-features --features="'
|
||||
+ db + '",test --force --path plume-cli',
|
||||
// Run the tests
|
||||
"./script/run_browser_test.sh"
|
||||
]
|
||||
);
|
||||
|
||||
// PIPELINE 5: make a release build and save artifacts
|
||||
//
|
||||
// It should also deploy the SQlite build to a test instance
|
||||
// located at https://pr-XXX.joinplu.me (but this system is not very
|
||||
// stable, and often breaks).
|
||||
//
|
||||
// TODO: save the artifacts that are generated somewhere
|
||||
local Release(db) = cachedPipeline(
|
||||
"release-" + db,
|
||||
[
|
||||
"cargo web deploy -p plume-front --release",
|
||||
"cargo build --release --no-default-features --features=" + db + " -p plume",
|
||||
"cargo build --release --no-default-features --features=" + db + " -p plume-cli",
|
||||
"./script/generate_artifact.sh",
|
||||
] + if db == "sqlite" then [ "./script/upload_test_environment.sh" ] else []
|
||||
);
|
||||
|
||||
// PIPELINE 6: upload the new PO templates (.pot) to Crowdin
|
||||
//
|
||||
// TODO: run only on master
|
||||
local PushTranslations() = basePipeline(
|
||||
"push-translations",
|
||||
[
|
||||
{
|
||||
name: "push-translations",
|
||||
image: plumeEnv,
|
||||
commands: [
|
||||
"cargo build",
|
||||
"crowdin upload -b master"
|
||||
]
|
||||
}
|
||||
]
|
||||
);
|
||||
|
||||
// And finally, the list of all our pipelines:
|
||||
[
|
||||
|
|
Loading…
Reference in a new issue