feat: add C# support for xmake #1566
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Solaris | |
| 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; | |
| // Always run for release events | |
| if (context.eventName === 'release') { | |
| fs.appendFileSync(outputFile, `should-run=true\n`); | |
| core.info('Release event detected. Will run tests.'); | |
| return; | |
| } | |
| // Execution probability (default 50%, can be overridden via env) | |
| const probability = parseFloat(process.env.RUN_PROBABILITY || '0.5'); | |
| // Generate deterministic "random" number based on commit SHA, run ID, and current time | |
| // Adding time ensures better randomness while keeping same commit/run consistent | |
| const timeSeed = Math.floor(Date.now() / (1000 * 60 * 60)); // Round to hour for consistency | |
| 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; // Convert to 32-bit integer | |
| } | |
| // Normalize to 0-1 range | |
| const random = Math.abs(hash) / 2147483647; | |
| const shouldRun = random < probability; | |
| // Use environment file instead of deprecated set-output | |
| 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.SOLARIS_RUN_PROBABILITY || '0.5' }} | |
| build: | |
| needs: check | |
| if: needs.check.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-Solaris | |
| cancel-in-progress: true | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| submodules: true | |
| - name: Tests | |
| uses: vmactions/solaris-vm@v1 | |
| with: | |
| usesh: true | |
| prepare: | | |
| # Try OpenCSW first (for older Solaris) | |
| if command -v pkgutil >/dev/null 2>&1; then | |
| pkgutil -U || true | |
| pkgutil -y -i socat git gmake bash gcc4g++ 2>/dev/null || pkgutil -y -i socat git gmake bash gcc5g++ 2>/dev/null || true | |
| fi | |
| # Try IPS (for newer Solaris) | |
| if command -v pkg >/dev/null 2>&1; then | |
| pkg install --accept developer/gcc developer/build/gnu-make developer/versioning/git || true | |
| fi | |
| run: | | |
| cd $GITHUB_WORKSPACE | |
| bash ./configure | |
| gmake -j4 | |
| gmake install | |
| export XMAKE_ROOT=y | |
| xrepo --version | |
| xmake l os.meminfo | |
| xmake lua -v -D tests/run.lua | |