Repository navigation
93 lines (87 loc) · 3.64 KB
/
Copy pathci.yml
File metadata and controls
93 lines (87 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: CI
# 0.6 - CI dla self-hostujacego sie HackerScript (hackerc + hack3rc napisane w .hcs).
# Stary job Pythonowy (`pytest hackerc/tests`) i job `virus-build` zostaly usuniete:
# `virus` zastapil `bit`, a `hackerc` nie jest juz projektem Pythonowym.
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
hackerc-tests:
name: hackerc - build (stage0) + testy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: "/tmp/hackerc-crate"
- name: Pobierz stage0 (hackerc z poprzedniego wydania)
run: |
STAGE0="$(grep -E '^\s*->\s*using\s*=>' Bit.hk | head -n1 | sed -E 's/.*=>\s*0\.([0-9]+).*/\1/')"
STAGE0="0.$((STAGE0 - 1))"
echo "stage0 = $STAGE0"
curl -fsSL -o stage0-hackerc \
"https://github.com/HackerOS-Linux-System/HackerScript/releases/download/v${STAGE0}/hackerc"
chmod +x stage0-hackerc
- name: stage0 transpiluje hackerc/cmd/main.hcs
run: ./stage0-hackerc build hackerc/cmd/main.hcs -o /tmp/hackerc-crate
- name: cargo build --release (hackerc)
working-directory: /tmp/hackerc-crate
run: cargo build --release
- name: Testy (tests/run.sh) swiezo zbudowanym hackerc
env:
HACKERC: /tmp/hackerc-crate/target/release/hackerscript_app
run: bash tests/run.sh
- name: Samohostowanie - swiezy hackerc transpiluje sam siebie (musi dac identyczny wynik)
env:
HACKERC: /tmp/hackerc-crate/target/release/hackerscript_app
run: |
"$HACKERC" build hackerc/cmd/main.hcs -o /tmp/hackerc-gen2
diff -rq /tmp/hackerc-crate/src /tmp/hackerc-gen2/src
hack3rc-build:
name: hack3rc (AOT) - transpilacja i kompilacja
runs-on: ubuntu-latest
needs: hackerc-tests
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Pobierz stage0 jako hackerc
run: |
STAGE0="$(grep -E '^\s*->\s*using\s*=>' Bit.hk | head -n1 | sed -E 's/.*=>\s*0\.([0-9]+).*/\1/')"
curl -fsSL -o stage0-hackerc "https://github.com/HackerOS-Linux-System/HackerScript/releases/download/v0.$((STAGE0 - 1))/hackerc"
chmod +x stage0-hackerc
- name: transpilacja + cargo build hack3rc
run: |
./stage0-hackerc build hack3rc/cmd/main.hcs -o /tmp/hack3rc-crate --crate-name hack3rc
cd /tmp/hack3rc-crate && cargo build --release
- name: Testy hack3rc
run: bash hack3rc/tests/run.sh /tmp/hack3rc-crate/target/release/hack3rc
os-targets:
name: "use <os:...> - cargo check dla celow (${{ matrix.target }})"
runs-on: ubuntu-latest
needs: hackerc-tests
continue-on-error: true
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-pc-windows-gnu
- aarch64-linux-android
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Pobierz stage0
run: |
STAGE0="$(grep -E '^\s*->\s*using\s*=>' Bit.hk | head -n1 | sed -E 's/.*=>\s*0\.([0-9]+).*/\1/')"
curl -fsSL -o stage0-hackerc "https://github.com/HackerOS-Linux-System/HackerScript/releases/download/v0.$((STAGE0 - 1))/hackerc"
chmod +x stage0-hackerc
- name: transpilacja docs/hello-world i cargo check --target
run: |
./stage0-hackerc build docs/hello-world/cmd/main.hcs -o /tmp/hw-out
cd /tmp/hw-out && cargo check --target ${{ matrix.target }}