Skip to content

Commit

Permalink
ci/cd: instead of build docker image, build directly workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
kszinhu committed Feb 20, 2024
1 parent 6f8eacd commit 2d59469
Showing 3 changed files with 24 additions and 23 deletions.
38 changes: 21 additions & 17 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
@@ -13,29 +13,33 @@ on:
jobs:
build:
runs-on: ubuntu-latest
name: Build Pull Request

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: 📥 Checkout
uses: actions/checkout@v4

- name: Install Rust
- name: ⚡️ Rust Cache
uses: Swatinem/rust-cache@v2

- name: ⚡️ Shared Compilation Cache
uses: mozilla-actions/sccache-action@v0.0.4

- name: 📦 Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential gcc cmake musl-dev pkg-config libpq-dev openssl libssl-dev
- name: 🛠️ Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
target: x86_64-unknown-linux-musl

- name: Configure sccache env var and set build profile to ephemeral build
- name: 🚀 Build
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
RUSTFLAGS: "-C target-feature=-crt-static"
run: |
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTFLAGS='--cfg profile=ephemeral-build'" >> $GITHUB_ENV
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4

- name: Run build
uses: actions-rs/cargo@v1
with:
command: build
args: --target x86_64-unknown-linux-musl --release
cargo build --profile=ephemeral-build
7 changes: 2 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -33,10 +33,7 @@ tracing-futures = "0.2"
lazy_static = "*"
once_cell = { version = "*", features = ["std"] }

[profile.release]
opt-level = 3
codegen-units = 16

[profile.ephemeral-build]
opt-level = 2
opt-level = 1
codegen-units = 8
inherits = "release"
2 changes: 1 addition & 1 deletion app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -44,4 +44,4 @@ once_cell = { workspace = true }

# Potentially remove later
nanoid = "0.4"
openssl = "*"
openssl = { version = "*", features = ["vendored"] }

0 comments on commit 2d59469

Please sign in to comment.