# Optional / not on every PR: bootstrap selfhost determinism (make selfhost-loop). # Default PR CI is .github/workflows/ci.yml (`make test`). # Fixed-point gen2 vs gen3: BUX_SELFHOST_FIXED_POINT=1 (workflow_dispatch input). name: selfhost-loop on: workflow_dispatch: inputs: fixed_point: description: "Also run fixed-point buxc2→buxc3→buxc4 (gen2 vs gen3)" type: boolean default: false schedule: # Sundays 06:00 UTC - cron: "0 6 * * 0" push: branches: [main] paths: - "src/**" - "lib/**" - "rt/**" - "bootstrap/**" - "tools/selfhost_loop.sh" - "Makefile" - ".github/workflows/selfhost-loop.yml" concurrency: group: selfhost-loop-${{ github.ref }} cancel-in-progress: true env: NIM_VERSION: "2.0.8" NIM_INSTALL_DIR: ".nim_runtime" jobs: selfhost-loop: name: bootstrap determinism runs-on: ubuntu-latest timeout-minutes: 45 steps: - name: Checkout uses: actions/checkout@v4 - name: Cache Nim toolchain id: cache-nim uses: actions/cache@v4 with: path: ${{ env.NIM_INSTALL_DIR }} key: ${{ runner.os }}-nim-${{ env.NIM_VERSION }}-v1 - name: Install Nim if: steps.cache-nim.outputs.cache-hit != 'true' uses: jiro4989/setup-nim-action@v2 with: nim-version: ${{ env.NIM_VERSION }} nim-install-directory: ${{ env.NIM_INSTALL_DIR }} repo-token: ${{ secrets.GITHUB_TOKEN }} - name: PATH for cached Nim if: steps.cache-nim.outputs.cache-hit == 'true' run: | echo "$PWD/${{ env.NIM_INSTALL_DIR }}/bin" >> "$GITHUB_PATH" echo "$HOME/.nimble/bin" >> "$GITHUB_PATH" - name: Cache nimcache uses: actions/cache@v4 with: path: nimcache key: ${{ runner.os }}-nimcache-loop-${{ hashFiles('bootstrap/**/*.nim', 'src/**/*.bux') }}-v1 restore-keys: | ${{ runner.os }}-nimcache-loop- ${{ runner.os }}-nimcache-build- - name: Install build deps run: | sudo apt-get update sudo apt-get install -y --no-install-recommends gcc make binutils libssl-dev - name: Selfhost loop run: | if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ inputs.fixed_point }}" = "true" ]; then export BUX_SELFHOST_FIXED_POINT=1 echo "Fixed-point mode enabled (experimental)" fi make selfhost-loop - name: Upload C on failure if: failure() uses: actions/upload-artifact@v4 with: name: selfhost-loop-c path: | build/selfhost-loop-a/build/main.c build/selfhost-loop-b/build/main.c if-no-files-found: ignore