Skip to content

Commit e261e4d

Browse files
committed
feat(commands): ci
1 parent c59cdbf commit e261e4d

File tree

2 files changed

+210
-0
lines changed

2 files changed

+210
-0
lines changed

Diff for: .forgejo/workflows/build.yaml

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# TODO: until the ci works better
2+
#on: [push]
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
CARGO_HOME: /workspace/nehu/helix/cargo-home
8+
RUSTUP_HOME: /workspace/nehu/helix/rustup-home
9+
#CROSS_CONTAINER_IN_CONTAINER: true
10+
CROSS_CONTAINER_ENGINE: podman
11+
HELIX_DEFAULT_RUNTIME: /usr/lib/helix/runtime
12+
13+
jobs:
14+
build:
15+
strategy:
16+
matrix:
17+
target:
18+
- id: x86_64-unknown-linux-gnu
19+
name: amd64-linux
20+
# TODO: doesn't work well yet
21+
#- id: x86_64-apple-darwin
22+
# name: amd64-macos
23+
- id: aarch64-unknown-linux-gnu
24+
name: arm64-linux
25+
- id: aarch64-unknown-linux-musl
26+
name: arm64-linux-musl
27+
- id: arm-unknown-linux-musleabihf
28+
name: armv6-linux-musl
29+
max-parallel: 2
30+
runs-on: linux-x86_64
31+
container:
32+
image: rust
33+
#image: rust:alpine3.19
34+
steps:
35+
# Required by 3rd-party actions
36+
# `musl-dev` required to avoid the crti.o error (https://github.com/rust-lang/rust/issues/40174)
37+
- run: "apt update && apt install -y podman git nodejs tree"
38+
- run: mkdir -pv ~/.rustup ~/.cargo
39+
- uses: "actions/checkout@v3"
40+
- name: "Restore rustup cache"
41+
id: "cache-rustup-restore"
42+
uses: "actions/cache/restore@v4"
43+
with:
44+
path: |
45+
rustup-home
46+
key: "helix-rustup-${{ matrix.target.id }}"
47+
- name: "Restore cargo cache"
48+
id: "cache-cargo-restore"
49+
uses: "actions/cache/restore@v4"
50+
with:
51+
path: |
52+
cargo-home
53+
key: "helix-cargo-${{ matrix.target.id }}"
54+
- name: "Restore artifacts cache"
55+
id: "cache-artifacts-restore"
56+
uses: "actions/cache/restore@v4"
57+
with:
58+
path: |
59+
target
60+
key: "helix-artifacts-${{ matrix.target.id }}"
61+
- name: "Install binstall"
62+
uses: "https://github.com/cargo-bins/[email protected]"
63+
- name: "Install cross"
64+
run: "cargo binstall -y cross"
65+
#- name: "Install target: ${{ matrix.target.id }}"
66+
# if: ${{ matrix.target.id == 'x86_64-apple-darwin' }}
67+
# run: "rustup target add ${{ matrix.target.id }}"
68+
- name: "Configure cross: ${{ matrix.target.id }}"
69+
if: ${{ matrix.target.id == 'x86_64-apple-darwin' }}
70+
run: |
71+
echo "[target.${{ matrix.target.id }}]" >> Cross.toml
72+
echo 'image = "ghcr.io/mrpixel1/x86_64-apple-darwin-cross:latest"' >> Cross.toml
73+
- name: "Build"
74+
run: $CARGO_HOME/bin/cross build --profile opt --target ${{ matrix.target.id }}
75+
- name: "Save artifacts cache"
76+
id: "cache-artifacts-save"
77+
uses: "actions/cache/save@v4"
78+
with:
79+
path: |
80+
target
81+
key: "${{ steps.cache-artifacts-restore.outputs.cache-primary-key }}"
82+
- name: "Save cargo cache"
83+
if: "always()"
84+
id: "cache-cargo-save"
85+
uses: "actions/cache/save@v4"
86+
with:
87+
path: |
88+
cargo-home
89+
key: "${{ steps.cache-cargo-restore.outputs.cache-primary-key }}"
90+
- name: "Save rustup cache"
91+
if: "always()"
92+
id: "cache-rustup-save"
93+
uses: "actions/cache/save@v4"
94+
with:
95+
path: |
96+
rustup-home
97+
key: "${{ steps.cache-rustup-restore.outputs.cache-primary-key }}"
98+
- name: "Prepare dist"
99+
run: |
100+
mkdir -pv dist/helix
101+
mv -v target/${{ matrix.target.id }}/opt/hx dist/helix/
102+
rm -rf runtime/grammars/sources
103+
mv -v runtime dist/helix/
104+
cd dist && tar -cvzf helix-${{ matrix.target.name }}.tar.gz helix
105+
- name: "Upload artifacts"
106+
# Temporary solution until https://code.forgejo.org/actions/upload-artifact works
107+
#uses: "https://code.forgejo.org/forgejo/upload-artifact@v4"
108+
uses: "https://code.forgejo.org/forgejo/upload-artifact@v3"
109+
with:
110+
name: helix-${{ matrix.target.name }}
111+
path: dist/helix-${{ matrix.target.name }}.tar

Diff for: .github/workflows/evil-build.yml

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Build
2+
on:
3+
push:
4+
branches:
5+
- feat-evil-base
6+
workflow_dispatch:
7+
8+
permissions: write-all
9+
10+
env:
11+
RUST_BACKTRACE: 1
12+
HELIX_LOG_LEVEL: info
13+
14+
jobs:
15+
16+
build:
17+
18+
strategy:
19+
matrix:
20+
target:
21+
- id: x86_64-unknown-linux-gnu
22+
name: amd64-linux
23+
native: true
24+
os: ubuntu-latest
25+
- id: aarch64-unknown-linux-gnu
26+
name: arm64-linux
27+
native: false
28+
os: ubuntu-latest
29+
- id: aarch64-unknown-linux-musl
30+
name: arm64-linux-musl
31+
native: false
32+
os: ubuntu-latest
33+
- id: arm-unknown-linux-musleabihf
34+
name: armv6-linux-musl
35+
native: false
36+
os: ubuntu-latest
37+
- id: x86_64-apple-darwin
38+
name: amd64-macos
39+
native: true
40+
os: macos-latest
41+
#os: [ubuntu-latest, macos-latest] #, windows-latest]
42+
43+
runs-on: ${{ matrix.target.os }}
44+
45+
steps:
46+
- name: Checkout sources
47+
uses: actions/checkout@v4
48+
49+
- name: Install stable toolchain
50+
uses: dtolnay/[email protected]
51+
with:
52+
targets: ${{ matrix.target.id }}
53+
54+
- name: Install binstall
55+
uses: "cargo-bins/[email protected]"
56+
if: ${{ !matrix.target.native}}
57+
58+
- name: "Install cross"
59+
run: "cargo binstall -y cross"
60+
if: ${{ !matrix.target.native}}
61+
62+
- uses: Swatinem/rust-cache@v2
63+
with:
64+
shared-key: "build"
65+
66+
- name: Build
67+
run: cargo build --target ${{ matrix.target.id }} --profile opt
68+
if: ${{ matrix.target.native}}
69+
70+
- name: Build (cross)
71+
run: cross build --target ${{ matrix.target.id }} --profile opt
72+
if: ${{ !matrix.target.native}}
73+
74+
- name: "Prepare dist"
75+
run: |
76+
mkdir -pv dist/helix
77+
#mv -v target/opt/hx dist/helix/
78+
mv -v target/${{ matrix.target.id }}/opt/hx dist/helix/
79+
rm -rf runtime/grammars/sources
80+
mv -v runtime dist/helix/
81+
#cd dist && tar -cvzf helix-${ { matrix.os }}.tar.gz helix
82+
cd dist && tar -cvzf helix-${{ matrix.target.name }}.tar.gz helix
83+
84+
- name: "Upload artifacts"
85+
uses: actions/upload-artifact@v4
86+
with:
87+
#name: helix-${ { matrix.os }}
88+
#path: dist/helix-${ { matrix.os }}.tar.gz
89+
name: helix-${{ matrix.target.name }}
90+
path: dist/helix-${{ matrix.target.name }}.tar.gz
91+
92+
- name: Rolling release
93+
uses: svenstaro/upload-release-action@v2
94+
with:
95+
repo_token: ${{ secrets.GITHUB_TOKEN }}
96+
file: dist/*
97+
file_glob: true
98+
tag: ${{ github.ref_name }}
99+
overwrite: true

0 commit comments

Comments
 (0)