From ec56536281a3a7804cd5ce6b755cf3da0190156a Mon Sep 17 00:00:00 2001 From: Ivan Komarov Date: Thu, 15 Feb 2024 22:19:13 +0100 Subject: [PATCH] Create a GitHub action to build the toolchain --- .github/workflows/build.yml | 45 +++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c558453d5..2ff3552c0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,31 +1,26 @@ -name: build - -on: - push: - branches: - - "master" - - "flake" - pull_request: - branches: - - "master" - - # run workflow manually from the Actions tab - workflow_dispatch: +name: build-release +on: workflow_dispatch jobs: - matrix_on_mode: - runs-on: ubuntu-latest - strategy: - matrix: - mode: ["", tiny, rel, tinylinux, optlinux] + build-release: + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - name: Disable binfmt_misc shenanigans + run: | + sudo wget -O /usr/bin/ape https://cosmo.zip/pub/cosmos/bin/ape-$(uname -m).elf + sudo chmod +x /usr/bin/ape + sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register" + sudo sh -c "echo ':APE-jart:M::jartsr::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register" - - name: support ape bins 1 - run: sudo cp build/bootstrap/ape.elf /usr/bin/ape + - uses: actions/checkout@v4 - - name: support ape bins 2 - run: sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register" + - name: Build Cosmo toolchain + run: tool/cosmocc/package.sh - - name: make matrix - run: V=0 make -j2 MODE=${{ matrix.mode }} + - name: Prepare toolchain archive + run: cd cosmocc && zip -ry9A ../cosmocc.zip . + + - name: Create release + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + run: gh release create cosmocc_${{github.sha}}_${{github.run_id}}_${{github.run_attempt}} -t "Cosmo toolchain" cosmocc.zip