build mac binary in ci (#152)

* build mac binary in ci

* update

* update

* turn on verbose

* fix cross compile

* update

* update

* update

* update

* update

* update

* update
add-tracing
Meng Zhang 2023-05-27 14:31:27 -07:00 committed by GitHub
parent 552711a560
commit 734957d1de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 2757 additions and 26 deletions

View File

@ -4,14 +4,11 @@ on:
workflow_dispatch:
push:
branches: [ "main" ]
paths:
- 'Dockerfile.rust'
- '.github/workflows/docker.rust.yml'
- 'crates/**'
pull_request:
branches: ["main" ]
jobs:
build:
release-docker:
runs-on: ubuntu-latest
permissions:
contents: read
@ -21,21 +18,6 @@ jobs:
id-token: write
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
swap-storage: true
- name: Checkout repository
uses: actions/checkout@v3
with:
@ -84,3 +66,31 @@ jobs:
ghcr.io/${{ env.IMAGE_NAME }}:latest
cache-from: ${{ steps.cache.outputs.cache-from }}
cache-to: ${{ steps.cache.outputs.cache-to }}
release-binary:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11]
include:
- os: macos-11
target: aarch64-apple-darwin
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal --target ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- run: |
cargo build --release --target ${{ matrix.target }}
- uses: actions/upload-artifact@v3
with:
retention-days: 3
name: tabby_${{ matrix.target }}
path: target/${{ matrix.target }}/release/tabby

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
__pycache__
data
supervisord.pid
/target

2709
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

12
Cargo.toml Normal file
View File

@ -0,0 +1,12 @@
[workspace]
members = [
"crates/tabby",
"crates/ctranslate2-bindings",
"crates/rust-cxx-cmake-bridge",
]
[workspace.package]
version = "0.1.0"
edition = "2021"
authors = ["Meng Zhang"]
homepage = "https://github.com/TabbyML/tabby"

View File

@ -17,17 +17,17 @@ RUN apt-get update && \
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
WORKDIR /root
WORKDIR /root/workspace
COPY Cargo.toml Cargo.toml
COPY Cargo.lock Cargo.lock
COPY crates crates
WORKDIR /root/crates/tabby
RUN mkdir -p /opt/tabby/bin
RUN mkdir -p /opt/tabby/lib
RUN mkdir -p target
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/root/crates/tabby/target \
--mount=type=cache,target=/root/workspace/target \
cargo build --features link_shared --release && \
cp target/release/tabby /opt/tabby/bin/