Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • dragoon/komodo
  • a.stevan/komodo
  • c.heme/komodo
3 results
Show changes
Commits on Source (2)
FROM rust:latest
# Suppress prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update --yes && apt upgrade --yes
RUN apt install --yes protobuf-compiler
COPY rust-toolchain.toml /
RUN rustup show && cargo --version
RUN cargo install cargo-script
RUN apt clean && rm -rf /var/lib/apt/lists/*
......@@ -5,32 +5,23 @@ on: [push, pull_request, workflow_dispatch]
jobs:
fmt:
runs-on: ubuntu-latest
container:
image: "ghcr.io/dragoon-rs/dragoon/komodo:bcb0e6b5f73420762f6208700a43291e0066c2c3"
if: "!contains(github.event.head_commit.message, 'draft:') && !contains(github.event.head_commit.message, 'no-ci:')"
steps:
- uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install dependencies
run: |
cargo install cargo-script
- name: Run fmt check
run: |
./make.rs fmt --check
test:
runs-on: ubuntu-latest
container:
image: "ghcr.io/dragoon-rs/dragoon/komodo:bcb0e6b5f73420762f6208700a43291e0066c2c3"
needs: fmt
if: "!contains(github.event.head_commit.message, 'draft:') && !contains(github.event.head_commit.message, 'no-ci:')"
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt update --yes
sudo apt upgrade --yes
sudo apt install protobuf-compiler --yes
cargo install cargo-script
- name: Show configuration
run: |
./make.rs version
......
# WARNING: update `rust-toolchain.toml` as well
image: "rust:1.78"
image: "gitlab-registry.isae-supaero.fr/dragoon/komodo:bcb0e6b5f73420762f6208700a43291e0066c2c3"
stages:
- fmt
......@@ -16,8 +15,6 @@ workflow:
fmt:
stage: fmt
before_script:
- cargo install cargo-script
script:
- ./make.rs fmt --check
......@@ -25,14 +22,8 @@ test:
stage: test
needs:
- fmt
before_script:
- apt update --yes
- apt upgrade --yes
- apt install protobuf-compiler --yes
- cargo install cargo-script
- ./make.rs version
script:
- ./make.rs version
- ./make.rs check
- ./make.rs clippy
- ./make.rs test
......@@ -23,6 +23,26 @@ see [`benchmarks/`](benchmarks/README.md)
the results can be found in [`dragoon/komodo-benchmark-results`](https://gitlab.isae-supaero.fr/dragoon/komodo-benchmark-results).
## development
Komodo uses a Docker image as the base of the GitLab pipelines.
That means that there is nothing to build apart from the source code of Komodo itself when running jobs.
When the development environment needs to change, e.g. when the version of Rust is bumped in
[`rust-toolchain.toml`](./rust-toolchain.toml), one shall run the following commands to push the new
Docker image to the [_container registry_][gitlab.isae-supaero.fr:dragoon/komodo@containers].
```shell
./make.rs container --login
```
```shell
./make.rs container
```
```shell
./make.rs container --push
```
## contributors
Because the code for this project has been originally extracted from
......@@ -35,3 +55,4 @@ note that the following people have contributed to this code base:
- @j.detchart
[pcs-fec-id]: https://gitlab.isae-supaero.fr/dragoon/pcs-fec-id
[gitlab.isae-supaero.fr:dragoon/komodo@containers]: https://gitlab.isae-supaero.fr/dragoon/komodo/container_registry/42
......@@ -6,13 +6,18 @@
//! edition = "2021"
//!
//! [dependencies]
//! nob = { git = "https://gitlab.isae-supaero.fr/a.stevan/nob.rs", rev = "e4b03cdd4f1ba9daf3095930911b12fb28b6a248" }
//! nob = { git = "https://gitlab.isae-supaero.fr/a.stevan/nob.rs", rev = "7ea6be855cf5600558440def6e59a83f78b8b543" }
//! clap = { version = "4.5.17", features = ["derive"] }
//! ```
extern crate clap;
use clap::{Parser, Subcommand};
const REGISTRY: &str = "gitlab-registry.isae-supaero.fr";
const MIRROR_REGISTRY: &str = "ghcr.io/dragoon-rs";
const IMAGE: &str = "dragoon/komodo";
const DOCKERFILE: &str = ".env.dockerfile";
#[derive(Parser)]
#[command(version, about, long_about = None)]
struct Cli {
......@@ -55,6 +60,15 @@ enum Commands {
#[arg(short, long)]
features: bool,
},
/// Builds the container.
Container {
/// Log into the registry instead of building.
#[arg(short, long)]
login: bool,
/// Push to the registry instead of building.
#[arg(short, long)]
push: bool,
},
}
#[rustfmt::skip]
......@@ -85,7 +99,7 @@ fn main() {
"--",
"-D",
"warnings"
)
);
}
Some(Commands::Test { verbose, examples }) => {
let mut cmd = vec!["cargo", "test"];
......@@ -118,6 +132,35 @@ fn main() {
if *features { cmd.push("--all-features") }
nob::run_cmd_as_vec_and_fail!(cmd);
},
Some(Commands::Container { login, push }) => {
let res = nob::run_cmd_and_fail!(@+"git", "rev-parse", "HEAD");
let sha = String::from_utf8(res.stdout).expect("Invalid UTF-8 string");
let image = format!("{}/{}:{}", REGISTRY, IMAGE, sha.trim());
let mirror_image = format!("{}/{}:{}", MIRROR_REGISTRY, IMAGE, sha.trim());
if *login {
nob::run_cmd_and_fail!("docker", "login", REGISTRY);
nob::run_cmd_and_fail!("docker", "login", MIRROR_REGISTRY);
} else if *push {
nob::run_cmd_and_fail!("docker", "push", &image);
nob::run_cmd_and_fail!("docker", "push", &mirror_image);
} else {
nob::run_cmd_and_fail!(
"docker",
"build",
"-t", &image,
".",
"--file", DOCKERFILE
);
nob::run_cmd_and_fail!(
"docker",
"build",
"-t", &mirror_image,
".",
"--file", DOCKERFILE
);
}
}
None => {}
}
}
[toolchain]
profile = "minimal"
# WARNING: update `.gitlab-ci.yml` as well
channel = "1.78"
components = ["rustfmt", "clippy", "rust-analyzer"]