Create a GitHub action to build the toolchain

This commit is contained in:
Ivan Komarov 2024-02-15 22:19:13 +01:00
parent 63c0c7d974
commit ec56536281

View file

@ -1,31 +1,26 @@
name: build name: build-release
on: workflow_dispatch
on:
push:
branches:
- "master"
- "flake"
pull_request:
branches:
- "master"
# run workflow manually from the Actions tab
workflow_dispatch:
jobs: jobs:
matrix_on_mode: build-release:
runs-on: ubuntu-latest runs-on: ubuntu-22.04
strategy:
matrix:
mode: ["", tiny, rel, tinylinux, optlinux]
steps: 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 - uses: actions/checkout@v4
run: sudo cp build/bootstrap/ape.elf /usr/bin/ape
- name: support ape bins 2 - name: Build Cosmo toolchain
run: sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register" run: tool/cosmocc/package.sh
- name: make matrix - name: Prepare toolchain archive
run: V=0 make -j2 MODE=${{ matrix.mode }} 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