Skip to content

Commit

Permalink
Fix release build (#193)
Browse files Browse the repository at this point in the history
PR #179 broke release builds by making it necessary for
`LiveAskQuestion` and `SEED` to both now be available regardless of
whether `debug_assertions` is set. That's unfortunate, since `SEED` in
particular would make the binary quite large. So I've instead made it so
that in release mode (or rather, without `debug_assertions`), `SEED` is
_not_ compiled in, and DynamoDB mode is _always_ used.

I've also added a CI job to check `--release --target
aarch64-unknown-linux-gnu` so that this can't happen in the future.
  • Loading branch information
jonhoo authored Dec 27, 2024
1 parent c4dd823 commit fc8174a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,25 @@ jobs:
with:
components: rustfmt
- name: cargo fmt --check
run: cargo fmt --check --manifest-path server/Cargo.toml
run: cargo fmt --check
in_release_mode_on_arm:
runs-on: ubuntu-latest
name: stable / release-arm
defaults:
run:
working-directory: ./server
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: rustup target add aarch64-unknown-linux-gnu
run: rustup target add aarch64-unknown-linux-gnu
- name: Install aarch64-gcc
run: sudo apt-get install gcc-aarch64-linux-gnu
- name: cargo check --release --target aarch64-unknown-linux-gnu
run: cargo check --release --target aarch64-unknown-linux-gnu
clippy:
runs-on: ubuntu-latest
name: ${{ matrix.toolchain }} / clippy
Expand Down
5 changes: 4 additions & 1 deletion server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ async fn main() -> Result<(), Error> {
.with_env_filter(EnvFilter::from_default_env())
.without_time(/* cloudwatch does that */).init();

let backend = if !cfg!(debug_assertions) || std::env::var_os("USE_DYNAMODB").is_some() {
#[cfg(not(debug_assertions))]
let backend = Backend::dynamo().await;
#[cfg(debug_assertions)]
let backend = if std::env::var_os("USE_DYNAMODB").is_some() {
Backend::dynamo().await
} else {
use rand::prelude::SliceRandom;
Expand Down

0 comments on commit fc8174a

Please sign in to comment.