Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 13654f9
Author: usagi-flow <[email protected]>
Date:   Sat May 18 00:03:44 2024 +0200

    feat(ci): pr test/build workflow

commit 80f3586
Author: usagi-flow <[email protected]>
Date:   Sat May 18 00:03:44 2024 +0200

    fix(ci): x86_64 macos build

commit 26d458b
Author: usagi-flow <[email protected]>
Date:   Thu Apr 25 20:44:51 2024 +0200

    fix(ci): build and create a release when a release tag is pushed

commit b89d1e3
Author: usagi-flow <[email protected]>
Date:   Thu Apr 25 20:44:51 2024 +0200

    fix(ci): mac builds

commit 4fee940
Author: usagi-flow <[email protected]>
Date:   Thu Apr 25 20:44:51 2024 +0200

    feat(commands): ci
  • Loading branch information
usagi-flow committed May 18, 2024
1 parent 28f8027 commit 59e04d5
Show file tree
Hide file tree
Showing 3 changed files with 282 additions and 0 deletions.
111 changes: 111 additions & 0 deletions .forgejo/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# TODO: until the ci works better
#on: [push]
on:
workflow_dispatch:

env:
CARGO_HOME: /workspace/nehu/helix/cargo-home
RUSTUP_HOME: /workspace/nehu/helix/rustup-home
#CROSS_CONTAINER_IN_CONTAINER: true
CROSS_CONTAINER_ENGINE: podman
HELIX_DEFAULT_RUNTIME: /usr/lib/helix/runtime

jobs:
build:
strategy:
matrix:
target:
- id: x86_64-unknown-linux-gnu
name: amd64-linux
# TODO: doesn't work well yet
#- id: x86_64-apple-darwin
# name: amd64-macos
- id: aarch64-unknown-linux-gnu
name: arm64-linux
- id: aarch64-unknown-linux-musl
name: arm64-linux-musl
- id: arm-unknown-linux-musleabihf
name: armv6-linux-musl
max-parallel: 2
runs-on: linux-x86_64
container:
image: rust
#image: rust:alpine3.19
steps:
# Required by 3rd-party actions
# `musl-dev` required to avoid the crti.o error (https://github.com/rust-lang/rust/issues/40174)
- run: "apt update && apt install -y podman git nodejs tree"
- run: mkdir -pv ~/.rustup ~/.cargo
- uses: "actions/checkout@v3"
- name: "Restore rustup cache"
id: "cache-rustup-restore"
uses: "actions/cache/restore@v4"
with:
path: |
rustup-home
key: "helix-rustup-${{ matrix.target.id }}"
- name: "Restore cargo cache"
id: "cache-cargo-restore"
uses: "actions/cache/restore@v4"
with:
path: |
cargo-home
key: "helix-cargo-${{ matrix.target.id }}"
- name: "Restore artifacts cache"
id: "cache-artifacts-restore"
uses: "actions/cache/restore@v4"
with:
path: |
target
key: "helix-artifacts-${{ matrix.target.id }}"
- name: "Install binstall"
uses: "https://github.com/cargo-bins/[email protected]"
- name: "Install cross"
run: "cargo binstall -y cross"
#- name: "Install target: ${{ matrix.target.id }}"
# if: ${{ matrix.target.id == 'x86_64-apple-darwin' }}
# run: "rustup target add ${{ matrix.target.id }}"
- name: "Configure cross: ${{ matrix.target.id }}"
if: ${{ matrix.target.id == 'x86_64-apple-darwin' }}
run: |
echo "[target.${{ matrix.target.id }}]" >> Cross.toml
echo 'image = "ghcr.io/mrpixel1/x86_64-apple-darwin-cross:latest"' >> Cross.toml
- name: "Build"
run: $CARGO_HOME/bin/cross build --profile opt --target ${{ matrix.target.id }}
- name: "Save artifacts cache"
id: "cache-artifacts-save"
uses: "actions/cache/save@v4"
with:
path: |
target
key: "${{ steps.cache-artifacts-restore.outputs.cache-primary-key }}"
- name: "Save cargo cache"
if: "always()"
id: "cache-cargo-save"
uses: "actions/cache/save@v4"
with:
path: |
cargo-home
key: "${{ steps.cache-cargo-restore.outputs.cache-primary-key }}"
- name: "Save rustup cache"
if: "always()"
id: "cache-rustup-save"
uses: "actions/cache/save@v4"
with:
path: |
rustup-home
key: "${{ steps.cache-rustup-restore.outputs.cache-primary-key }}"
- name: "Prepare dist"
run: |
mkdir -pv dist/helix
mv -v target/${{ matrix.target.id }}/opt/hx dist/helix/
rm -rf runtime/grammars/sources
mv -v runtime dist/helix/
cd dist && tar -cvzf helix-${{ matrix.target.name }}.tar.gz helix
- name: "Upload artifacts"
# Temporary solution until https://code.forgejo.org/actions/upload-artifact works
#uses: "https://code.forgejo.org/forgejo/upload-artifact@v4"
uses: "https://code.forgejo.org/forgejo/upload-artifact@v3"
with:
name: helix-${{ matrix.target.name }}
path: dist/helix-${{ matrix.target.name }}.tar
62 changes: 62 additions & 0 deletions .github/workflows/evil-build-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
on:
pull_request:
workflow_dispatch:

permissions: write-all

env:
RUST_BACKTRACE: 1
HELIX_LOG_LEVEL: info
HELIX_DEFAULT_RUNTIME: /opt/helix/runtime

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

build:

strategy:
fail-fast: false
matrix:
target:
- id: x86_64-unknown-linux-gnu
name: amd64-linux
native: true
os: ubuntu-latest

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

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install stable toolchain
uses: dtolnay/[email protected]
with:
targets: ${{ matrix.target.id }}

- uses: Swatinem/rust-cache@v2
with:
shared-key: "build"

- name: Test
run: cargo test

- name: Build
run: cargo build --release

- name: "Prepare dist"
run: |
mkdir -pv dist/helix
mv -v target/${{ matrix.target.id }}/opt/hx dist/helix/
rm -rf runtime/grammars/sources
mv -v runtime dist/helix/
cd dist && tar -cvzf helix-${{ matrix.target.name }}.tar.gz helix
- name: "Upload artifacts"
uses: actions/upload-artifact@v4
with:
name: helix-${{ matrix.target.name }}
path: dist/helix-${{ matrix.target.name }}.tar.gz
109 changes: 109 additions & 0 deletions .github/workflows/evil-build-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
on:
push:
tags:
- "release-*"

permissions: write-all

env:
RUST_BACKTRACE: 1
HELIX_LOG_LEVEL: info
HELIX_DEFAULT_RUNTIME: /opt/helix/runtime

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

build:

strategy:
fail-fast: false
matrix:
target:
- id: x86_64-unknown-linux-gnu
name: amd64-linux
native: true
os: ubuntu-latest
- id: aarch64-unknown-linux-gnu
name: aarch64-linux
native: false
os: ubuntu-latest
- id: aarch64-unknown-linux-musl
name: aarch64-linux-musl
native: false
os: ubuntu-latest
- id: arm-unknown-linux-musleabihf
name: armv6-linux-musl
native: false
os: ubuntu-latest
- id: x86_64-apple-darwin
name: amd64-macos
native: true
os: macos-latest
- id: aarch64-apple-darwin
name: aarch64-macos
native: true
os: macos-latest

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

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install stable toolchain
uses: dtolnay/[email protected]
with:
targets: ${{ matrix.target.id }}

- name: Install binstall
uses: "cargo-bins/[email protected]"
if: ${{ !matrix.target.native}}

- name: "Install cross"
run: "cargo binstall -y cross"
if: ${{ !matrix.target.native}}

- uses: Swatinem/rust-cache@v2
with:
shared-key: "build"

- name: Build
run: |
rustup target add ${{ matrix.target.id }}
cargo build --target ${{ matrix.target.id }} --profile opt
if: ${{ matrix.target.native}}

- name: Build (cross)
run: cross build --target ${{ matrix.target.id }} --profile opt
if: ${{ !matrix.target.native}}

- name: "Prepare dist"
run: |
mkdir -pv dist/helix
mv -v target/${{ matrix.target.id }}/opt/hx dist/helix/
rm -rf runtime/grammars/sources
mv -v runtime dist/helix/
cd dist && tar -cvzf helix-${{ matrix.target.name }}.tar.gz helix
- name: "Upload artifacts"
uses: actions/upload-artifact@v4
with:
name: helix-${{ matrix.target.name }}
path: dist/helix-${{ matrix.target.name }}.tar.gz

- name: Release suffix
id: release-suffix
run: echo "::set-output name=suffix::$(date +'%Y%m%d')"

- name: Create release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*
file_glob: true
tag: ${{ github.ref }}
release_name: evil-helix-${{steps.release-suffix.outputs.suffix}}
overwrite: true

0 comments on commit 59e04d5

Please sign in to comment.