Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Odonno committed Apr 20, 2024
1 parent 0ebef59 commit 603c17c
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 4 deletions.
42 changes: 41 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Main Workflow

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -118,3 +122,39 @@ jobs:
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}

release:
name: release ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-gnu
archive: zip
- target: x86_64-unknown-linux-musl
archive: tar.gz tar.xz tar.zst
- target: wasm32-wasi
archive: zip

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

- name: Install 1.77.0 toolchain
uses: dtolnay/rust-toolchain@1.77.0

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Compile and release
uses: rust-build/rust-build.action@v1.4.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUSTFLAGS: "--cfg surrealdb_unstable"
RUSTDOCFLAGS: "--cfg surrealdb_unstable"
with:
RUSTTARGET: ${{ matrix.target }}
ARCHIVE_TYPES: ${{ matrix.archive }}
EXTRA_FILES: "readme.md LICENSE"
TOOLCHAIN_VERSION: stable
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
archive: zip
- target: x86_64-unknown-linux-musl
archive: tar.gz tar.xz tar.zst
- target: x86_64-apple-darwin
archive: zip
# - target: x86_64-apple-darwin
# archive: zip
# - target: wasm32-wasi
# archive: zip

Expand All @@ -32,9 +32,11 @@ jobs:
uses: Swatinem/rust-cache@v2

- name: Compile and release
uses: rust-build/rust-build.action@v1.4.3
uses: rust-build/rust-build.action@v1.4.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUSTFLAGS: "--cfg surrealdb_unstable"
RUSTDOCFLAGS: "--cfg surrealdb_unstable"
with:
RUSTTARGET: ${{ matrix.target }}
ARCHIVE_TYPES: ${{ matrix.archive }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Samples Workflow

on:
push:
branches:
- main
paths-ignore:
- "**.md"
- "LICENSE"
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ tokio-test = "0.4.4"

[package.metadata.docs.rs]
rustc-args = ["--cfg", "surrealdb_unstable"]

# [target.'cfg(target_arch = "wasm32")'.dependencies]
# tokio = { version = "1.37.0", features = ["macros", "rt"] }
11 changes: 11 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,19 @@ mod scaffold;
mod surrealdb;
mod validate_version_order;

#[cfg(target_arch = "wasm32")]
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<()> {
sub_main().await
}

#[cfg(not(target_arch = "wasm32"))]
#[tokio::main]
async fn main() -> Result<()> {
sub_main().await
}

async fn sub_main() -> Result<()> {
color_eyre::install()?;
let args = Args::parse();

Expand Down

0 comments on commit 603c17c

Please sign in to comment.