Skip to content

Commit

Permalink
build libs on the action
Browse files Browse the repository at this point in the history
  • Loading branch information
x86y committed Jun 25, 2023
1 parent 930a041 commit c73cd0a
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 154 deletions.
79 changes: 43 additions & 36 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
name: Release
on: [push, pull_request]
on: [push]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_TERM_COLOR: always

jobs:
windows:
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: BQN_WASM="D:/a/beacon/beacon/BQN.wasm" cargo build --release --no-default-features --features=bqnwasm
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: target/release/beacon.exe

linux:
runs-on: ubuntu-latest
steps:
Expand All @@ -42,22 +18,36 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build bqn shared lib
build/obj
build/obj2
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust Windows target
run: |
rustup update && rustup target add x86_64-pc-windows-gnu
sudo apt-get update
sudo apt-get install binutils-mingw-w64 mingw-w64
- name: Build bqn shared lib and wasm file
run: |
git clone https://github.com/dzaima/CBQN
cd CBQN
FFI=0 make shared-o3
mv libcbqn.so ../
- name: Build
FFI=0 make shared-o3 notui=1
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz
tar xvf wasi-sdk-20.0-linux.tar.gz
FFI=0 make wasi-reactor-o3 notui=1 CC=./wasi-sdk-20.0/bin/clang
mv libcbqn.so BQN.wasm ../
- name: Build Linux
run: |
RUSTFLAGS="-L ${{ github.workspace }}" LD_LIBRARY_PATH="${{ github.workspace }}/libcbqn.so" cargo build --release
mv target/release/beacon ./beacon_linux
mv target/release/beacon ./beacon_x86_64-unknown-linux-gnu
- name: Build Windows
run: |
BQN_WASM=${{ github.workspace }}/BQN.wasm cargo build --release --target x86_64-pc-windows-gnu --no-default-features --features=bqnwasm
mv target/x86_64-pc-windows-gnu/release/beacon.exe ./beacon_x86_64-pc-windows-gnu.exe
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./beacon_linux
files: ./beacon_x86_64-unknown-linux-gnu ./beacon_x86_64-pc-windows-gnu.exe

macos:
runs-on: macos-11
Expand All @@ -71,20 +61,37 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
build/obj
build/obj2
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install ARM target
- name: Install Rust ARM target
run: |
rustup update && rustup target add aarch64-apple-darwin
cargo install cargo-bundle || echo "already installed"
- name: Build x86
run: |
git clone https://github.com/dzaima/CBQN
cd CBQN
FFI=0 make shared-o3 notui=1
mv libcbqn.dylib ..
cd ..
RUSTFLAGS="-L ${{ github.workspace }}" LD_LIBRARY_PATH="${{ github.workspace }}/libcbqn_86.dylib" cargo bundle --release
- name: Build ARM
run: RUSTFLAGS="-L ${{ github.workspace }}" LD_LIBRARY_PATH="${{ github.workspace }}/libcbqn.dylib" cargo bundle --release --target=aarch64-apple-darwin
run: |
rm libcbqn.dylib
cd CBQN
FFI=0 CCFLAGS=--target=aarch64-apple-darwin make shared-o3 target_arch=aarch64 notui=1
mv libcbqn.dylib ..
cd ..
RUSTFLAGS="-L ${{ github.workspace }}" LD_LIBRARY_PATH="${{ github.workspace }}/libcbqn_arm.dylib" cargo bundle --release --target=aarch64-apple-darwin
- name: Create DMG
run: |
git clone https://github.com/create-dmg/create-dmg
chmod u+x create-dmg/create-dmg
./create-dmg/create-dmg Beacon.dmg target/aarch64-apple-darwin/release/bundle/osx/Beacon.app
./create-dmg/create-dmg Beacon_aarch64-apple-darwin.dmg target/aarch64-apple-darwin/release/bundle/osx/Beacon.app
./create-dmg/create-dmg Beacon_x86_64-apple-darwin.dmg target/release/bundle/osx/Beacon.app
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: Beacon.dmg
files: Beacon_aarch64-apple-darwin.dmg Beacon_x86_64-apple-darwin.dmg
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target
.DS_Store
lib*.*
Binary file removed BQN.wasm
Binary file not shown.
109 changes: 1 addition & 108 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ iced = { git = "https://github.com/iced-rs/iced", features = ["async-std", "debu
iced_core = { git = "https://github.com/iced-rs/iced", rev = "b38f7d28372712e345672515d8c1643bc040c1f1" }
iced_runtime = { git = "https://github.com/iced-rs/iced", rev = "b38f7d28372712e345672515d8c1643bc040c1f1" }
iced_style = { git = "https://github.com/iced-rs/iced", rev = "b38f7d28372712e345672515d8c1643bc040c1f1" }
itertools = "0.11.0"
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
# itertools = "0.11.0"
# tracing = "0.1.37"
# tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
ngnk = { version = "0.2.3", optional = true}


Expand Down
Binary file removed libcbqn.dylib
Binary file not shown.
Binary file removed libk.so
Binary file not shown.
13 changes: 8 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use iced_runtime::font::load;
use once_cell::sync::Lazy;
use std::collections::HashMap;
use std::time::Instant;
use views::tabs::tab_view;
// use tracing::{event as e, info, instrument, Level};

mod docs;
Expand All @@ -28,13 +29,13 @@ use crate::widgets::text_input;
use utils::keval;
use utils::{truncate, HistoryMap, REPL};
use views::pane::{view_pane, Pane};
use views::toolbar::toolbar;
use views::toolbar::toolbar_view;

pub static INPUT_ID: Lazy<text_input::Id> = Lazy::new(text_input::Id::unique);
static SCROLL_ID: Lazy<scrollable::Id> = Lazy::new(scrollable::Id::unique);

pub fn main() -> iced::Result {
tracing_subscriber::fmt::init();
// tracing_subscriber::fmt::init();
Beacon::run(Settings {
window: window::Settings {
size: (430, 800),
Expand Down Expand Up @@ -426,14 +427,16 @@ impl Application for Beacon {
..
},
) => {
let glyphbar = toolbar();
let glyphbar = toolbar_view();
let tabs = tab_view(outs, *at);

let focus = focus;
let total_panes = panes.len();
let pane_grid = PaneGrid::new(&panes, |id, pane, is_maximized| {
let is_focused = *focus == Some(id);
let pane_outs = outs
.0
.get(&0)
.get(at)
.and_then(|h| h.get(unsafe { &std::mem::transmute::<_, usize>(id) }));
pane_grid::Content::new(responsive(move |size| {
view_pane(
Expand All @@ -453,7 +456,7 @@ impl Application for Beacon {
.on_click(Message::Clicked)
.on_drag(Message::Dragged)
.on_resize(10, Message::Resized);
container(column![glyphbar, pane_grid])
container(column![glyphbar, tabs, pane_grid])
.width(Length::Fill)
.height(Length::Fill)
.padding(10)
Expand Down
3 changes: 2 additions & 1 deletion src/views/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub mod toolbar;
pub mod pane;
pub mod tabs;
pub mod toolbar;
Loading

0 comments on commit c73cd0a

Please sign in to comment.