Skip to content

Commit

Permalink
custom
Browse files Browse the repository at this point in the history
  • Loading branch information
waltarix committed Apr 12, 2023
1 parent 21c4c74 commit 4c34dcc
Show file tree
Hide file tree
Showing 13 changed files with 219 additions and 434 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/ci.yml

This file was deleted.

109 changes: 0 additions & 109 deletions .github/workflows/publish.yml

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Release

on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+-custom
- v[0-9]+.[0-9]+.[0-9]+-custom-r[0-9]+

permissions:
contents: write

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-22.04
rust-target: x86_64-unknown-linux-musl
- os: macos-12
rust-target: x86_64-apple-darwin
- os: macos-12
rust-target: aarch64-apple-darwin
env:
xcode_version: 14.2
macosx_sdk: macosx13.1

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set RUST_TARGET
run: echo 'RUST_TARGET=${{ matrix.rust-target }}' >> $GITHUB_ENV

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

- name: Setup musl for Linux
if: matrix.os == 'ubuntu-22.04'
run: sudo apt-get -y -qq install musl-tools

- name: Setup Xcode for macOS
if: matrix.os == 'macos-12'
run: sudo xcode-select -s '/Applications/Xcode_${{ env.xcode_version }}.app'

- name: Set environment variables for Apple Silicon
if: matrix.rust-target == 'aarch64-apple-darwin'
run: |
export SDKROOT=$(xcrun -sdk ${{ env.macosx_sdk }} --show-sdk-path)
[[ -n $SDKROOT ]] && echo "SDKROOT=$SDKROOT" >> $GITHUB_ENV
export MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk ${{ env.macosx_sdk }} --show-sdk-platform-version)
[[ -n $MACOSX_DEPLOYMENT_TARGET ]] && echo "MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET" >> $GITHUB_ENV
- name: Build
run: make

- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: "*.tar.xz"
allowUpdates: true
116 changes: 0 additions & 116 deletions .github/workflows/test.yml

This file was deleted.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,9 @@ thiserror = "1.0.40"
indoc = "2.0.0"
strip-ansi-escapes = "0.1.1"
tempfile = "3.4.0"

[profile.release]
codegen-units = 1
lto = true
strip = true
opt-level = 3
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
ifeq ($(RUST_TARGET),)
TARGET :=
RELEASE_SUFFIX :=
else
TARGET := $(RUST_TARGET)
RELEASE_SUFFIX := -$(TARGET)
export CARGO_BUILD_TARGET = $(RUST_TARGET)
endif

PROJECT_NAME := et

_HASH := \#
VERSION := $(lastword $(subst @, ,$(subst $(_HASH), ,$(shell cargo pkgid))))
RELEASE := $(PROJECT_NAME)-$(VERSION)$(RELEASE_SUFFIX)

DIST_DIR := dist
RELEASE_DIR := $(DIST_DIR)/$(RELEASE)

BINARY := target/$(TARGET)/release/$(PROJECT_NAME)

RELEASE_BINARY := $(RELEASE_DIR)/$(PROJECT_NAME)

ARTIFACT := $(RELEASE).tar.xz

.PHONY: all
all: $(ARTIFACT)

$(BINARY):
cargo build --locked --release

$(DIST_DIR) $(RELEASE_DIR):
mkdir -p $@

$(RELEASE_BINARY): $(BINARY) $(RELEASE_DIR)
cp -f $< $@

$(ARTIFACT): $(RELEASE_BINARY)
tar -C $(DIST_DIR) -Jcvf $@ $(RELEASE)

.PHONY: clean
clean:
$(RM) -rf $(ARTIFACT) $(DIST_DIR)
Loading

0 comments on commit 4c34dcc

Please sign in to comment.