Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master

defaults:
run:
shell: bash

env:
RUSTFLAGS: --deny warnings

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt

- uses: Swatinem/rust-cache@v2

- name: Clippy
run: cargo clippy --all --all-targets

- name: Format
run: cargo fmt --all -- --check

test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- name: Test
run: cargo test --all
82 changes: 82 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Release

on:
push:
tags:
- '*'

defaults:
run:
shell: bash

jobs:
release:
strategy:
fail-fast: false
matrix:
target:
- aarch64-apple-darwin
- aarch64-unknown-linux-gnu
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
- x86_64-unknown-linux-gnu
include:
- target: aarch64-apple-darwin
os: macos-latest
target_rustflags: ''
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
target_rustflags: '--codegen linker=aarch64-linux-gnu-gcc'
- target: x86_64-apple-darwin
os: macos-latest
target_rustflags: ''
- target: x86_64-pc-windows-msvc
os: windows-latest
target_rustflags: ''
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
target_rustflags: ''

runs-on: ${{matrix.os}}
permissions:
contents: write

steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Install AArch64 Cross-Compilation Toolchain
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu

- name: Release Type
id: release-type
run: |
if [[ ${{ github.ref }} =~ ^refs/tags/[0-9]+[.][0-9]+[.][0-9]+$ ]]; then
echo "value=release" >> $GITHUB_OUTPUT
else
echo "value=prerelease" >> $GITHUB_OUTPUT
fi

- name: Package
id: package
env:
TARGET: ${{ matrix.target }}
REF: ${{ github.ref }}
OS: ${{ matrix.os }}
TARGET_RUSTFLAGS: ${{ matrix.target_rustflags }}
run: ./bin/package
shell: bash

- name: Publish Archive
uses: softprops/action-gh-release@v2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
draft: false
files: ${{ steps.package.outputs.archive }}
prerelease: ${{ steps.release-type.outputs.value == 'prerelease' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1 align=center><code>entangle</code></h1>

<!-- <div align=center>
<div align=center>
<a href=https://crates.io/crates/entangle>
<img src=https://img.shields.io/crates/v/entangle.svg alt="crates.io version">
</a>
Expand All @@ -10,7 +10,7 @@
<a href=https://github.com/parasitepool/entangle/releases>
<img src=https://img.shields.io/github/downloads/parasitepool/entangle/total.svg alt=downloads>
</a>
</div> -->
</div>
<br>

`entangle` is currently in early development check back soon.
44 changes: 44 additions & 0 deletions bin/package
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash

set -euxo pipefail

VERSION=${REF#"refs/tags/"}
DIST=`pwd`/dist

echo "Packaging entangle $VERSION for $TARGET..."

test -f Cargo.lock || cargo generate-lockfile

echo "Building entangle..."
RUSTFLAGS="--deny warnings $TARGET_RUSTFLAGS" \
cargo build --bin entangle --target $TARGET --release
EXECUTABLE=target/$TARGET/release/entangle

if [[ $OS == windows-latest ]]; then
EXECUTABLE=$EXECUTABLE.exe
fi

echo "Copying release files..."
mkdir -p dist/entangle-$VERSION
cp \
$EXECUTABLE \
Cargo.lock \
Cargo.toml \
LICENSE \
README.md \
$DIST/entangle-$VERSION

cd $DIST
echo "Creating release archive..."
case $OS in
ubuntu-latest | macos-latest)
ARCHIVE=$DIST/entangle-$VERSION-$TARGET.tar.gz
tar czf $ARCHIVE *
echo "archive=$ARCHIVE" >> $GITHUB_OUTPUT
;;
windows-latest)
ARCHIVE=$DIST/entangle-$VERSION-$TARGET.zip
7z a $ARCHIVE *
echo "archive=`pwd -W`/entangle-$VERSION-$TARGET.zip" >> $GITHUB_OUTPUT
;;
esac