Skip to content

Commit

Permalink
Add initial CI (#260)
Browse files Browse the repository at this point in the history
* Add initial CI

* Temporary force CI for current branch

* Ensure pnpm is installed

* Use the latest version of pnpm

Change step names

* Add pnpm install step

* Ensure fiberplane/fpx-types is checked in

* Ensure that Tauri required dependencies are installed

* Retrieve artifact using the tauri step output

* Disable arm for Linux build for now

This gives some compile issues with openssl. Which is currently required. Tauri v2 will solve this issues

* Try to join the artifact paths to get all the files

* Decode from json first

Add ci flag

* Use var directly

* Multiline?

* Roundabout way :rolling_eyes:

* Add debug message

* Also include directories as artifacts

* Use manual commands

Move to tauri v2

* Force bundles into a string value

* Escape arguments

Only include bundle directory

* No space allowed :(

* Include target in artifact path

* Unblock frontends, build workflows

Synchronize CI workflows

Unset default-members to build and clippy everything

* Resolve issues for cargo deny

* Ensure tauri deps are installed during build_cli

* Ignore generate code/json

* Fix path

* Fix order

* Resolve clippies

Co-authored: Steph
  • Loading branch information
hatchan authored Sep 18, 2024
1 parent 419e765 commit 7deec92
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 28 deletions.
27 changes: 13 additions & 14 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Test and build the project.
---
name: Build

name: Build cli
on:
# Allow manual trigger
workflow_dispatch:
Expand All @@ -12,23 +11,17 @@ on:

# Run on every push to main
push:
branches: ["main"]
branches: ["main", "tauri-main"]

jobs:
build:
name: Create binary for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest-8-cores

name: Create binary for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
env:
CARGO: cargo
TARGET_FLAGS: ""
TARGET_DIR: ../target
RUST_BACKTRACE: 1
- os: ubuntu-latest-8-cores
target: x86_64-unknown-linux-gnu

permissions:
id-token: write
Expand All @@ -40,6 +33,12 @@ jobs:
fetch-depth: 0
submodules: recursive

- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest-8-cores'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
Expand All @@ -63,6 +62,6 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: fpx_${{ matrix.target }}
path: target/release/fpx
path: target/release/fpx-cli
if-no-files-found: error
retention-days: 7
98 changes: 98 additions & 0 deletions .github/workflows/build_app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Build the fpx app. This will only be published as a build artifact.
---
name: Build app
on:
# Allow manual trigger
workflow_dispatch:

# Run on every pull request
pull_request:
branches: ["*"]

# Run on every push to main
push:
branches: ["main", "tauri-main"]

jobs:
build-app:
name: Create binary for ${{ matrix.target }}
runs-on: ${{ matrix.os }}

# permissions:
# id-token: write
# contents: read

strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest-8-cores
target: x86_64-unknown-linux-gnu
bundles: appimage
- os: macos-latest
target: aarch64-apple-darwin
bundles: app,dmg
- os: macos-latest
target: x86_64-apple-darwin
bundles: app,dmg

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

# Steps required for our project, or our dependencies (like Tauri)

- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest-8-cores'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: "pnpm"

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
target: ${{ matrix.target }}
rustflags: "" # Do not fail on warnings, so reset the default value to empty

- name: Install tauri-cli
run: cargo install [email protected]

# Steps related to our project

- name: Install dependencies
run: pnpm install
env:
CI: true

- name: Build shared types
run: pnpm build:types

- name: Build fpx-app
run: |
cargo tauri build \
--ci \
--target "${{ matrix.target }}" \
--bundles "${{ matrix.bundles }}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: fpx_${{ matrix.target }}
if-no-files-found: error
retention-days: 7
path: target/${{ matrix.target }}/release/bundle
10 changes: 9 additions & 1 deletion .github/workflows/build_frontends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ env:
jobs:
build_packages:
name: Build packages
runs-on: ubuntu-latest
runs-on: ubuntu-latest-8-cores
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies (Linux)
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
Expand All @@ -41,6 +46,9 @@ jobs:
env:
CI: true

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Build shared types
run: pnpm build:types

Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[workspace]
resolver = "2"
members = ["fpx", "fpx-app", "fpx-cli", "fpx-macros", "fpx-workers", "xtask"]
default-members = ["fpx-cli"]

[workspace.package]
authors = ["Fiberplane <[email protected]>"]
Expand Down
8 changes: 2 additions & 6 deletions biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,9 @@
".astro",

// ignore all tsconfig.json files
"tsconfig.json"
"tsconfig.json",

// Rust code related
// This caused biome to ignore the entire fpx folder
// commenting out for now as we still want to find a way to
// skip Rust code in biome
// "fpx/*.*"
"fpx-app/gen"
]
}
}
5 changes: 4 additions & 1 deletion deny.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
[advisories]
ignore = []
ignore = [
"RUSTSEC-2024-0370", # unmaintained - proc-macro-error
]
yanked = "deny"

[licenses]
allow = [
"Apache-2.0",
"Apache-2.0 WITH LLVM-exception",
"BSD-3-Clause",
"ISC",
"MIT",
Expand Down
6 changes: 5 additions & 1 deletion fpx-app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[package]
name = "fpx-app"
version = "0.1.0"
description = "A Tauri App"
edition = "2021"
version = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
repository = { workspace = true }

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

Expand Down
2 changes: 1 addition & 1 deletion fpx/src/api/handlers/traces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub async fn traces_get_handler(
// Retrieve all the spans that are associated with the trace
let spans = store.span_list_by_trace(&tx, &trace_id).await?;

let trace = TraceSummary::from_spans(trace_id.into(), spans).ok_or(TraceGetError::NotFound)?;
let trace = TraceSummary::from_spans(trace_id, spans).ok_or(TraceGetError::NotFound)?;

Ok(Json(trace))
}
Expand Down
4 changes: 3 additions & 1 deletion fpx/src/data/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ impl HexEncodedId {
pub fn as_inner(&self) -> &str {
&self.0
}
}

pub fn as_mut(&mut self) -> &mut str {
impl AsMut<str> for HexEncodedId {
fn as_mut(&mut self) -> &mut str {
&mut self.0
}
}
Expand Down
2 changes: 1 addition & 1 deletion studio/src/tauri/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Workspace } from "@fiberplane/fpx-types";
import { invoke } from "@tauri-apps/api/core";
import { open } from "@tauri-apps/plugin-dialog";
import { appDataDir } from "@tauri-apps/api/path";
import { open } from "@tauri-apps/plugin-dialog";

export async function listRecentWorkspaces() {
return await invoke<Array<string>>("list_recent_workspaces");
Expand Down
2 changes: 1 addition & 1 deletion xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = { workspace = true }
anyhow = { workspace = true }
clap = { workspace = true, features = ["derive", "env"] }
fpx = { version = "0.1.0", path = "../fpx" }
fpx-app = { path = "../fpx-app" }
fpx-app = { version = "0.1.0", path = "../fpx-app" }
schemars = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
Expand Down

0 comments on commit 7deec92

Please sign in to comment.