Compare commits

...

13 Commits

Author SHA1 Message Date
f0a90a4882 all lowercase
All checks were successful
Build Project / test (push) Successful in 3m9s
2025-11-05 19:56:38 +00:00
d4dc0cbbf7 also this one
All checks were successful
Build Project / test (push) Successful in 2m57s
2025-11-05 18:51:16 +01:00
86f2518b6e run as root user
Some checks failed
Build Project / test (push) Has been cancelled
2025-11-05 18:51:06 +01:00
1d7e9fe22b update docker image
Some checks failed
Build Project / test (push) Failing after 3m14s
2025-11-05 18:43:11 +01:00
e4eb26ae5f Use image 2.1
Some checks failed
Build Project / test (push) Failing after 39s
2025-11-05 17:48:15 +01:00
2dbdc149a2 Use new container version
Some checks failed
Build Project / test (push) Failing after 35s
2025-11-05 17:27:04 +01:00
986ad8f457 Test new build stuff
Some checks failed
Build Project / test (push) Failing after 42s
2025-11-04 21:39:53 +00:00
2e9b685789 Version fix hopefully
Some checks failed
Build Project / test (push) Failing after 4m34s
2025-11-04 22:34:13 +01:00
6bc4bd18d7 fix
Some checks failed
Build Project / test (push) Has been cancelled
2025-11-04 22:32:42 +01:00
e753fb4d74 Added rev2
All checks were successful
Build Project / test (push) Successful in 5m40s
2025-11-02 17:25:47 +00:00
f51e831c47 Merge branch 'main' of ssh://gitea.tobiasmaier.me:222/tobimai/iot-cloud-api
All checks were successful
Build Project / test (push) Successful in 5m41s
2025-11-02 18:07:53 +01:00
9be4aedcab Update .gitea/workflows/build_docker.yaml
All checks were successful
Build Project / test (push) Successful in 5m47s
2025-11-02 16:12:07 +01:00
d0d9af1a56 fix urls 2025-11-02 13:11:38 +01:00
5 changed files with 23 additions and 16 deletions

View File

@@ -7,7 +7,8 @@ jobs:
test:
runs-on: ubuntu-latest
container:
image: rust:latest
image: gitea.tobiasmaier.me/tobimai/devcontainer-rust:2.2
options: --user root
services:
db:
image: postgres:latest
@@ -24,14 +25,10 @@ jobs:
- 5432:5432
steps:
- name: Install necessary dependencies
run: apt update && apt install nodejs pkg-config -y
- name: Install docker
run: curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
- name: Checkout Code
uses: actions/checkout@v2
- name: Run migrations
run: cargo install sqlx-cli && sqlx migrate run
run: sqlx migrate run
- name: Build server binary
run: cargo build --release
- name: Set up Docker Buildx
@@ -58,19 +55,19 @@ jobs:
with:
context: .
push: true
tags: gitea.maiertobi.de/tobimai/iot:${{ env.VERSION_PATCH }}
tags: gitea.tobiasmaier.me/tobimai/iot:${{ env.VERSION_PATCH }}
- name: Build and Push Docker Image for minor version
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: gitea.maiertobi.de/tobimai/iot:${{ env.VERSION_MINOR }}
tags: gitea.tobiasmaier.me/tobimai/iot:${{ env.VERSION_MINOR }}
- name: Build and Push Docker Image for major version
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: gitea.maiertobi.de/tobimai/iot:${{ env.VERSION_MAJOR }}
tags: gitea.tobiasmaier.me/tobimai/iot:${{ env.VERSION_MAJOR }}

View File

@@ -6,7 +6,8 @@ jobs:
test:
runs-on: ubuntu-latest
container:
image: rust:latest
image: gitea.tobiasmaier.me/tobimai/devcontainer-rust:2.2
options: --user root
services:
db:
image: postgres:latest
@@ -23,12 +24,10 @@ jobs:
- 5432:5432
steps:
- name: Install necessary dependencies
run: apt update && apt install nodejs pkg-config -y
- name: Checkout Code
uses: actions/checkout@v2
- name: Run migrations
run: cargo install sqlx-cli && sqlx migrate run
run: sqlx migrate run
- name: Running cargo build
run: cargo build --release
- name: Running cargo build

View File

@@ -91,6 +91,8 @@ async fn serve_firmware(
) -> impl Responder {
let (service, product, config, version) = path.into_inner();
let version = version.replace(['.', '_'], "-");
let service = service.to_lowercase();
let config = config.to_lowercase();
let Ok(service) = Services::from_str(&service) else {
return HttpResponse::NotFound().finish();
};
@@ -101,7 +103,7 @@ async fn serve_firmware(
Services::Firmware => PathBuf::from(format!("{product}/firmware_{config}_{version}.bin")),
Services::Filesystem => PathBuf::from(format!("{product}/filesystem_{config}_{version}.bin")),
};
let file_path = fw_root_path.join(&file_path);

View File

@@ -96,6 +96,8 @@ pub enum BoardType {
pub enum BoardConfig {
INA226,
INA233,
INA226REV2,
INA233REV2,
Generic,
}

View File

@@ -1,6 +1,6 @@
use std::{fs, path::PathBuf};
use log::{error, info};
use log::{debug, error, info};
use semver::Version;
use std::str::FromStr;
use thiserror::Error;
@@ -72,11 +72,18 @@ pub fn get_files(
.strip_suffix(".bin")
.ok_or(GetFilesError::Extension)?
.replace('-', ".");
debug!("Version: {:?}", version);
debug!("split_name: {:?}", split_name);
// TODO this is kinda messy
let board_config = BoardConfig::from_str(split_name[1])?;
let service = split_name[0];
let board_type = BoardType::from_str(&product_name).unwrap();
let version = Version::parse(&version)?;
let version = if version.contains('.') {
Version::parse(&version)?
} else {
// Handle simple version number by adding .0.0
Version::parse(&format!("{}.0.0", version))?
};
let version_replaced = format!("{}-{}-{}", version.major, version.minor, version.patch);
let fw_url =
format!("{hostname}/{service}/{board_type}/{board_config}/{version_replaced}.bin");