Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix doc generation #775

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ jobs:
- name: Build & test WASM / JS package
run: |
cd crypto-ffi
npm install
bun install
cargo make wasm
bun run wdio
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@v1 # this implicitly caches Rust tools and build artifacts
with:
rustflags: ''
target: wasm32-unknown-unknown
target: |
wasm32-unknown-unknown
x86_64-unknown-linux-gnu

- name: Setup cargo-make
uses: davidB/rust-cargo-make@v1
Expand All @@ -41,10 +43,14 @@ jobs:
- name: Build Rust documentation
run: cargo doc --all --no-deps

- name: Build TypeScript docs
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Build TypeScript and Kotlin docs
run: |
cd crypto-ffi
cargo make wasm-build
cargo make docs-ts
cargo make docs-kotlin

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,4 @@ cd crypto-ffi/bindings/android
Publishing JS / WASM bindings happens automatically by a github workflow when a release tag is pushed.

If you would like to publish to `@wireapp/core-crypto` manually, log into NPM and
just run `npm publish`.
just run `bun publish`.
24 changes: 13 additions & 11 deletions crypto-ffi/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ script = '''
'''

[tasks.docs-kotlin]
dependencies = ["docs-kotlin-install-deps"]
dependencies = [
"docs-kotlin-install-deps",
{ name = "jvm-darwin", condition = { platforms = ["mac"] } },
{ name = "jvm-linux", condition = { platforms = ["linux"] } }
]
command = "java"
args = [
"-jar", "../target/_kotlin_docs_tmp/dokka-cli-${DOKKA_VERSION}.jar",
Expand All @@ -77,15 +81,15 @@ args = [
command = "cargo"
args = ["doc", "--no-deps", "--target=wasm32-unknown-unknown"]

[tasks.npm-deps]
command = "npm"
[tasks.bun-deps]
command = "bun"
args = ["install"]

[tasks.docs-ts]
dependencies = ["npm-deps"]
command = "npx"
dependencies = ["wasm", "bun-deps"]
command = "bunx"
args = [
"-y", "typedoc",
"typedoc",
"--basePath", "./bindings/js",
"--entryPoints", "./bindings/js/CoreCrypto.ts",
"--tsconfig", "./bindings/js/tsconfig.json",
Expand All @@ -112,11 +116,9 @@ args = [
script = "cargo make wasm-build --dev"

[tasks.wasm]
dependencies = ["wasm-build"]
script = [
"bun install",
"bun run build_ts.ts"
]
dependencies = ["wasm-build", "bun-deps"]
command = "bun"
args = ["run", "build_ts.ts"]

##################################### FFI #####################################

Expand Down
12 changes: 6 additions & 6 deletions interop/src/build/web/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ pub(crate) async fn build_wasm() -> Result<()> {
if cfg!(feature = "proteus") {
let spinner = RunningProcess::new("Building Cryptobox ESM bundle...", false);

Command::new("npm")
Command::new("bun")
.args(["install"])
.current_dir(cwd.join("interop/src/build/web/cryptobox-esm"))
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null())
.status()
.await?;

Command::new("npm")
Command::new("bun")
.args(["run", "build"])
.current_dir(cwd.join("interop/src/build/web/cryptobox-esm"))
.stdout(std::process::Stdio::null())
Expand Down Expand Up @@ -113,15 +113,15 @@ pub(crate) async fn build_wasm() -> Result<()> {
}

let mut cargo_args = vec!["make", "wasm"];
let mut npm_env = vec![];
let mut bun_env = vec![];

if cfg!(feature = "proteus") {
spinner.update(
"`proteus` feature enabled. Building `core-crypto` with proteus support & enabling npm env BUILD_PROTEUS=1; Also building ESM bundle for Cryptobox",
"`proteus` feature enabled. Building `core-crypto` with proteus support & enabling bun env BUILD_PROTEUS=1; Also building ESM bundle for Cryptobox",
);
cargo_args.push("--features");
cargo_args.push("proteus");
npm_env.push(("BUILD_PROTEUS", "1"));
bun_env.push(("BUILD_PROTEUS", "1"));
}

Command::new("cargo")
Expand All @@ -133,7 +133,7 @@ pub(crate) async fn build_wasm() -> Result<()> {

Command::new("bun")
.args(["run", "wdio"])
.envs(npm_env.clone())
.envs(bun_env.clone())
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null())
.status()
Expand Down
Loading