From 0dca0c9aa615623627a3115765a95dc819eb422f Mon Sep 17 00:00:00 2001 From: Chip Senkbeil Date: Thu, 7 Oct 2021 13:08:37 -0500 Subject: [PATCH] Bump to 0.15.0-alpha.7 w/ new release.yml --- .cargo/config.toml | 2 - .github/workflows/release.yml | 298 ++++++++++++++++++++++++++++++++++ Cargo.lock | 8 +- Cargo.toml | 6 +- README.md | 19 ++- distant-core/Cargo.toml | 2 +- distant-lua/Cargo.toml | 6 +- distant-ssh2/Cargo.toml | 4 +- 8 files changed, 325 insertions(+), 20 deletions(-) delete mode 100644 .cargo/config.toml create mode 100644 .github/workflows/release.yml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index 7d7cf07..0000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.x86_64-unknown-linux-musl] -linker = "x86_64-linux-musl-gcc" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5c6a0d0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,298 @@ +name: Release + +on: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+ + - v[0-9]+.[0-9]+.[0-9]+-** + +jobs: + macos: + name: "Build release on MacOS" + runs-on: macos-11.0 + if: startsWith(github.ref, 'refs/tags/') + env: + UPLOAD_NAME: macos + X86_ARCH: x86_64-apple-darwin + ARM_ARCH: aarch64-apple-darwin + X86_DIR: target/x86_64-apple-darwin/release + ARM_DIR: target/aarch64-apple-darwin/release + BUILD_BIN: distant + BUILD_LIB: libdistant_lua.dylib + UNIVERSAL_REL_BIN: distant-macos + UNIVERSAL_REL_LIB: distant_lua-macos.dylib + steps: + - uses: actions/checkout@v2 + - name: Install Rust (x86) + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + target: ${{ env.X86_ARCH }} + - name: Install Rust (ARM) + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + target: ${{ env.ARM_ARCH }} + - uses: Swatinem/rust-cache@v1 + - name: Build Lua 5.1 library (x86_64) + run: | + cd distant-lua + cargo build --release --no-default-features --features lua51,vendored --target ${{ env.X86_ARCH }} + ls -l ../${{ env.X86_DIR }} + - name: Build Lua 5.1 library (aarch64) + run: | + cd distant-lua + cargo build --release --no-default-features --features lua51,vendored --target ${{ env.ARM_ARCH }} + ls -l ../${{ env.ARM_DIR }} + - name: Unify libraries + run: | + lipo -create -output ${{ env.UNIVERSAL_REL_LIB }} \ + ./${{ env.X86_DIR }}/${{ env.BUILD_LIB }} \ + ./${{ env.ARM_DIR }}/${{ env.BUILD_LIB }} + chmod +x ./${{ env.UNIVERSAL_REL_LIB }} + - name: Build binary (x86_64) + run: | + cargo build --release --all-features --target ${{ env.X86_ARCH }} + ls -l ./${{ env.X86_DIR }} + strip ./${{ env.X86_DIR }}/${{ env.BUILD_BIN }} + - name: Build binary (aarch64) + run: | + cargo build --release --all-features --target ${{ env.ARM_ARCH }} + ls -l ./${{ env.ARM_DIR }} + strip ./${{ env.ARM_DIR }}/${{ env.BUILD_BIN }} + - name: Unify binaries + run: | + lipo -create -output ${{ env.UNIVERSAL_REL_BIN }} \ + ./${{ env.X86_DIR }}/${{ env.BUILD_BIN }} \ + ./${{ env.ARM_DIR }}/${{ env.BUILD_BIN }} + chmod +x ./${{ env.UNIVERSAL_REL_BIN }} + - name: Upload + uses: actions/upload-artifact@v2 + with: + name: ${{ env.UPLOAD_NAME }} + path: | + ${{ env.UNIVERSAL_REL_BIN }} + ${{ env.UNIVERSAL_REL_LIB }} + + windows: + name: "Build release on Windows" + runs-on: windows-latest + if: startsWith(github.ref, 'refs/tags/') + env: + UPLOAD_NAME: win64 + X86_ARCH: x86_64-pc-windows-msvc + X86_DIR: target/x86_64-pc-windows-msvc/release + BUILD_BIN: distant.exe + BUILD_LIB: distant_lua.dll + X86_REL_BIN: distant-win64.exe + X86_REL_LIB: distant_lua-win64.dll + steps: + - uses: actions/checkout@v2 + - name: Install Rust (MSVC) + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + target: ${{ env.X86_ARCH }} + - uses: Swatinem/rust-cache@v1 + - uses: xpol/setup-lua@v0.3 + with: + lua-version: "5.1.5" + - name: Build Lua 5.1 library (x86_64) + run: | + cd distant-lua + cargo build --release --no-default-features --features lua51 --target ${{ env.X86_ARCH }} + ls -l ../${{ env.X86_DIR }} + mv ../${{ env.X86_DIR }}/${{ env.BUILD_LIB }} ../${{ env.X86_REL_LIB }} + env: + LUA_INC: ${{ github.workspace }}\.lua\include + LUA_LIB: ${{ github.workspace }}\.lua\lib + LUA_LIB_NAME: lua + - name: Build binary (x86_64) + run: | + cargo build --release --all-features --target ${{ env.X86_ARCH }} + ls -l ./${{ env.X86_DIR }} + strip ./${{ env.X86_DIR }}/${{ env.BUILD_BIN }} + mv ./${{ env.X86_DIR }}/${{ env.BUILD_BIN }} ./${{ env.X86_REL_BIN }} + chmod +x ./${{ env.X86_REL_BIN }} + - name: Upload + uses: actions/upload-artifact@v2 + with: + name: ${{ env.UPLOAD_NAME }} + path: | + ${{ env.X86_REL_LIB }} + ${{ env.X86_REL_BIN }} + + linux: + name: "Build release on Linux" + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + env: + UPLOAD_NAME: linux64 + X86_GNU_ARCH: x86_64-unknown-linux-gnu + X86_GNU_DIR: target/x86_64-unknown-linux-gnu/release + X86_MUSL_ARCH: x86_64-unknown-linux-musl + X86_MUSL_DIR: target/x86_64-unknown-linux-musl/release + BUILD_BIN: distant + BUILD_LIB: libdistant_lua.so + X86_GNU_REL_BIN: distant-linux64-gnu + X86_MUSL_REL_BIN: distant-linux64-musl + X86_GNU_REL_LIB: distant_lua-linux64.so + steps: + - uses: actions/checkout@v2 + - name: Install Rust (GNU) + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + target: ${{ env.X86_GNU_ARCH }} + - name: Install Rust (MUSL) + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + target: ${{ env.X86_MUSL_ARCH }} + - name: Install MUSL Tools + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends musl-tools + - uses: Swatinem/rust-cache@v1 + - name: Build Lua 5.1 library (GNU x86_64) + run: | + cd distant-lua + cargo build --release --no-default-features --features lua51,vendored --target ${{ env.X86_GNU_ARCH }} + ls -l ../${{ env.X86_GNU_DIR }} + mv ../${{ env.X86_GNU_DIR }}/${{ env.BUILD_LIB }} ../${{ env.X86_GNU_REL_LIB }} + - name: Build binary (GNU x86_64) + run: | + cargo build --release --all-features --target ${{ env.X86_GNU_ARCH }} + ls -l ./${{ env.X86_GNU_DIR }} + strip ./${{ env.X86_GNU_DIR }}/${{ env.BUILD_BIN }} + mv ./${{ env.X86_GNU_DIR }}/${{ env.BUILD_BIN }} ./${{ env.X86_GNU_REL_BIN }} + chmod +x ./${{ env.X86_GNU_REL_BIN }} + - name: Build binary (MUSL x86_64) + run: | + cargo build --release --all-features --target ${{ env.X86_MUSL_ARCH }} + ls -l ./${{ env.X86_MUSL_DIR }} + strip ./${{ env.X86_MUSL_DIR }}/${{ env.BUILD_BIN }} + mv ./${{ env.X86_MUSL_DIR }}/${{ env.BUILD_BIN }} ./${{ env.X86_MUSL_REL_BIN }} + chmod +x ./${{ env.X86_MUSL_REL_BIN }} + - name: Upload + uses: actions/upload-artifact@v2 + with: + name: ${{ env.UPLOAD_NAME }} + path: | + ${{ env.X86_GNU_REL_LIB }} + ${{ env.X86_GNU_REL_BIN }} + ${{ env.X86_MUSL_REL_BIN }} + + publish: + needs: [macos, windows, linux] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + permissions: + contents: write + env: + MACOS: macos + MACOS_UNIVERSAL_BIN: distant-macos + MACOS_UNIVERSAL_LIB: distant_lua-macos.dylib + WIN64: win64 + WIN64_BIN: distant-win64.exe + WIN64_LIB: distant_lua-win64.dll + LINUX64: linux64 + LINUX64_GNU_BIN: distant-linux64-gnu + LINUX64_MUSL_BIN: distant-linux64-musl + LINUX64_GNU_LIB: distant_lua-linux64.so + steps: + - uses: actions/download-artifact@v2 + - name: Generate MacOS SHA256 checksums + run: | + cd ${{ env.MACOS }} + sha256sum ${{ env.MACOS_UNIVERSAL_LIB }} > ${{ env.MACOS_UNIVERSAL_LIB }}.sha256sum + echo "SHA_MACOS_LUA_LIB=$(cat ${{ env.MACOS_UNIVERSAL_LIB }}.sha256sum)" >> $GITHUB_ENV + sha256sum ${{ env.MACOS_UNIVERSAL_BIN }} > ${{ env.MACOS_UNIVERSAL_BIN }}.sha256sum + echo "SHA_MACOS_BIN=$(cat ${{ env.MACOS_UNIVERSAL_BIN }}.sha256sum)" >> $GITHUB_ENV + - name: Generate Win64 SHA256 checksums + run: | + cd ${{ env.WIN64 }} + sha256sum ${{ env.WIN64_LIB }} > ${{ env.WIN64_LIB }}.sha256sum + echo "SHA_WIN64_LUA_LIB=$(cat ${{ env.WIN64_LIB }}.sha256sum)" >> $GITHUB_ENV + sha256sum ${{ env.WIN64_BIN }} > ${{ env.WIN64_BIN }}.sha256sum + echo "SHA_WIN64_BIN=$(cat ${{ env.WIN64_BIN }}.sha256sum)" >> $GITHUB_ENV + - name: Generate Linux64 SHA256 checksums + run: | + cd ${{ env.LINUX64 }} + sha256sum ${{ env.LINUX64_GNU_LIB }} > ${{ env.LINUX64_GNU_LIB }}.sha256sum + echo "SHA_LINUX64_LUA_LIB=$(cat ${{ env.LINUX64_GNU_LIB }}.sha256sum)" >> $GITHUB_ENV + sha256sum ${{ env.LINUX64_GNU_BIN }} > ${{ env.LINUX64_GNU_BIN }}.sha256sum + echo "SHA_LINUX64_GNU_BIN=$(cat ${{ env.LINUX64_GNU_BIN }}.sha256sum)" >> $GITHUB_ENV + sha256sum ${{ env.LINUX64_MUSL_BIN }} > ${{ env.LINUX64_MUSL_BIN }}.sha256sum + echo "SHA_LINUX64_MUSL_BIN=$(cat ${{ env.LINUX64_MUSL_BIN }}.sha256sum)" >> $GITHUB_ENV + - name: Determine git tag + if: github.event_name == 'push' + run: | + TAG_NAME=${{ github.ref }} + echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV + - name: Publish + uses: softprops/action-gh-release@v1 + with: + name: distant ${{ env.TAG_NAME }} + fail_on_unmatched_files: true + target_commitish: ${{ github.sha }} + draft: false + prerelease: | + contains(env.TAG_NAME, 'alpha') || + contains(env.TAG_NAME, 'beta') || + contains(env.TAG_NAME, 'nightly') + files: | + ${{ env.MACOS }}/${{ env.MACOS_UNIVERSAL_BIN }} + ${{ env.MACOS }}/${{ env.MACOS_UNIVERSAL_LIB }} + ${{ env.WIN64 }}/${{ env.WIN64_BIN }} + ${{ env.WIN64 }}/${{ env.WIN64_LIB }} + ${{ env.LINUX64 }}/${{ env.LINUX64_GNU_BIN }} + ${{ env.LINUX64 }}/${{ env.LINUX64_MUSL_BIN }} + ${{ env.LINUX64 }}/${{ env.LINUX64_GNU_LIB }} + **/*.sha256sum + body: | + ## Install Lua library + ### Windows + 1. Download **${{ env.WIN64_LIB }}** + 2. Rename to `distant_lua.dll` + 3. Import via `distant = require("distant_lua")` + ### macOS + 1. Download **${{ env.MACOS_UNIVERSAL_LIB }}** + 2. Rename to `distant_lua.so` (still works on Mac for Lua) + - Alternatively, you can rename to `distant_lua.dylib` and add + `package.cpath = package.cpath .. ";?.dylib"` within your Lua code before + requiring the library + 3. Import via `distant = require("distant_lua")` + ### Linux + 1. Download **${{ env.LINUX64_GNU_LIB }}** + 2. Rename to `distant_lua.so` + 3. Import via `distant = require("distant_lua")` + ## Artifacts + A Lua library is built out to provide bindings to `distant-core` and `distant-ssh2` within Lua. + While this is geared towards usage in neovim, this Lua binding is generic and can be used in Lua + anyway. The library is built against Lua 5.1 (compatible with Luajit). Make sure to rename the + library to `distant_lua.{dll,dylib,so}` prior to importing as that is the expected name! + - **linux64** is the Linux library that supports the x86-64 platform using libc + - **macos** is the universal MacOS library that supports x86-64 and aarch64 (ARM) platforms + - **win64** is the Windows library release that supports the x86-64 platform and built via MSVC + + Standalone binaries are built out for Windows (x86_64), MacOS (Intel & ARM), and Linux (x86_64). + - **linux64-gnu** is the x86-64 release on Linux using libc + - **linux64-musl** is the x86-64 release on Linux using musl (static binary, no libc dependency) + - **macos** is a universal binary for Mac OS that supports x86-64 and aarch64 (arm) platforms + - **win64** is the x86-64 release on Windows using MSVC + ## SHA256 Checksums + ``` + ${{ env.SHA_MACOS_LUA_LIB }} + ${{ env.SHA_MACOS_BIN }} + ${{ env.SHA_WIN64_LUA_LIB }} + ${{ env.SHA_WIN64_BIN }} + ${{ env.SHA_LINUX64_LUA_LIB }} + ${{ env.SHA_LINUX64_GNU_BIN }} + ${{ env.SHA_LINUX64_MUSL_BIN }} + ``` diff --git a/Cargo.lock b/Cargo.lock index ececef5..464e128 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -435,7 +435,7 @@ dependencies = [ [[package]] name = "distant" -version = "0.15.0-alpha.6" +version = "0.15.0-alpha.7" dependencies = [ "assert_cmd", "assert_fs", @@ -459,7 +459,7 @@ dependencies = [ [[package]] name = "distant-core" -version = "0.15.0-alpha.6" +version = "0.15.0-alpha.7" dependencies = [ "assert_fs", "bytes", @@ -484,7 +484,7 @@ dependencies = [ [[package]] name = "distant-lua" -version = "0.15.0-alpha.6" +version = "0.15.0-alpha.7" dependencies = [ "distant-core", "distant-ssh2", @@ -518,7 +518,7 @@ dependencies = [ [[package]] name = "distant-ssh2" -version = "0.15.0-alpha.6" +version = "0.15.0-alpha.7" dependencies = [ "assert_cmd", "assert_fs", diff --git a/Cargo.toml b/Cargo.toml index 216d03c..9de6a84 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "distant" description = "Operate on a remote computer through file and process manipulation" categories = ["command-line-utilities"] keywords = ["cli"] -version = "0.15.0-alpha.6" +version = "0.15.0-alpha.7" authors = ["Chip Senkbeil "] edition = "2018" homepage = "https://github.com/chipsenkbeil/distant" @@ -28,7 +28,7 @@ ssh2 = ["distant-ssh2"] [dependencies] derive_more = { version = "0.99.16", default-features = false, features = ["display", "from", "error", "is_variant"] } -distant-core = { version = "=0.15.0-alpha.6", path = "distant-core", features = ["structopt"] } +distant-core = { version = "=0.15.0-alpha.7", path = "distant-core", features = ["structopt"] } flexi_logger = "0.18.0" log = "0.4.14" once_cell = "1.8.0" @@ -40,7 +40,7 @@ strum = { version = "0.21.0", features = ["derive"] } whoami = "1.1.2" # Optional native SSH functionality -distant-ssh2 = { version = "=0.15.0-alpha.6", path = "distant-ssh2", optional = true } +distant-ssh2 = { version = "=0.15.0-alpha.7", path = "distant-ssh2", optional = true } [target.'cfg(unix)'.dependencies] fork = "0.1.18" diff --git a/README.md b/README.md index 78df438..23df8cd 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,26 @@ -# distant +# distant - remotely edit files and run programs -[![Crates.io][distant_crates_img]][distant_crates_lnk] [![Docs.rs][distant_doc_img]][distant_doc_lnk] [![CI][distant_rustc_img]][distant_rustc_lnk] [![CI][distant_ci_img]][distant_ci_lnk] +[![Crates.io][distant_crates_img]][distant_crates_lnk] [![Docs.rs][distant_doc_img]][distant_doc_lnk] [![RustC 1.51+][distant_rustc_img]][distant_rustc_lnk] + +| Operating System | Status | +| ---------------- | ------------------------------------------------------------------ | +| MacOS (x86, ARM) | [![MacOS CI][distant_ci_macos_img]][distant_ci_macos_lnk] | +| Linux (x86) | [![Linux CI][distant_ci_linux_img]][distant_ci_linux_lnk] | +| Windows (x86) | [![Windows CI][distant_ci_windows_img]][distant_ci_windows_lnk] | [distant_crates_img]: https://img.shields.io/crates/v/distant.svg [distant_crates_lnk]: https://crates.io/crates/distant [distant_doc_img]: https://docs.rs/distant/badge.svg [distant_doc_lnk]: https://docs.rs/distant -[distant_ci_img]: https://github.com/chipsenkbeil/distant/actions/workflows/ci.yml/badge.svg -[distant_ci_lnk]: https://github.com/chipsenkbeil/distant/actions/workflows/ci.yml [distant_rustc_img]: https://img.shields.io/badge/distant-rustc_1.51+-lightgray.svg [distant_rustc_lnk]: https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html -Binary to connect with a remote machine to edit files and run programs. +[distant_ci_macos_img]: https://github.com/chipsenkbeil/distant/actions/workflows/ci-macos.yml/badge.svg +[distant_ci_macos_lnk]: https://github.com/chipsenkbeil/distant/actions/workflows/ci-macos.yml +[distant_ci_linux_img]: https://github.com/chipsenkbeil/distant/actions/workflows/ci-linux.yml/badge.svg +[distant_ci_linux_lnk]: https://github.com/chipsenkbeil/distant/actions/workflows/ci-linux.yml +[distant_ci_windows_img]: https://github.com/chipsenkbeil/distant/actions/workflows/ci-windows.yml/badge.svg +[distant_ci_windows_lnk]: https://github.com/chipsenkbeil/distant/actions/workflows/ci-windows.yml 🚧 **(Alpha stage software) This program is in rapid development and may break or change frequently!** 🚧 diff --git a/distant-core/Cargo.toml b/distant-core/Cargo.toml index 4623b98..2f91137 100644 --- a/distant-core/Cargo.toml +++ b/distant-core/Cargo.toml @@ -3,7 +3,7 @@ name = "distant-core" description = "Core library for distant, enabling operation on a remote computer through file and process manipulation" categories = ["network-programming"] keywords = ["api", "async"] -version = "0.15.0-alpha.6" +version = "0.15.0-alpha.7" authors = ["Chip Senkbeil "] edition = "2018" homepage = "https://github.com/chipsenkbeil/distant" diff --git a/distant-lua/Cargo.toml b/distant-lua/Cargo.toml index 1607c53..772aa68 100644 --- a/distant-lua/Cargo.toml +++ b/distant-lua/Cargo.toml @@ -3,7 +3,7 @@ name = "distant-lua" description = "Lua bindings to the distant Rust crates" categories = ["api-bindings", "network-programming"] keywords = ["api", "async"] -version = "0.15.0-alpha.6" +version = "0.15.0-alpha.7" authors = ["Chip Senkbeil "] edition = "2018" homepage = "https://github.com/chipsenkbeil/distant" @@ -24,8 +24,8 @@ luajit = ["mlua/luajit"] vendored = ["mlua/vendored"] [dependencies] -distant-core = { version = "=0.15.0-alpha.6", path = "../distant-core" } -distant-ssh2 = { version = "=0.15.0-alpha.6", features = ["serde"], path = "../distant-ssh2" } +distant-core = { version = "=0.15.0-alpha.7", path = "../distant-core" } +distant-ssh2 = { version = "=0.15.0-alpha.7", features = ["serde"], path = "../distant-ssh2" } futures = "0.3.17" log = "0.4.14" mlua = { version = "0.6.5", features = ["async", "macros", "module", "serialize"] } diff --git a/distant-ssh2/Cargo.toml b/distant-ssh2/Cargo.toml index fb62b38..08f3e69 100644 --- a/distant-ssh2/Cargo.toml +++ b/distant-ssh2/Cargo.toml @@ -2,7 +2,7 @@ name = "distant-ssh2" description = "Library to enable native ssh-2 protocol for use with distant sessions" categories = ["network-programming"] -version = "0.15.0-alpha.6" +version = "0.15.0-alpha.7" authors = ["Chip Senkbeil "] edition = "2018" homepage = "https://github.com/chipsenkbeil/distant" @@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0" [dependencies] async-compat = "0.2.1" -distant-core = { version = "=0.15.0-alpha.6", path = "../distant-core" } +distant-core = { version = "=0.15.0-alpha.7", path = "../distant-core" } futures = "0.3.16" log = "0.4.14" rand = { version = "0.8.4", features = ["getrandom"] }