mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-10 03:51:25 +00:00
Adds the complete signed Linux release matrix, FreeBSD CI, and packaging lint to ArtCraft Studio, aligned with the Craft suite standards in `craft-common-actions`. | Architecture | Formats | |:-------------|:------------------------------------------------------------------------| | x86_64 | AppImage and zsync, DEB, RPM, tar.gz, Arch package, Flatpak bundle, OCI | | aarch64 | AppImage and zsync, DEB, RPM, tar.gz, Arch package, Flatpak bundle, OCI | | riscv64 | DEB, RPM, tar.gz | ### Changes - **Linux Packaging Matrix**: Builds and packages ArtCraft Studio across x86_64, aarch64, and riscv64 using `storytold/craft-common-actions`. Produces DEB, RPM, AppImage, tarball, Arch package, and Flatpak bundle/OCI artifacts. Cross-compiles riscv64 DEB and RPM via BoringSSL CMake configuration. Signed Linux artifacts join existing `artcraft-v<version>` release drafts while retaining macOS and Windows assets (storytold/craft-common-actions#160 and #161). - **Release Trigger Alignment**: Like macOS and Windows release workflows, Linux release builds run on release branches (`release`, `artcraft-release`, `artcraft-linux`) and `workflow_dispatch` rather than on PRs. - **Documentation**: Updated `README.md` to include Linux under download options and reference `packaging/linux/README.md`. Added `packaging/windows/README.md` placeholder. - **Packaging Lint**: Added `.github/workflows/packaging-lint.yml` calling `craft-common-actions/packaging-lint.yml@main`. Fixed pre-existing actionlint and shellcheck issues in macOS and Windows publish workflows (`shell: pwsh` defaults and variable quoting). - **FreeBSD CI**: Added `.github/workflows/freebsd.yml` calling `craft-common-actions/freebsd.yml@main` on scheduled nightly runs, release branches, and manual dispatch (not on pull requests). - **SQLx Build Fallback**: Updated `crates/schema/database/sqlite_tasks/build.rs` to fall back to `SQLX_OFFLINE=true` using committed `.sqlx/` query data when no live `/tmp/tasks.sqlite` database file exists, fixing nextest coverage archives under CI. ### Validation - `actionlint` passes cleanly across all `.github/workflows/*.yml` files. - `shellcheck` passes across all scripts in `packaging/linux/*.sh`. - `xmllint` validates `packaging/linux/ai.artcraft.app.metainfo.xml`. - `cargo check -p sqlite_tasks`, `cargo test -p sqlite_tasks`, and `cargo test --no-run -p sqlite_tasks` pass locally without database environment variables. - Packaging lint passes 100% green on CI. - SonarCloud / nextest instrumented test archive build passes on CI. - Linux package scripts (`package.sh`, `package-test.sh`, `flatpak.sh`) verified locally and on CI runners.
56 lines
1.7 KiB
Rust
56 lines
1.7 KiB
Rust
use std::env;
|
|
use std::path::{Path, PathBuf};
|
|
|
|
pub fn main() {
|
|
println!("cargo:rerun-if-env-changed=DATABASE_URL");
|
|
println!("cargo:rerun-if-env-changed=SQLX_OFFLINE");
|
|
|
|
if let Ok(url) = env::var("DATABASE_URL") {
|
|
println!("cargo:rustc-env=DATABASE_URL={}", url);
|
|
return;
|
|
}
|
|
|
|
if env::var("SQLX_OFFLINE").as_deref() == Ok("true") || env::var("SQLX_OFFLINE").as_deref() == Ok("1") {
|
|
println!("cargo:rustc-env=SQLX_OFFLINE=true");
|
|
return;
|
|
}
|
|
|
|
// NB: This should help JetBrains' RustRover from highlighting failing query macros,
|
|
// but we do not want to interfere with the following:
|
|
//
|
|
// (1) User development builds
|
|
// (2) Tooling to cache offline queries
|
|
// (3) CI builds
|
|
let family = env::var("CARGO_CFG_TARGET_FAMILY").ok();
|
|
|
|
match family.as_deref() {
|
|
Some("unix") => unix_temp_database_pathing(),
|
|
Some("windows") => windows_temp_database_pathing(),
|
|
_ => {
|
|
println!("cargo:rustc-env=SQLX_OFFLINE=true");
|
|
},
|
|
}
|
|
}
|
|
|
|
fn unix_temp_database_pathing() {
|
|
println!("cargo:rerun-if-changed=/tmp/tasks.sqlite");
|
|
if Path::new("/tmp/tasks.sqlite").exists() {
|
|
println!("cargo:rustc-env=DATABASE_URL=sqlite:/tmp/tasks.sqlite");
|
|
} else {
|
|
println!("cargo:rustc-env=SQLX_OFFLINE=true");
|
|
}
|
|
}
|
|
|
|
fn windows_temp_database_pathing() {
|
|
if let Ok(local_app_data) = env::var("LOCALAPPDATA") {
|
|
let path = PathBuf::from(local_app_data).join("Temp\\tasks.sqlite");
|
|
if path.exists() {
|
|
let path_str = path.to_str().expect("path should be valid");
|
|
println!("cargo:warning=LocalAppData path: {}", path_str);
|
|
println!("cargo:rustc-env=DATABASE_URL=sqlite:{}", path_str);
|
|
return;
|
|
}
|
|
}
|
|
println!("cargo:rustc-env=SQLX_OFFLINE=true");
|
|
}
|