Skip to content

Commit

Permalink
Add filesystem watching & remove distant-lua (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
chipsenkbeil authored Mar 31, 2022
1 parent f46eeea commit 268ec94
Show file tree
Hide file tree
Showing 85 changed files with 2,615 additions and 7,327 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/ci-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ jobs:
run: cargo clippy -p distant-core --all-targets --verbose --all-features
- name: distant-ssh2 (all features)
run: cargo clippy -p distant-ssh2 --all-targets --verbose --all-features
- name: distant-lua (lua51 & vendored)
run: (cd distant-lua && cargo clippy --all-targets --verbose --no-default-features --features "lua51,vendored")
shell: bash
- name: distant-lua-tests (lua51 & vendored)
run: (cd distant-lua-tests && cargo clippy --tests --verbose --no-default-features --features "lua51,vendored")
shell: bash
- name: distant (all features)
run: cargo clippy --all-targets --verbose --all-features

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,3 @@ jobs:
- name: Run CLI tests (no default features)
run: cargo test --verbose --no-default-features
shell: bash
- name: Run Lua tests
run: (cd distant-lua && cargo build) && (cd distant-lua-tests && cargo test --verbose)
shell: bash
3 changes: 0 additions & 3 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,3 @@ jobs:
- name: Run CLI tests (no default features)
run: cargo test --verbose --no-default-features
shell: bash
- name: Run Lua tests
run: (cd distant-lua && cargo build) && (cd distant-lua-tests && cargo test --verbose)
shell: bash
12 changes: 0 additions & 12 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,3 @@ jobs:
- name: Build CLI (no default features)
run: cargo build --verbose --no-default-features
shell: bash
- uses: xpol/[email protected]
with:
lua-version: "5.1.5"
- name: Build Lua (Lua 5.1)
run: |
cd ${{ github.workspace }}\distant-lua
cargo build --verbose --no-default-features --features lua51
shell: cmd
env:
LUA_INC: ${{ github.workspace }}\.lua\include
LUA_LIB: ${{ github.workspace }}\.lua\lib
LUA_LIB_NAME: lua
125 changes: 1 addition & 124 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ on:
- v[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-**

env:
LUA_VERSION: 5.1.5
LUA_FEATURE: lua51

jobs:
macos:
name: "Build release on MacOS"
Expand All @@ -22,11 +18,7 @@ jobs:
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
X86_REL_LIB: distant_lua-macos-intel.dylib
ARM_REL_LIB: distant_lua-macos-arm.dylib
steps:
- uses: actions/checkout@v2
- name: Install Rust (x86)
Expand All @@ -42,24 +34,6 @@ jobs:
toolchain: stable
target: ${{ env.ARM_ARCH }}
- uses: Swatinem/rust-cache@v1
- name: Build Lua ${{ env.LUA_VERSION }} library (x86_64)
run: |
cd distant-lua
cargo build --release --no-default-features --features "${{ env.LUA_FEATURE }},vendored" --target ${{ env.X86_ARCH }}
ls -l ../${{ env.X86_DIR }}
cp ../${{ env.X86_DIR }}/${{ env.BUILD_LIB }} ../${{ env.X86_REL_LIB }}
- name: Build Lua ${{ env.LUA_VERSION }} library (aarch64)
run: |
cd distant-lua
cargo build --release --no-default-features --features "${{ env.LUA_FEATURE }},vendored" --target ${{ env.ARM_ARCH }}
ls -l ../${{ env.ARM_DIR }}
cp ../${{ env.ARM_DIR }}/${{ env.BUILD_LIB }} ../${{ env.ARM_REL_LIB }}
- 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 }}
Expand All @@ -82,9 +56,6 @@ jobs:
name: ${{ env.UPLOAD_NAME }}
path: |
${{ env.UNIVERSAL_REL_BIN }}
${{ env.UNIVERSAL_REL_LIB }}
${{ env.X86_REL_LIB }}
${{ env.ARM_REL_LIB }}
windows:
name: "Build release on Windows"
Expand All @@ -95,9 +66,7 @@ jobs:
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)
Expand All @@ -107,19 +76,6 @@ jobs:
toolchain: stable
target: ${{ env.X86_ARCH }}
- uses: Swatinem/rust-cache@v1
- uses: xpol/[email protected]
with:
lua-version: "${{ env.LUA_VERSION }}"
- name: Build Lua ${{ env.LUA_VERSION }} library (x86_64)
run: |
cd distant-lua
cargo build --release --no-default-features --features "${{ env.LUA_FEATURE }}" --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 }}
Expand All @@ -132,7 +88,6 @@ jobs:
with:
name: ${{ env.UPLOAD_NAME }}
path: |
${{ env.X86_REL_LIB }}
${{ env.X86_REL_BIN }}
linux_gnu:
Expand All @@ -144,9 +99,7 @@ jobs:
X86_GNU_ARCH: x86_64-unknown-linux-gnu
X86_GNU_DIR: target/x86_64-unknown-linux-gnu/release
BUILD_BIN: distant
BUILD_LIB: libdistant_lua.so
X86_GNU_REL_BIN: distant-linux64-gnu
X86_GNU_REL_LIB: distant_lua-linux64-gnu.so
steps:
- uses: actions/checkout@v2
- name: Install Rust (GNU)
Expand All @@ -156,12 +109,6 @@ jobs:
toolchain: stable
target: ${{ env.X86_GNU_ARCH }}
- uses: Swatinem/rust-cache@v1
- name: Build Lua ${{ env.LUA_VERSION }} library (GNU x86_64)
run: |
cd distant-lua
cargo build --release --no-default-features --features "${{ env.LUA_FEATURE }},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 }}
Expand All @@ -174,7 +121,6 @@ jobs:
with:
name: ${{ env.UPLOAD_NAME }}
path: |
${{ env.X86_GNU_REL_LIB }}
${{ env.X86_GNU_REL_BIN }}
linux_musl:
Expand All @@ -188,9 +134,7 @@ jobs:
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_MUSL_REL_BIN: distant-linux64-musl
X86_MUSL_REL_LIB: distant_lua-linux64-musl.so
steps:
- uses: actions/checkout@v2
- name: Install base dependencies
Expand All @@ -200,15 +144,6 @@ jobs:
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
- uses: Swatinem/rust-cache@v1
- name: Build Lua ${{ env.LUA_VERSION }} library (MUSL x86_64)
run: |
cd distant-lua
source $HOME/.cargo/env
cargo build --release --no-default-features --features "${{ env.LUA_FEATURE }},vendored" --target ${{ env.X86_MUSL_ARCH }}
ls -l ../${{ env.X86_MUSL_DIR }}
mv ../${{ env.X86_MUSL_DIR }}/${{ env.BUILD_LIB }} ../${{ env.X86_MUSL_REL_LIB }}
env:
RUSTFLAGS: -C target-feature=-crt-static -C linker=x86_64-alpine-linux-musl-gcc
- name: Build binary (MUSL x86_64)
run: |
source $HOME/.cargo/env
Expand All @@ -222,7 +157,6 @@ jobs:
with:
name: ${{ env.UPLOAD_NAME }}
path: |
${{ env.X86_MUSL_REL_LIB }}
${{ env.X86_MUSL_REL_BIN }}
publish:
Expand All @@ -234,50 +168,32 @@ jobs:
env:
MACOS: macos
MACOS_UNIVERSAL_BIN: distant-macos
MACOS_UNIVERSAL_LIB: distant_lua-macos.dylib
MACOS_X86_LIB: distant_lua-macos-intel.dylib
MACOS_ARM_LIB: distant_lua-macos-arm.dylib
WIN64: win64
WIN64_BIN: distant-win64.exe
WIN64_LIB: distant_lua-win64.dll
LINUX64_GNU: linux64-gnu
LINUX64_GNU_BIN: distant-linux64-gnu
LINUX64_GNU_LIB: distant_lua-linux64-gnu.so
LINUX64_MUSL: linux64-musl
LINUX64_MUSL_BIN: distant-linux64-musl
LINUX64_MUSL_LIB: distant_lua-linux64-musl.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_X86_LIB }} > ${{ env.MACOS_X86_LIB }}.sha256sum
echo "SHA_MACOS_X86_LUA_LIB=$(cat ${{ env.MACOS_X86_LIB }}.sha256sum)" >> $GITHUB_ENV
sha256sum ${{ env.MACOS_ARM_LIB }} > ${{ env.MACOS_ARM_LIB }}.sha256sum
echo "SHA_MACOS_ARM_LUA_LIB=$(cat ${{ env.MACOS_ARM_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 (gnu) SHA256 checksums
run: |
cd ${{ env.LINUX64_GNU }}
sha256sum ${{ env.LINUX64_GNU_LIB }} > ${{ env.LINUX64_GNU_LIB }}.sha256sum
echo "SHA_LINUX64_GNU_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
- name: Generate Linux64 (musl) SHA256 checksums
run: |
cd ${{ env.LINUX64_MUSL }}
sha256sum ${{ env.LINUX64_MUSL_LIB }} > ${{ env.LINUX64_MUSL_LIB }}.sha256sum
echo "SHA_LINUX64_MUSL_LUA_LIB=$(cat ${{ env.LINUX64_MUSL_LIB }}.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
Expand All @@ -302,62 +218,23 @@ jobs:
target_commitish: ${{ github.sha }}
draft: false
prerelease: ${{ steps.check-tag.outputs.match == 'true' }}
# NOTE: MacOS universal and aarch64 Lua libs are withheld due to
# https://github.com/khvzak/mlua/issues/82 and must be
# built and added to each release manually
files: |
${{ env.MACOS }}/${{ env.MACOS_UNIVERSAL_BIN }}
${{ env.MACOS }}/${{ env.MACOS_UNIVERSAL_LIB }}
${{ env.MACOS }}/${{ env.MACOS_X86_LIB }}
${{ env.MACOS }}/${{ env.MACOS_ARM_LIB }}
${{ env.WIN64 }}/${{ env.WIN64_BIN }}
${{ env.WIN64 }}/${{ env.WIN64_LIB }}
${{ env.LINUX64_GNU }}/${{ env.LINUX64_GNU_BIN }}
${{ env.LINUX64_GNU }}/${{ env.LINUX64_GNU_LIB }}
${{ env.LINUX64_MUSL }}/${{ env.LINUX64_MUSL_BIN }}
${{ env.LINUX64_MUSL }}/${{ env.LINUX64_MUSL_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 }}** (or **${{ env.MACOS_X86_LIB }}** or **${{ env.MACOS_ARM_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 }}** (or **${{ env.LINUX64_MUSL_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 ${{ env.LUA_VERSION }}. 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
## Binaries
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_X86_LUA_LIB }}
${{ env.SHA_MACOS_ARM_LUA_LIB }}
${{ env.SHA_MACOS_BIN }}
${{ env.SHA_WIN64_LUA_LIB }}
${{ env.SHA_WIN64_BIN }}
${{ env.SHA_LINUX64_GNU_LUA_LIB }}
${{ env.SHA_LINUX64_MUSL_LUA_LIB }}
${{ env.SHA_LINUX64_GNU_BIN }}
${{ env.SHA_LINUX64_MUSL_BIN }}
```
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
command for distant cli
- Support for JSON communication of ssh auth during launch (cli)
- Add windows and unix metadata files to overall metadata response data
- Watch and unwatch cli commands powered by underlying `Watcher` core
implementation that uses new `RequestData::Watch`, `RequestData::Unwatch`,
and `ResponseData::Changed` data types to communicate filesystem changes

### Changed
- Default session type for CLI (launch, action, etc) is `environment`
Expand All @@ -29,6 +32,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed
- Github actions no longer use paths-filter so every PR & commit will test
everything
- `distant-lua` and `distant-lua-test` no longer exist as we are focusing
solely on the JSON API for integration into distant

## [0.15.1] - 2021-11-15
### Added
Expand Down
Loading

0 comments on commit 268ec94

Please sign in to comment.