@@ -0,0 +1,110 @@
9+ CARGO_TERM_COLOR: always
17+ - runner: ubuntu-latest
19+ - runner: macos-latest
23+ runs-on: ${{ matrix.runner }}
25+ - uses: actions/checkout@v4
27+ - uses: actions/checkout@v4
29+ repository: ilyakooo0/knot
32+ - uses: dtolnay/rust-toolchain@stable
34+ - name: Install musl toolchain
35+ if: runner.os == 'Linux'
38+ sudo apt-get install -y musl-tools
39+ rustup target add x86_64-unknown-linux-musl
41+ - uses: actions/cache@v4
47+ key: ${{ matrix.name }}-cargo-${{ hashFiles('knot/Cargo.lock') }}
50+ working-directory: knot
51+ run: cargo build --release -p knot-compiler
53+ - name: Build musl runtime
54+ if: runner.os == 'Linux'
55+ working-directory: knot
56+ run: cargo build --release -p knot-runtime --target x86_64-unknown-linux-musl
58+ - name: Compile server (Linux static)
59+ if: runner.os == 'Linux'
61+ printf '#!/bin/sh\nexec musl-gcc -static "$@"\n' > /tmp/static-cc
62+ chmod +x /tmp/static-cc
64+ KNOT_RUNTIME_LIB=${{ github.workspace }}/knot/target/x86_64-unknown-linux-musl/release/libknot_runtime.a \
65+ ./knot/target/release/knotc build server.knot
67+ - name: Compile server (macOS)
68+ if: runner.os == 'macOS'
69+ run: ./knot/target/release/knotc build server.knot
71+ - name: Verify binary
74+ - uses: actions/upload-artifact@v4
76+ name: server-${{ matrix.name }}
81+ if: github.ref == 'refs/heads/master' && github.event_name == 'push'
82+ runs-on: ubuntu-latest
86+ - uses: actions/download-artifact@v4
88+ - uses: actions/checkout@v4
92+ - name: Generate version
94+ run: echo "tag=$(git -C repo log -1 --format='%cd' --date='format:%Y.%m.%d.%H%M')" >> "$GITHUB_OUTPUT"
96+ - name: Prepare release assets
98+ for dir in server-*/; do
100+ mv "${dir}server" "${name}.tmp"
102+ mv "${name}.tmp" "$name"
106+ - uses: softprops/action-gh-release@v2
108+ tag_name: ${{ steps.version.outputs.tag }}
109+ name: ${{ steps.version.outputs.tag }}