1
0
Fork 0
mirror of https://github.com/Nutomic/ibis.git synced 2024-12-23 08:51:23 +00:00

Build release binaries in CI (#18)

* build release in ci

* binstall

* x

* y

* z

* pub

* when tag

* reorder

* ci check for ignored files

* create wasm files

* remove ignored

* fmt
This commit is contained in:
Nutomic 2024-03-06 17:03:10 +01:00 committed by GitHub
parent d5ce966ea1
commit 7f85248799
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 55 additions and 1177 deletions

View file

@ -2,6 +2,7 @@ variables:
- &rust_image "rust:1.75"
steps:
cargo_fmt:
image: rustlang/rust:nightly
environment:
@ -20,6 +21,13 @@ steps:
- cargo run -- --print-config > config/defaults_current.toml
- diff config/defaults.toml config/defaults_current.toml
ignored_files:
image: alpine:3
commands:
- apk add git
- IGNORED=$(git ls-files --cached -i --exclude-standard)
- if [[ "$IGNORED" ]]; then echo "Ignored files present:\n$IGNORED\n"; exit 1; fi
check_diesel_schema:
image: willsquire/diesel-cli
environment:
@ -62,6 +70,35 @@ steps:
- export PATH="/usr/lib/postgresql/15/bin:/usr/local/cargo/bin:$PATH"
- sudo -u testuser env "PATH=$PATH" cargo test --no-fail-fast
build_release:
image: *rust_image
environment:
CARGO_HOME: .cargo_home
commands:
- wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
- tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz
- rustup target add wasm32-unknown-unknown
- ./cargo-binstall -y trunk
- ./.cargo_home/bin/trunk build --release
- cargo build --release
- ls -la target/release/ibis
- cp target/release/ibis .
- gzip ibis
- ls -la ibis.gz
when:
event: tag
publish_release:
image: woodpeckerci/plugin-github-release
settings:
files:
- ibis.gz
title: ${CI_COMMIT_TAG##v}
api-key:
from_secret: github_token
when:
event: tag
services:
database:
image: postgres:15.2-alpine

View file

@ -94,3 +94,8 @@ crate-type = ["cdylib", "rlib"]
# out temporarily, but make sure to leave this in the main branch.
[profile.dev]
debug = 0
[profile.release]
lto = "thin"
strip = true # Automatically strip symbols from the binary.
#opt-level = "z" # Optimize for size.

1177
assets/dist/ibis.js vendored

File diff suppressed because it is too large Load diff

Binary file not shown.

13
build.rs Normal file
View file

@ -0,0 +1,13 @@
use std::{
fs::{create_dir_all, File},
io::Result,
};
/// Create placeholders for wasm files so that `cargo check` etc work without explicitly building
/// frontend.
fn main() -> Result<()> {
create_dir_all("assets/dist/")?;
File::create("assets/dist/ibis.js")?;
File::create("assets/dist/ibis_bg.wasm")?;
Ok(())
}