diff options
| author | ruki <[email protected]> | 2026-02-13 23:59:41 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-02-14 16:19:12 +0800 |
| commit | 918d22c5a20e579c9c9e32ff41bfdcb11c350d2c (patch) | |
| tree | fd718fcae3598e433762797a1d5c56f35c2a71f5 /.github | |
| parent | 821545f6a78188e733b0abe84cdfcb6d07c9e082 (diff) | |
add haiku ci
Diffstat (limited to '.github')
| -rw-r--r-- | .github/workflows/haiku.yml | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/.github/workflows/haiku.yml b/.github/workflows/haiku.yml new file mode 100644 index 000000000..f277d263f --- /dev/null +++ b/.github/workflows/haiku.yml @@ -0,0 +1,81 @@ +name: Haiku + +on: + pull_request: + push: + release: + types: [published] + +jobs: + check: + runs-on: ubuntu-latest + outputs: + should-run: ${{ steps.check.outputs.should-run }} + steps: + - name: Random execution check + id: check + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const outputFile = process.env.GITHUB_OUTPUT; + + if (context.eventName === 'release') { + fs.appendFileSync(outputFile, `should-run=true\n`); + core.info('Release event detected. Will run tests.'); + return; + } + + const probability = parseFloat(process.env.RUN_PROBABILITY || '0.2'); + const timeSeed = Math.floor(Date.now() / (1000 * 60 * 60)); + const seed = context.sha + context.runId + timeSeed; + let hash = 0; + for (let i = 0; i < seed.length; i++) { + const char = seed.charCodeAt(i); + hash = ((hash << 5) - hash) + char; + hash = hash | 0; + } + const random = Math.abs(hash) / 2147483647; + const shouldRun = random < probability; + + fs.appendFileSync(outputFile, `should-run=${shouldRun}\n`); + if (shouldRun) { + core.info(`Random check passed (${(random * 100).toFixed(2)}% < ${(probability * 100).toFixed(0)}%). Will run tests.`); + } else { + core.info(`Random check failed (${(random * 100).toFixed(2)}% >= ${(probability * 100).toFixed(0)}%). Skipping.`); + } + env: + RUN_PROBABILITY: ${{ vars.HAIKU_RUN_PROBABILITY || '0.2' }} + + build: + #needs: check + #if: needs.check.outputs.should-run == 'true' + runs-on: ubuntu-latest + + concurrency: + group: Haiku-${{ github.event.repository.owner.login }}-${{ github.event.repository.name }} + cancel-in-progress: false + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Tests + uses: vmactions/haiku-vm@v1 + with: + usesh: true + mem: 4096 + copyback: false + prepare: | + pkgman install -y git curl unzip make bash perl + run: | + pwd + ./configure --prefix=`pwd`/dist + make -j2 + make install + ls -l ./dist/ + export XMAKE_ROOT=y + export PATH=`pwd`/dist/bin:$PATH + xrepo --version + xmake l os.meminfo + xmake l string.lower "Test 源文件🎆 Message" |
