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
29 changes: 29 additions & 0 deletions .github/actions/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
NAME=hell

# Set an output prefix, which is the local directory if not specified
PREFIX=$(pwd)

# Set the build dir, where built cross-compiled binaries will be output
BUILDDIR=${PREFIX}/cross

# These are chosen from: https://doc.rust-lang.org/nightly/rustc/platform-support.html
if [[ $(uname) = "Darwin" ]]; then
CROSS_TARGETS=("x86_64-apple-darwin" "aarch64-apple-darwin")
else
CROSS_TARGETS=("x86_64-pc-windows-gnu" "x86_64-unknown-linux-musl" "aarch64-unknown-linux-musl")
fi

mkdir -p "$BUILDDIR"

compile() {
rustup target add $1
cargo build --release --target $1 || cross build --release --target $1
mv "./target/$1/release/$NAME" "$BUILDDIR/$NAME-$1" || mv "./target/$1/release/$NAME.exe" "$BUILDDIR/$NAME-$1"
md5sum "$BUILDDIR/$NAME-$1" > "$BUILDDIR/$NAME-$1.md5"
sha256sum "$BUILDDIR/$NAME-$1" > "$BUILDDIR/$NAME-$1.sha256"
}

for target in "${CROSS_TARGETS[@]}"
do
compile $target
done
41 changes: 41 additions & 0 deletions .github/actions/cross-compile/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: TK
description: TK

inputs:
os:
description: OS; either macos or ubuntu

runs:
using: "composite"
steps:
- name: Install latest nightly
uses: dtolnay/rust-toolchain@stable
- if: ${{ matrix.os == 'ubuntu' }}
name: Install Linux dependencies
shell: bash
run: ./.github/actions/install-cross-dependencies.sh
- if: ${{ matrix.os == 'macos' }}
name: Install macOS dependencies
shell: bash
run: brew install coreutils
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Run make cross
run: |
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
./.github/actions/compile.sh
ls -la cross
shell: bash
29 changes: 29 additions & 0 deletions .github/actions/install-cross-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -e
set -o pipefail

# Install our deps.
sudo apt update -y && sudo apt install -y \
ca-certificates \
clang \
cmake \
curl \
g++ \
gcc \
gcc-mingw-w64-i686 \
gcc-mingw-w64 \
jq \
libmpc-dev \
libmpfr-dev \
libgmp-dev \
libssl-dev \
libxml2-dev \
mingw-w64 \
wget \
zlib1g-dev

# We need this for the version.
cargo install toml-cli

# Install cross.
cargo install cross
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
name: release
jobs:
compile:
strategy:
matrix:
os: [macos, ubuntu]
name: releases for ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-compile
with:
os: ${{ matrix.os }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.os }}-${{ github.ref_name }}
path: ./cross
release:
runs-on: ubuntu-latest
needs:
- compile
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: release-macos-${{ github.ref_name }}
path: build
- uses: actions/download-artifact@v4
with:
name: release-ubuntu-${{ github.ref_name }}
path: build
- name: Create a Release
uses: softprops/action-gh-release@v2
with:
files: ./build/*
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
push:
branches:
- main
paths:
- "**.rs"
- Cargo.toml
- Cargo.lock
- .github/workflows/cross-compile.yml
- rust-toolchain.toml
pull_request:
paths:
- "**.rs"
- Cargo.toml
- Cargo.lock
- .github/workflows/cross-compile.yml
- rust-toolchain.toml
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
name: test
jobs:
compile:
strategy:
matrix:
os: [macos, ubuntu]
name: compile
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-compile
with:
os: ${{ matrix.os }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

/Hellfile.py
/Pipfile*

/cross
/.vscode
93 changes: 0 additions & 93 deletions .travis.yml

This file was deleted.

32 changes: 0 additions & 32 deletions ci/before_deploy.sh

This file was deleted.

27 changes: 0 additions & 27 deletions ci/install.sh

This file was deleted.

23 changes: 0 additions & 23 deletions ci/script.sh

This file was deleted.

4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ fn handle_init<'a>(environment: Environment) -> Result<i32, String> {
eprintln!("init will now happen");

create_pipfile()
.and_then({ |_| install_package(&environment.hellbox_package) })
.and_then({ |_| create_manifest(&environment.manifest_filename) })
.and_then(|_| install_package(&environment.hellbox_package))
.and_then(|_| create_manifest(&environment.manifest_filename))
}

fn handle_install<'a>(_environment: Environment) -> Result<i32, String> {
Expand Down
Loading