Skip to content

Commit

Permalink
Add GitHub Actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kylewlacy committed Dec 31, 2023
1 parent 7bf6302 commit 66fa861
Show file tree
Hide file tree
Showing 149 changed files with 1,229 additions and 84 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
on:
- push

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

env:
NIGHTLY_TOOLCHAIN: nightly-2023-12-30

jobs:
test:
name: Run tests
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install SQLx CLI
run: |
mkdir -p ~/.local/bin
curl -L https://development-content.brioche.dev/tools/sqlx-cli_v0.7.1/sqlx -o ~/.local/bin/sqlx
curl -L https://development-content.brioche.dev/tools/sqlx-cli_v0.7.1/cargo-sqlx -o ~/.local/bin/cargo-sqlx
chmod +x ~/.local/bin/sqlx ~/.local/bin/cargo-sqlx
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Check formatting
run: cargo fmt -- --check
- name: Check database schema
run: make check-db-schema
- name: Check Clippy
run: cargo clippy --all -- -Dwarnings
- name: Build runtime distribution
run: |
cd crates/brioche/runtime
npm install
npm run build
- name: Run tests
run: cargo test --all
build:
name: Build artifacts
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust nightly toolchain
run: |
rustup toolchain install "$NIGHTLY_TOOLCHAIN" \
--target x86_64-unknown-linux-musl \
--component rust-src
- name: Build Brioche
run: cargo build --release --target=x86_64-unknown-linux-gnu
- name: Build brioche-pack
run: |
cargo +"$NIGHTLY_TOOLCHAIN" build \
-p brioche-pack \
--profile=release-tiny \
--target=x86_64-unknown-linux-musl \
-Z 'build-std=std,panic_abort' \
-Z 'build-std-features=panic_immediate_abort'
- name: Prepare artifact
run: |
mkdir -p artifacts/brioche/x86_64-linux/
mkdir -p artifacts/brioche-pack/x86_64-linux/
cp \
target/x86_64-unknown-linux-gnu/release/brioche \
artifacts/brioche/x86_64-linux/
cp \
target/x86_64-unknown-linux-musl/release-tiny/brioche-ld \
target/x86_64-unknown-linux-musl/release-tiny/brioche-packed-exec \
target/x86_64-unknown-linux-musl/release-tiny/brioche-packed-userland-exec \
target/x86_64-unknown-linux-musl/release-tiny/brioche-packer \
artifacts/brioche-pack/x86_64-linux/
(cd artifacts/brioche-pack/x86_64-linux/ && tar --zstd -cf ../../brioche/x86_64-linux/brioche-pack.tar.zstd .)
tree -h artifacts/brioche-pack
tree -h artifacts/brioche
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: brioche
if-no-files-found: error
path: artifacts/brioche
push:
name: Push artifacts
if: github.ref_name == 'main' && github.repository == 'brioche-dev/brioche'
needs: [test, build]
runs-on: ubuntu-22.04
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: brioche
path: artifacts/brioche
- name: Upload to S3
run: |
aws s3 cp \
--endpoint "$S3_ENDPOINT" \
--recursive \
artifacts/brioche/ \
"s3://brioche-dev-development-content/github.com/brioche-dev/brioche/commits/$GITHUB_SHA/"
aws s3 sync \
--endpoint "$S3_ENDPOINT" \
--delete \
artifacts/brioche/ \
"s3://brioche-dev-development-content/github.com/brioche-dev/brioche/branches/$GITHUB_REF_NAME/"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.R2_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_S3_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ vars.R2_S3_REGION }}
S3_ENDPOINT: ${{ secrets.R2_S3_ENDPOINT }}

3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 12 additions & 76 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,76 +1,12 @@
[package]
name = "brioche"
version = "0.0.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = { version = "1.0.75", features = ["backtrace"] }
async-compression = { version = "0.4.5", features = ["tokio", "gzip", "xz", "zstd"] }
async-recursion = "1.0.5"
bincode = "1.3.3"
biome_js_parser = "0.3.1"
biome_js_syntax = "0.3.1"
biome_rowan = "0.3.1"
blake3 = "1.5.0"
brioche-pack = { git = "https://github.com/brioche-dev/brioche-pack.git" }
bstr = { version = "1.8.0", features = ["serde"] }
cfg-if = "1.0.0"
clap = { version = "4.4.11", features = ["derive"] }
console-subscriber = "0.2.0"
debug-ignore = "1.0.5"
deno_ast = { version = "0.27.3", features = ["transpiling"] }
deno_core = "0.201.0"
directories = "5.0.1"
fs_extra = "1.3.0"
futures = "0.3.29"
hex = "0.4.3"
human-repr = "1.1.0"
joinery = "3.1.0"
libmount = "0.1.15"
nix = "0.27.1"
opentelemetry = "0.21.0"
opentelemetry-http = { version = "0.10.0", features = ["reqwest"] }
opentelemetry-jaeger = "0.20.0"
opentelemetry-otlp = { version = "0.14.0", features = ["http-proto", "reqwest", "tls-roots", "grpc-tonic"] }
pathdiff = "0.2.1"
regex = "1.10.2"
relative-path = "1.9.0"
reqwest = { version = "0.11.22", default-features = false, features = ["rustls-tls", "stream"] }
reqwest-middleware = "0.2.4"
reqwest-retry = "0.3.0"
rust-embed = { version = "8.1.0", features = ["debug-embed", "interpolate-folder-path", "include-exclude"] }
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
serde_v8 = "0.112.0"
serde_with = { version = "3.4.0", features = ["hex"] }
sha2 = "0.10.8"
sqlx = { version = "0.7.3", features = ["runtime-tokio-rustls", "sqlite", "macros", "migrate", "json"] }
strum = { version = "0.25.0", features = ["derive"] }
superconsole = "0.2.0"
termwiz = "0.20.0"
thiserror = "1.0.51"
tokio = { version = "1.35.0", features = ["full", "tracing"] }
tokio-tar = "0.3.1"
tokio-util = { version = "0.7.10", features = ["compat", "full"] }
toml = "0.8.8"
tower-lsp = "0.20.0"
tracing = "0.1.40"
tracing-opentelemetry = "0.22.0"
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json", "tracing-log"] }
ulid = "1.1.0"
unshare = { git = "https://github.com/brioche-dev/unshare.git" }
url = { version = "2.5.0", features = ["serde"] }
urlencoding = "2.1.3"

[dev-dependencies]
assert_matches = "1.5.0"
criterion = { version = "0.5.1", features = ["async_tokio"] }
mockito = "1.2.0"
pretty_assertions = "1.4.0"
tempdir = "0.3.7"

[[bench]]
name = "resolve"
harness = false
[workspace]
members = ["crates/brioche", "crates/brioche-pack"]
default-members = ["crates/brioche"]
resolver = "2"

[profile.release-tiny]
inherits = "release"
opt-level = "z"
lto = true
codegen-units = 1
strip = "symbols"
panic = "abort"
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
.PHONY: update-db-schema
update-db-schema:
mkdir -p ./sqlx
DATABASE_URL=sqlite://./sqlx/schema.db?mode=rwc cargo sqlx migrate run
DATABASE_URL=sqlite://./sqlx/schema.db cargo sqlx prepare
$(MAKE) -C crates/brioche update-db-schema

.PHONY: check-db-schema
check-db-schema:
mkdir -p ./sqlx
DATABASE_URL=sqlite://./sqlx/schema.db?mode=rwc cargo sqlx migrate run
DATABASE_URL=sqlite://./sqlx/schema.db cargo sqlx prepare --check
$(MAKE) -C crates/brioche check-db-schema
18 changes: 18 additions & 0 deletions crates/brioche-pack/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "brioche-pack"
version = "0.0.1"
edition = "2021"

[dependencies]
blake3 = "1.5.0"
bstr = { version = "1.8.0", features = ["serde"] }
clap = { version = "4.4.11", features = ["derive"] }
goblin = "0.7.1"
pathdiff = "0.2.1"
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
serde_with = "3.4.0"
thiserror = "1.0.51"
ulid = "1.1.0"
urlencoding = "2.1.3"
userland-execve = { git = "https://github.com/brioche-dev/userland-execve-rust.git" }
Loading

0 comments on commit 66fa861

Please sign in to comment.