on master help sign in
Download knot compiler from releases instead of building from source
59acc0eiko
.github/workflows/build.yml+15−37
@@ -5,9 +5,6 @@ on:
5 branches: [master]
5 branches: [master]
6 pull_request:
6 pull_request:
7
7
8−env:
9− CARGO_TERM_COLOR: always
10−
11jobs:
8jobs:
12 build:
9 build:
13 strategy:
10 strategy:
@@ -16,48 +13,29 @@ jobs:
16 include:
13 include:
17 - runner: ubuntu-latest
14 - runner: ubuntu-latest
18 name: linux-x86_64
15 name: linux-x86_64
19− musl-target: x86_64-unknown-linux-musl
16+ knot-platform: linux-x86_64
20 - runner: ubuntu-24.04-arm
17 - runner: ubuntu-24.04-arm
21 name: linux-arm64
18 name: linux-arm64
22− musl-target: aarch64-unknown-linux-musl
19+ knot-platform: linux-aarch64
23 - runner: macos-26
20 - runner: macos-26
24 name: macos-arm64
21 name: macos-arm64
25− - runner: macos-26-intel
22+ knot-platform: macos-aarch64
26− name: macos-x86_64
27 runs-on: ${{ matrix.runner }}
23 runs-on: ${{ matrix.runner }}
28 steps:
24 steps:
29 - uses: actions/checkout@v4
25 - uses: actions/checkout@v4
30
26
31− - uses: actions/checkout@v4
27+ - name: Download knot compiler
32− with:
33− repository: ilyakooo0/knot
34− path: knot
35−
36− - uses: dtolnay/rust-toolchain@stable
37−
38− - name: Install musl toolchain
39− if: runner.os == 'Linux'
40 run: |
28 run: |
41− sudo apt-get update
29+ version=$(basename "$(curl -sI -o /dev/null -w '%{redirect_url}' \
42− sudo apt-get install -y musl-tools
30+ https://github.com/ilyakooo0/knot/releases/latest)")
43− rustup target add ${{ matrix.musl-target }}
31+ tarball="knot-${version}-${{ matrix.knot-platform }}.tar.gz"
44−
32+ curl -fsSL "https://github.com/ilyakooo0/knot/releases/download/${version}/${tarball}" \
45− - uses: actions/cache@v4
33+ | tar xz
46− with:
34+ mv "knot-${version}-${{ matrix.knot-platform }}" knot-dist
47− path: |
48− ~/.cargo/registry
49− ~/.cargo/git
50− knot/target
51− key: ${{ matrix.name }}-cargo-${{ hashFiles('knot/Cargo.lock') }}
52
35
53− - name: Build knotc
36+ - name: Install musl toolchain
54− working-directory: knot
55− run: cargo build --release -p knot-compiler
56−
57− - name: Build musl runtime
58 if: runner.os == 'Linux'
37 if: runner.os == 'Linux'
59− working-directory: knot
38+ run: sudo apt-get update && sudo apt-get install -y musl-tools
60− run: cargo build --release -p knot-runtime --target ${{ matrix.musl-target }}
61
39
62 - name: Compile server (Linux static)
40 - name: Compile server (Linux static)
63 if: runner.os == 'Linux'
41 if: runner.os == 'Linux'
@@ -65,12 +43,12 @@ jobs:
65 printf '#!/bin/sh\nexec musl-gcc -static "$@"\n' > /tmp/static-cc
43 printf '#!/bin/sh\nexec musl-gcc -static "$@"\n' > /tmp/static-cc
66 chmod +x /tmp/static-cc
44 chmod +x /tmp/static-cc
67 CC=/tmp/static-cc \
45 CC=/tmp/static-cc \
68− KNOT_RUNTIME_LIB=${{ github.workspace }}/knot/target/${{ matrix.musl-target }}/release/libknot_runtime.a \
46+ KNOT_RUNTIME_LIB=${{ github.workspace }}/knot-dist/libknot_runtime.a \
69− ./knot/target/release/knotc build server.knot
47+ ./knot-dist/knot build server.knot
70
48
71 - name: Compile server (macOS)
49 - name: Compile server (macOS)
72 if: runner.os == 'macOS'
50 if: runner.os == 'macOS'
73− run: ./knot/target/release/knotc build server.knot
51+ run: ./knot-dist/knot build server.knot
74
52
75 - name: Verify binary
53 - name: Verify binary
76 run: file server
54 run: file server