Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions .github/workflows/release-test.yml

This file was deleted.

81 changes: 51 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,67 @@
name: Release

on:
workflow_dispatch:
release:
types: [created]

jobs:
deb:
name: Debian/Ubuntu (deb)
name: Create deb packages
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu:25.04
- ubuntu:24.10
- ubuntu:24.04
- ubuntu:22.04
- debian:bullseye
- debian:bookworm
- debian:trixie
container:
image: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Deps
run: |
apt update
apt install -yy libseccomp-dev build-essential fpc
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
id: install-rust
- name: Install cargo-deb
run: cargo install cargo-deb

- name: Calculate artifact suffix
shell: python3 {0}
run: |
import os
artifact_suffix="${{ matrix.os }}".replace(':', '-')
open(os.getenv("GITHUB_ENV"), "a").write(f"ARTIFACT_SUFFIX={artifact_suffix}\n")

- name: Release build
run: cargo build --release

- name: Generate autocompletion files
run: target/release/task-maker-tools gen-autocompletion

- name: Build deb file
run: cargo deb

- name: Package release tarball
run: |
docker run --rm -v $(pwd):/source ghcr.io/edomora97/task-maker-rust-release-linux
- name: Upload the artifacts
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ROOT=`pwd`
cd target/debian/
tar -zcvf ${ROOT}/tmr-debs-${{ env.ARTIFACT_SUFFIX }}.tar.gz *task-maker-rust*.*

- name: Upload release tarball
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
args: "target/debian/*.deb"
## For now do not build the docker container for the server/worker: it requires some fixes because the workers
## now spawn a single instance instead of as many as cores. Moreover, the server and worker commands changed.
# - name: Publish docker container
# run: |
# echo ${DOCKER_PASSWORD} | docker login --username edomora97 --password-stdin
# export TM_VERSION=$(grep version Cargo.toml | head -n 1 | cut -d'"' -f 2)
# cd tools/docker
# docker build --build-arg TM_VERSION=$TM_VERSION -t edomora97/task-maker-rust:latest -t edomora97/task-maker-rust:$TM_VERSION .
# docker push edomora97/task-maker-rust:$TM_VERSION
# docker push edomora97/task-maker-rust:latest
# env:
# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
name: tmr-debs-${{ env.ARTIFACT_SUFFIX }}
path: tmr-debs-${{ env.ARTIFACT_SUFFIX }}.tar.gz
compression-level: 0

aur:
name: AUR
Expand All @@ -41,21 +72,11 @@ jobs:
working-directory: tools/aur/task-maker-rust
run: ./gen.sh > ../../../PKGBUILD
- name: Publish PKGBUILD
if: ${{ github.event_name == 'release' }} # skip on manual runs.
uses: KSXGitHub/github-actions-deploy-aur@v4.1.1
with:
pkgname: task-maker-rust
pkgbuild: ./PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}

ppa:
name: Publish PPA
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Trigger PPA build
env:
GH_TOKEN: ${{ secrets.PAT_PPA_ACTION_TRIGGER }}
run: |
gh workflow run -R dp1/task-maker-rust-ppa --ref master check-for-release.yml
8 changes: 0 additions & 8 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,3 @@ jobs:

- name: cargo fmt
run: cargo fmt --all -- --check

cargo-lock-3:
name: Check cargo lock version = 3
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: check
run: grep "version = 3" Cargo.lock > /dev/null
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ The new cmsMake!
[![asciicast](https://asciinema.org/a/301849.svg)](https://asciinema.org/a/301849)

## Installation
For **Ubuntu** and **Debian** users you can find the `.deb` file in the [Releases](https://github.com/olimpiadi-informatica/task-maker-rust/releases) page.
Install the package using `sudo dpkg -i the_file.deb` and it's dependencies (if you need to) with `sudo apt install -f`.
There is a good chance that you have already all the dependencies already installed.

For **Ubuntu** it's also possible to install task-maker-rust using a PPA:
For **Ubuntu** and **Debian** users, you can install this package as follows:

```bash
sudo add-apt-repository ppa:dariop1/task-maker-rust
sudo apt update
sudo apt install task-maker-rust
echo "deb [signed-by=/etc/apt/keyrings/task-maker-rust.asc] https://artifacts.lucaversari.it/olimpiadi-informatica/task-maker-rust/latest/deb/$(lsb_release -cs) /" | sudo tee /etc/apt/sources.list.d/task-maker-rust.list
curl https://artifacts.lucaversari.it/signing-key.asc | sudo tee /etc/apt/keyrings/task-maker-rust.asc > /dev/null
sudo apt update && sudo apt install task-maker-rust
```

You can also find the `.deb` files in the [Releases](https://github.com/olimpiadi-informatica/task-maker-rust/releases) page.

For **ArchLinux** users you can find the packages in the AUR: [`task-maker-rust`](https://aur.archlinux.org/packages/task-maker-rust) (the stable release)
and [`task-maker-rust-git`](https://aur.archlinux.org/packages/task-maker-rust-git) (the version based on `master`).

Expand Down
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn get_version() -> String {
if from_git.is_empty() {
version
} else {
format!("{}\n\nRevision: {}", version, from_git)
format!("{version}\n\nRevision: {from_git}")
}
}
Err(_) => version,
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.75"
channel = "1.88"
components = [ "rustfmt", "clippy" ]
2 changes: 1 addition & 1 deletion src/copy_dag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub fn render_dag(dag: &ExecutionDAG) -> String {
for exec in &group.executions {
for dep in exec.dependencies() {
if !files.contains_key(&dep) {
panic!("Nope: {:#?} does not contain {:?}", exec, dep);
panic!("Nope: {exec:#?} does not contain {dep:?}");
}
let file = &files[&dep];
edges.push((Node::File(file.clone()), Node::Execution(exec.clone())));
Expand Down
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ pub trait NiceError<T, E> {
fn print_error(error: Error) {
debug!("{:?}", error);
let mut fail: &dyn std::error::Error = error.as_ref();
eprintln!("Error: {}", fail);
eprintln!("Error: {fail}");
while let Some(cause) = fail.source() {
eprintln!("\nCaused by:\n {}", cause);
eprintln!("\nCaused by:\n {cause}");
fail = cause;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/sandbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn main_sandbox() {
.expect("Failed to print result");
}
Err(e) => {
let err = format!("Error: {:?}", e);
let err = format!("Error: {e:?}");
serde_json::to_writer(stdout(), &RawSandboxResult::Error(err))
.expect("Failed to print result");
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/add_solution_checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ fn process_solution(
)
})
{
eprintln!("Error: {:?}", e);
eprintln!("Error: {e:?}");
} else {
written = " (written!)";
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/find_bad_case/curses_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl CursesUI {
let mut line = Vec::new();
let batch_index = state.batches.len() - 1 - i;
let batch = &state.batches[state.batches.len() - 1 - i];
line.push(Span::raw(format!("Batch {:>3}: ", batch_index)));
line.push(Span::raw(format!("Batch {batch_index:>3}: ")));
line.extend(
batch
.testcase_status
Expand Down
8 changes: 4 additions & 4 deletions src/tools/find_bad_case/dag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@ pub fn patch_task_for_batch(
let data = TestcaseData {
generator_args,
seed,
input_path: working_directory.join(format!("testcase-{}/input.txt", seed)),
output_path: working_directory.join(format!("testcase-{}/output.txt", seed)),
input_path: working_directory.join(format!("testcase-{seed}/input.txt")),
output_path: working_directory.join(format!("testcase-{seed}/output.txt")),
correct_output_path: working_directory
.join(format!("testcase-{}/correct_output.txt", seed)),
.join(format!("testcase-{seed}/correct_output.txt")),
};

testcases.insert(testcase_id, testcase);
batch.testcases.insert(testcase_id, data);
}
let subtask = SubtaskInfo {
id: 0,
name: Some(format!("batch-{}", batch_index)),
name: Some(format!("batch-{batch_index}")),
max_score: 100.0,
testcases: testcases.keys().cloned().collect(),
testcases_owned: testcases.keys().cloned().collect(),
Expand Down
4 changes: 2 additions & 2 deletions src/tools/find_bad_case/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ pub fn main_find_bad_case(opt: FindBadCaseOpt) -> Result<(), Error> {
cwrite!(printer, BOLD, " Seed: ");
println!("{}", testcase.seed);
cwrite!(printer, BOLD, " Message: ");
println!("{}", message);
println!("{message}");
println!();
print_file("Input file", &task_path, &input_path, &mut printer)?;
if let Some(correct_output_path) = correct_output_path {
Expand Down Expand Up @@ -342,7 +342,7 @@ fn print_failures(shared: &SharedUIState, printer: &mut StdoutPrinter) {
if let Some((testcase, message, result)) = &shared.errored_testcase {
println!();
cwrite!(printer, RED, "Error: ");
println!("{}", message);
println!("{message}");
cwrite!(printer, BOLD, "Generator args: ");
println!("{}", testcase.generator_args.join(" "));
cwrite!(printer, BOLD, "Result: ");
Expand Down
16 changes: 8 additions & 8 deletions src/tools/fuzz_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub fn main_fuzz_checker(opt: FuzzCheckerOpt) -> Result<(), Error> {
let fuzz_data = FuzzData {
checker_source: checker.path.clone(),
initial_output_files: (0..num_testcases)
.map(|i| task_dir.join(format!("output/output{}.txt", i)))
.map(|i| task_dir.join(format!("output/output{i}.txt")))
.collect(),
task_dir,
opt,
Expand Down Expand Up @@ -192,7 +192,7 @@ fn write_initial_corpus(fuzz_dir: &Path, data: &FuzzData) -> Result<(), Error> {
}

for (index, output) in data.initial_output_files.iter().enumerate() {
let path = initial_corpus_dir.join(format!("{}.txt", index));
let path = initial_corpus_dir.join(format!("{index}.txt"));
if path.exists() {
debug!("Removing old corpus at {}", path.display());
std::fs::remove_file(&path)
Expand Down Expand Up @@ -380,7 +380,7 @@ fn compile_fuzzer(
command.arg(sanitizers);

let std_version = std::env::var("TM_CXX_STD_VERSION").unwrap_or_else(|_| "c++17".into());
command.arg(format!("-std={}", std_version));
command.arg(format!("-std={std_version}"));

if data.opt.extra_args.is_empty() {
debug!("Adding -O2 and -g since no extra argument has been specified");
Expand Down Expand Up @@ -465,7 +465,7 @@ fn run_fuzzer(fuzz_dir: &Path, data: &FuzzData, fuzzer: &Path) -> Result<Vec<Pat
} else {
num_cpus::get()
};
command.arg(format!("-fork={}", jobs));
command.arg(format!("-fork={jobs}"));
command.arg(format!("-timeout={}", data.opt.checker_timeout));
command.arg(format!("-max_total_time={}", data.opt.max_time));
command.arg(fuzz_dir.join("initial_corpus"));
Expand Down Expand Up @@ -561,15 +561,15 @@ fn organize_failures(
bail!("Invalid artifact name {}", artifact.display());
};

let target_dir = failures.join(format!("fail-{}", artifact_id));
let target_dir = failures.join(format!("fail-{artifact_id}"));
std::fs::create_dir(&target_dir).with_context(|| {
anyhow!(
"Failed to create artifact output directory at {}",
target_dir.display()
)
})?;

let failure_path = target_dir.join(format!("output-{}.txt", fail_type));
let failure_path = target_dir.join(format!("output-{fail_type}.txt"));
std::fs::write(&failure_path, &output).with_context(|| {
anyhow!(
"Failed to write {} bytes of output file at {}",
Expand All @@ -578,8 +578,8 @@ fn organize_failures(
)
})?;

let source_input_path = data.task_dir.join(format!("input/input{}.txt", id));
let source_correct_path = data.task_dir.join(format!("output/output{}.txt", id));
let source_input_path = data.task_dir.join(format!("input/input{id}.txt"));
let source_correct_path = data.task_dir.join(format!("output/output{id}.txt"));
let target_input_path = target_dir.join("input.txt");
let target_output_path = target_dir.join("output.txt");
let target_artifact_path = target_dir.join("artifact.bin");
Expand Down
4 changes: 2 additions & 2 deletions src/tools/task_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ pub fn main_task_info(opt: TaskInfoOpt) -> Result<(), Error> {
let info = task.task_info().context("Cannot produce task info")?;
if opt.json {
let json = serde_json::to_string(&info).context("Non-serializable task info")?;
println!("{}", json);
println!("{json}");
} else {
println!("{:#?} ", info);
println!("{info:#?} ");
}
Ok(())
}
2 changes: 1 addition & 1 deletion src/tools/terry_statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub fn main_terry_statement(opt: TerryStatementOpt, _logger_opt: LoggerOpt) -> R

match output_path {
Some(output_file) => fs::write(output_file, new_content)?,
None => print!("{}", new_content),
None => print!("{new_content}"),
}

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/tools/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub fn main_worker(opt: WorkerOpt) -> Result<(), Error> {
}

let name = if let Some(wid) = opt.worker_id {
format!("{} {}", name, wid)
format!("{name} {wid}")
} else {
name
};
Expand Down
Loading
Loading