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] ...@@ -5,32 +5,23 @@ on: [push, pull_request, workflow_dispatch]
jobs: jobs:
fmt: fmt:
runs-on: ubuntu-latest 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:')" if: "!contains(github.event.head_commit.message, 'draft:') && !contains(github.event.head_commit.message, 'no-ci:')"
steps: steps:
- uses: actions/checkout@v3 - 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 - name: Run fmt check
run: | run: |
./make.rs fmt --check ./make.rs fmt --check
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: "ghcr.io/dragoon-rs/dragoon/komodo:bcb0e6b5f73420762f6208700a43291e0066c2c3"
needs: fmt needs: fmt
if: "!contains(github.event.head_commit.message, 'draft:') && !contains(github.event.head_commit.message, 'no-ci:')" if: "!contains(github.event.head_commit.message, 'draft:') && !contains(github.event.head_commit.message, 'no-ci:')"
steps: steps:
- uses: actions/checkout@v3 - 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 - name: Show configuration
run: | run: |
./make.rs version ./make.rs version
......
# WARNING: update `rust-toolchain.toml` as well image: "gitlab-registry.isae-supaero.fr/dragoon/komodo:bcb0e6b5f73420762f6208700a43291e0066c2c3"
image: "rust:1.78"
stages: stages:
- fmt - fmt
...@@ -16,8 +15,6 @@ workflow: ...@@ -16,8 +15,6 @@ workflow:
fmt: fmt:
stage: fmt stage: fmt
before_script:
- cargo install cargo-script
script: script:
- ./make.rs fmt --check - ./make.rs fmt --check
...@@ -25,14 +22,8 @@ test: ...@@ -25,14 +22,8 @@ test:
stage: test stage: test
needs: needs:
- fmt - fmt
before_script:
- apt update --yes
- apt upgrade --yes
- apt install protobuf-compiler --yes
- cargo install cargo-script
- ./make.rs version
script: script:
- ./make.rs version
- ./make.rs check - ./make.rs check
- ./make.rs clippy - ./make.rs clippy
- ./make.rs test - ./make.rs test
...@@ -23,6 +23,26 @@ see [`benchmarks/`](benchmarks/README.md) ...@@ -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). 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 ## contributors
Because the code for this project has been originally extracted from 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: ...@@ -35,3 +55,4 @@ note that the following people have contributed to this code base:
- @j.detchart - @j.detchart
[pcs-fec-id]: https://gitlab.isae-supaero.fr/dragoon/pcs-fec-id [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 @@ ...@@ -6,13 +6,18 @@
//! edition = "2021" //! edition = "2021"
//! //!
//! [dependencies] //! [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"] } //! clap = { version = "4.5.17", features = ["derive"] }
//! ``` //! ```
extern crate clap; extern crate clap;
use clap::{Parser, Subcommand}; 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)] #[derive(Parser)]
#[command(version, about, long_about = None)] #[command(version, about, long_about = None)]
struct Cli { struct Cli {
...@@ -55,6 +60,15 @@ enum Commands { ...@@ -55,6 +60,15 @@ enum Commands {
#[arg(short, long)] #[arg(short, long)]
features: bool, 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] #[rustfmt::skip]
...@@ -85,7 +99,7 @@ fn main() { ...@@ -85,7 +99,7 @@ fn main() {
"--", "--",
"-D", "-D",
"warnings" "warnings"
) );
} }
Some(Commands::Test { verbose, examples }) => { Some(Commands::Test { verbose, examples }) => {
let mut cmd = vec!["cargo", "test"]; let mut cmd = vec!["cargo", "test"];
...@@ -118,6 +132,35 @@ fn main() { ...@@ -118,6 +132,35 @@ fn main() {
if *features { cmd.push("--all-features") } if *features { cmd.push("--all-features") }
nob::run_cmd_as_vec_and_fail!(cmd); 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 => {} None => {}
} }
} }
[toolchain] [toolchain]
profile = "minimal" profile = "minimal"
# WARNING: update `.gitlab-ci.yml` as well
channel = "1.78" channel = "1.78"
components = ["rustfmt", "clippy", "rust-analyzer"] components = ["rustfmt", "clippy", "rust-analyzer"]