* xtask: Implement a new build system xtask is a cargo alias that is used to extend the cargo build system with custom commands. For an introduction to xtask, see here: https://github.com/matklad/cargo-xtask/ The idea is that instead of writing makefiles, xtask requires no additional dependencies except `cargo` and `rustc`, which must be available to build the project anyway. This commit provides a basic implementation of the `build` and `test` subcommands. * xtask/deps: Add 'which' * xtask/test: Handle error when cargo not found * xtask/flags: Add more commands to perform different useful tasks. Includes: - clippy - format - "make" (composite) - "install" (composite) Also add more options to `build` to selectively compile plugins or leave them out entirely. * xtask/main: Return error when cargo not found * xtask/build: Add more subtasks - `wasm_opt_plugins` and - `manpage` that perform other build commands. Add thorough documentation on what each of these does and also handle the new `build` cli flags appropriately. * xtask/clippy: Add job to run clippy * xtask/format: Add job to run rustfmt * xtask/pipeline: Add composite commands that perform multiple atomic xtask commands sequentially in a pipeline sort of fashion. * xtask/deps: Pin dependencies * xtask/main: Integrate new jobs and add documentation. * xtask: Implement 'dist' which performs an 'install' and copies the resulting zellij binary along with some other assets to a `target/dist` folder. * cargo: Update xflags version * xtask: Measure task time, update tty title * xtask: Update various tasks * xtask: wasm-opt plugins in release builds automatically. * xtask/build: Copy debug plugins to assets folder * xtask: Add 'run' subcommand * xtask: Add arbitrary args to test and run * xtask: Rearrange CLI commands in help * xtask: Add deprecation notice * docs: Replace `cargo make` with `xtask` * github: Use `xtask` in workflows. * xtask: Add support for CI commands * xtask: Streamline error handling * github: Use new xtask commands in CI * xtask: Add 'publish' job * xtask/publish: Add retry when publish fails * xtask: Apply rustfmt * xtask: Refine 'make' deprecation warning * xtask: add task to build manpage * contributing: Fix e2e commands * xtask/run: Add missing `--` to pass all arguments following `xtask run` directly to the zellij binary being run. * xtask: Stay in invocation dir and make all tasks that need it change to the project root dir themselves. * xtask/run: Add `--data-dir` flag which will allow very quick iterations when not changing the plugins between builds. * xtask/ci: Install dependencies without asking * utils: Allow including plugins from target folder * utils/assets: Reduce asset map complexity * utils/consts: Update asset map docs * xtask: Fix plugin includes * xtask/test: Build plugins first because the zellij binary needs to include the plugins. * xtask/test: Fix formatting * xtask: Add notice on how to disable it
145 lines
4.7 KiB
YAML
145 lines
4.7 KiB
YAML
name: Release
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*.*.*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-release:
|
|
needs: create-release
|
|
name: build-release
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
RUST_BACKTRACE: 1
|
|
strategy:
|
|
matrix:
|
|
build:
|
|
- linux musl x64
|
|
- linux musl aarch64
|
|
- macos x64
|
|
- macos aarch64
|
|
include:
|
|
- build: linux musl x64
|
|
os: ubuntu-latest
|
|
rust: stable
|
|
target: x86_64-unknown-linux-musl
|
|
- build: linux musl aarch64
|
|
os: ubuntu-latest
|
|
rust: stable
|
|
target: aarch64-unknown-linux-musl
|
|
- build: macos x64
|
|
os: macos-latest
|
|
rust: stable
|
|
target: x86_64-apple-darwin
|
|
- build: macos aarch64
|
|
os: macos-latest
|
|
rust: stable
|
|
target: aarch64-apple-darwin
|
|
steps:
|
|
- name: Set release tag
|
|
run: |
|
|
if [ "$GITHUB_EVENT_NAME" == 'workflow_dispatch' ]; then
|
|
echo "RELEASE_TAG=main" >> "$GITHUB_ENV"
|
|
else
|
|
echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> "$GITHUB_ENV"
|
|
fi
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
profile: minimal
|
|
override: true
|
|
target: ${{ matrix.target }}
|
|
|
|
- name: Add WASM target
|
|
run: rustup target add wasm32-wasi
|
|
|
|
- name: Install musl-tools
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: sudo apt-get install -y --no-install-recommends musl-tools
|
|
|
|
- name: Install wasm-opt (macos)
|
|
if: runner.os == 'macos'
|
|
run: brew install binaryen
|
|
|
|
- name: Install wasm-opt (ubuntu)
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: sudo apt-get install -y --no-install-recommends binaryen
|
|
|
|
# Workaround for <https://github.com/actions/virtual-environments/issues/2557>
|
|
- name: Switch Xcode SDK
|
|
if: runner.os == 'macos'
|
|
run: |
|
|
cat <<EOF >> "$GITHUB_ENV"
|
|
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
|
|
EOF
|
|
|
|
- name: Build release binary
|
|
run: cargo xtask ci cross ${{ matrix.target }}
|
|
|
|
# this breaks on aarch64 and this if conditional isn't working for some reason: TODO: investigate
|
|
#- name: Strip release binary
|
|
# if: runner.target != 'aarch64-unknown-linux-musl' && runner.target != 'aarch64-apple-darwin'
|
|
# run: strip "target/${{ matrix.target }}/release/zellij"
|
|
|
|
- name: Create checksum
|
|
id: make-checksum
|
|
working-directory: ./target/${{ matrix.target }}/release
|
|
run: |
|
|
name="zellij-${{ matrix.target }}.sha256sum"
|
|
if [[ "$RUNNER_OS" != "macOS" ]]; then
|
|
sha256sum "zellij" > "${name}"
|
|
else
|
|
shasum -a 256 "zellij" > "${name}"
|
|
fi
|
|
echo "::set-output name=name::${name}"
|
|
|
|
- name: Tar release
|
|
id: make-artifact
|
|
working-directory: ./target/${{ matrix.target }}/release
|
|
run: |
|
|
name="zellij-${{ matrix.target }}.tar.gz"
|
|
tar cvzf "${name}" "zellij"
|
|
echo "::set-output name=name::${name}"
|
|
|
|
- name: Upload release archive
|
|
uses: actions/upload-release-asset@v1.0.2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
|
asset_path: ./target/${{ matrix.target }}/release/${{ steps.make-artifact.outputs.name }}
|
|
asset_name: zellij-${{matrix.target}}.tar.gz
|
|
asset_content_type: application/octet-stream
|
|
|
|
- name: Upload checksum
|
|
uses: actions/upload-release-asset@v1.0.2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
|
asset_path: ./target/${{ matrix.target }}/release/${{ steps.make-checksum.outputs.name }}
|
|
asset_name: zellij-${{matrix.target}}.sha256sum
|
|
asset_content_type: text/plain
|
|
|
|
create-release:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
steps:
|
|
- name: create_release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.event_name == 'workflow_dispatch' && '' || github.ref }}
|
|
release_name: Release ${{ github.event_name == 'workflow_dispatch' && 'main' || github.ref }}
|
|
draft: ${{ github.event_name == 'workflow_dispatch' }}
|
|
prerelease: false
|
|
|