Skip to content

Commit

Permalink
Genereates binaries for x86_64 and arm-32 (#24)
Browse files Browse the repository at this point in the history
* cross compilation

* github actions

* ignore ci changes

* single source of truth

* bump version

* publish

* fix runs-on

* dependency for publish

* changes

* update cargo changes

* strict version dependency
  • Loading branch information
akhildevelops committed Jun 2, 2023
1 parent 450169f commit 73f5e56
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 36 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release

on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
build:
name: Release - ${{ matrix.platform.release_for }}
strategy:
matrix:
platform:
- release_for: Arm-32
os: ubuntu-latest
target: arm-unknown-linux-gnueabihf
bin: localtunnel
name: localtunnel-linux-arm32.tar.tz
command: build
- release_for: x86_64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
bin: localtunnel
name: localtunnel-linux-x86_64.tar.tz
command: build
runs-on: ${{ matrix.platform.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build binary
uses: houseabsolute/actions-rust-cross@v0
with:
command: ${{ matrix.platform.command }}
target: ${{ matrix.platform.target }}
args: "--locked --release"
- name: Package as archive
shell: bash
run: |
cd target/${{ matrix.platform.target }}/release
tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
cd -
- name: Upload package as artifact
uses: actions/upload-artifact@v3
with:
name: binaries
path: ${{ matrix.platform.name }}

publish:
needs: [build]
name: Publish binaries
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: binaries
path: ./binaries
- name: Publish artifacts
uses: softprops/action-gh-release@v1
with:
files: ./binaries/*
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: test

on:
pull_request:
branches:
- main
paths-ignore:
- '.github/workflows/publish.yml'
- '.github/workflows/test.yml'
- '.github/FUNDING.yml'
- '**README.md'
- '.gitignore'
- 'LICENSE'
jobs:
tests-package:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Rust tooling
uses: dtolnay/rust-toolchain@stable
- name: Cache rust
uses: Swatinem/rust-cache@v2
- name: Test Rust
run: cargo test
20 changes: 15 additions & 5 deletions Cargo.lock

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

14 changes: 9 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[workspace]
package.edition = "2021"
package.license = "MIT"
package.repository = "https://github.com/kaichaosun/rlt"
members = ["cli", "client", "server"]

members = [
"cli",
"client",
"server"
]
[workspace.dependencies]
tokio = { version = "1.23.0", features = ["full"] }
anyhow = { version = "1.0", features = ["backtrace"] }
log = "0.4"
serde = { version = "1.0", features = ["derive"] }
5 changes: 5 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[target.arm-unknown-linux-gnueabihf]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt-get update && apt-get install --assume-yes libssl-dev:amd64 libssl-dev:$CROSS_DEB_ARCH",
]
18 changes: 9 additions & 9 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[package]
name = "localtunnel"
version = "0.1.1"
edition = "2021"
version = "0.1.2"
edition.workspace = true
description = "A CLI to proxy with localtunnel server."
license = "MIT"
repository = "https://github.com/kaichaosun/rlt"
license.workspace = true
repository.workspace = true

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

[dependencies]
clap = { version = "3.2.14", features = ["derive"] }
localtunnel-client = { path = "../client", version = "0.1.1" }
localtunnel-server = { path = "../server", version = "0.1.1" }
tokio = { version = "1.23.0", features = ["full"] }
log = "0.4"
localtunnel-client = { path = "../client", version = "0.1.2" }
localtunnel-server = { path = "../server", version = "0.1.2" }
tokio = { workspace = true }
log = { workspace = true }
env_logger = "0.9"
anyhow = { version = "1.0", features = ["backtrace"] }
anyhow = { workspace = true }
16 changes: 8 additions & 8 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[package]
name = "localtunnel-client"
version = "0.1.1"
edition = "2021"
version = "0.1.2"
edition.workspace = true
description = "A client to connect with localtunnel server."
license = "MIT"
repository = "https://github.com/kaichaosun/rlt"
license.workspace = true
repository.workspace = true

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

[dependencies]
reqwest = { version = "0.11", features = ["json"], default-features = false }
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1.23.0", features = ["full"] }
anyhow = { version = "1.0", features = ["backtrace"] }
log = "0.4"
serde = { workspace = true }
tokio = { workspace = true }
anyhow = { workspace = true }
log = { workspace = true }

[features]
default = ["reqwest/default"]
Expand Down
22 changes: 13 additions & 9 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
[package]
name = "localtunnel-server"
version = "0.1.1"
edition = "2021"
version = "0.1.2"
edition.workspace = true
description = "Server implementation of localtunnel."
license = "MIT"
repository = "https://github.com/kaichaosun/rlt"
license.workspace = true
repository.workspace = true

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

[dependencies]
tokio = { version = "1.23.0", features = ["full"] }
anyhow = { version = "1.0", features = ["backtrace"] }
log = "0.4"
tokio = { workspace = true }
anyhow = { workspace = true }
log = { workspace = true }
actix-web = "4"
serde = { version = "1.0", features = ["derive"] }
serde = { workspace = true }
hyper = { version = "1.0.0-rc.1", features = ["full"] }
reqwest = { version = "0.11", features = ["blocking", "json"] }
reqwest = { version = "0.11", features = [
"json",
"blocking",
"native-tls-vendored",
] }
lazy_static = "1.4.0"
envy = "0.4"
dotenv = "0.15.0"
Expand Down

0 comments on commit 73f5e56

Please sign in to comment.