feat: use detached spawn for agent #58
This file contains 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: CI | ||
on: | ||
pull_request: {} | ||
merge_group: {} | ||
push: | ||
branches: | ||
- main | ||
- 'releases/*' | ||
jobs: | ||
lint-code: | ||
name: "Check: Lint" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: read | ||
statuses: write | ||
steps: | ||
- name: "Setup: Harden Runner" | ||
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 | ||
with: | ||
egress-policy: audit | ||
- name: "Setup: Checkout" | ||
id: checkout | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
- name: "Setup: PNPM" | ||
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0 | ||
with: | ||
version: 8.9.0 | ||
- name: "Setup: Node" | ||
id: setup-node | ||
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 | ||
with: | ||
node-version: 20 | ||
cache: pnpm | ||
- name: "Setup: Install Dependencies" | ||
id: install | ||
run: pnpm install && pnpm run gen | ||
- name: "Check: Linter" | ||
id: super-linter | ||
uses: super-linter/super-linter/slim@3213b9ea991e2d45d760ea8a76aaebad8a2bdb1a # v5.4.0 | ||
env: | ||
DEFAULT_BRANCH: main | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
TYPESCRIPT_DEFAULT_STYLE: prettier | ||
VALIDATE_JSCPD: false | ||
lint-action: | ||
name: "Check: Action Lint" | ||
permissions: | ||
contents: read | ||
checks: write | ||
pull-requests: read | ||
id-token: write | ||
uses: elide-dev/build-infra/.github/workflows/lint.action.yml@main | ||
check-codeql: | ||
Check failure on line 61 in .github/workflows/ci.yml GitHub Actions / CIInvalid workflow file
|
||
name: "Check: CodeQL" | ||
permissions: | ||
contents: read | ||
uses: ./.github/workflows/check.codeql-analysis.yml | ||
secrets: inherit | ||
dependency-review: | ||
name: "Check: Dependency Review" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- name: "Setup: Harden Runner" | ||
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 | ||
with: | ||
egress-policy: audit | ||
- name: "Setup: Checkout" | ||
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | ||
- name: "Check: Dependency Review" | ||
uses: actions/dependency-review-action@0efb1d1d84fc9633afcdaad14c485cbbc90ef46c # v2.5.1 | ||
test-typescript: | ||
name: "Test: Unit Tests" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 | ||
with: | ||
egress-policy: audit | ||
- name: "Setup: Checkout" | ||
id: checkout | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
- name: "Setup: PNPM" | ||
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0 | ||
with: | ||
version: 8.9.0 | ||
- name: "Setup: Node" | ||
id: setup-node | ||
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 | ||
with: | ||
node-version: 20 | ||
cache: pnpm | ||
- name: "Setup: Install Dependencies" | ||
id: install | ||
run: pnpm install && pnpm install -g turbo && pnpm run gen | ||
- name: Check Format | ||
id: npm-format-check | ||
run: pnpm run format:check | ||
- name: Lint | ||
id: npm-lint | ||
run: pnpm run lint | ||
- name: Test | ||
id: npm-ci-test | ||
run: turbo test --token ${{ secrets.BUILDLESS_APIKEY }} --no-daemon --remote-only | ||
- name: "Test: Sonar" | ||
uses: SonarSource/sonarcloud-github-action@5ee47de3c96f0c1c51b09d2ff1fec0cfeefcf67c # master | ||
continue-on-error: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
with: | ||
args: > | ||
-Dsonar.organization=buildless | ||
-Dsonar.projectKey=buildless_setup | ||
-Dsonar.sources=src/ | ||
-Dsonar.tests=__tests__/ | ||
-Dsonar.verbose=true | ||
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info | ||
-Dsonar.testExecutionReportPaths=test-report.xml | ||
- name: "Report: Coverage" | ||
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
test-action: | ||
name: "Test: Install" | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-13-xlarge] | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 | ||
with: | ||
egress-policy: audit | ||
- name: "Setup: Checkout" | ||
id: checkout | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
- name: "Test: Buildless Action" | ||
id: test-action | ||
uses: ./ | ||
- name: "Test: Print Output" | ||
id: output | ||
run: echo "${{ steps.test-action.outputs.path }}" | ||
test-path: | ||
name: "Test: Path" | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-13-xlarge] | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 | ||
with: | ||
egress-policy: audit | ||
- name: "Setup: Checkout" | ||
id: checkout | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
- name: "Test: Buildless Action" | ||
id: test-action | ||
uses: ./ | ||
- name: "Test: Print Output" | ||
id: output | ||
run: echo "${{ steps.test-action.outputs.path }}" | ||
- name: "Test: Binary on PATH" | ||
run: buildless --help | ||
test-agent: | ||
name: "Test: Agent" | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 5 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-13-xlarge] | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 | ||
with: | ||
egress-policy: audit | ||
- name: "Setup: Checkout" | ||
id: checkout | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
- name: "Fixup: Directory (Linux/macOS)" | ||
shell: bash | ||
if: matrix.os != 'windows-latest' | ||
run: rm -fr /var/tmp/buildless && mkdir -p /var/tmp/buildless | ||
- name: "Fixup: Directory (Windows)" | ||
shell: bash | ||
if: matrix.os == 'windows-latest' | ||
run: rmdir /c/ProgramData/buildless && mkdir /c/ProgramData/buildless | ||
- name: "Test: Install CLI" | ||
id: test-action-install | ||
uses: ./ | ||
with: | ||
agent: false | ||
- name: "Test: Agent Not Installed" | ||
run: | | ||
ls -la /tmp/ /var/tmp/buildless/ | ||
test "Agent is not installed." = "$(buildless agent status)" || buildless --verbose=true agent status | ||
- name: "Test: Buildless Action" | ||
id: test-action | ||
uses: ./ | ||
with: | ||
agent: true | ||
- name: "Test: Print Output" | ||
id: output | ||
run: echo "${{ steps.test-action.outputs.path }}" | ||
- name: "Test: Agent Running" | ||
run: | | ||
ls -la /tmp/ /var/tmp/buildless/ | ||
test "Agent is installed, running, and ready." = "$(buildless agent status)" || buildless --verbose=true agent status | ||
echo "Test passed: agent is running." | ||
buildless --verbose=true agent status | ||
- name: "Diagnostic: Agent Failure (Linux)" | ||
if: failure() && matrix.os == 'ubuntu-latest' | ||
run: | | ||
echo "Agent processes:" | ||
ps aux | pgrep buildless | ||
echo '' | ||
echo "Agent output:" | ||
cat /var/tmp/buildless-agent.out || echo "Failed to read agent output" | ||
echo '' | ||
echo "Trying to run in foreground:" | ||
buildless --verbose=true agent run --no-background | ||
- name: "Diagnostic: Agent Failure (macOS)" | ||
if: failure() && matrix.os == 'macos-13-xlarge' | ||
run: | | ||
echo "Agent processes:" | ||
ps -A | pgrep buildless | ||
echo '' | ||
echo "Agent output:" | ||
cat /var/tmp/buildless-agent.out || echo "Failed to read agent output" | ||
echo '' | ||
echo "Trying to run in foreground:" | ||
buildless --verbose=true agent run --no-background | ||
- name: "Diagnostic: Agent Failure (Windows)" | ||
if: failure() && matrix.os == 'ubuntu-latest' | ||
run: | | ||
echo "Agent processes:" | ||
ps aux | pgrep buildless | ||
echo '' | ||
echo "Agent output:" | ||
cat C:\\ProgramData\\buildless\\buildless-agent.out | ||
echo '' | ||
echo "Trying to run in foreground:" | ||
buildless --verbose=true agent run --no-background | ||
- name: "Report: Agent State (Linux)" | ||
if: (success() || failure()) && matrix.os == 'ubuntu-latest' | ||
run: | | ||
if [ -f "/var/tmp/buildless/buildless-agent.json" ]; then | ||
echo 'Agent configuration:' && jq < /var/tmp/buildless/buildless-agent.json | ||
echo '' | ||
echo 'Contents of tmp path:' | ||
ls -la /var/tmp/buildless | ||
echo '' | ||
echo 'Agent process:' | ||
ps aux | pgrep buildless | ||
else | ||
echo 'No agent configuration found. Contents of tmp path:' | ||
ls -la /var/tmp/buildless | ||
fi | ||
- name: "Report: Agent State (macOS)" | ||
if: (success() || failure()) && matrix.os == 'macos-13-xlarge' | ||
run: | | ||
if [ -f "/var/tmp/buildless/buildless-agent.json" ]; then | ||
echo 'Agent configuration:' && jq < /var/tmp/buildless/buildless-agent.json | ||
echo '' | ||
echo 'Contents of tmp path:' | ||
ls -la /var/tmp/buildless | ||
echo '' | ||
echo 'Agent process:' | ||
ps -A | pgrep buildless | ||
else | ||
echo 'No agent configuration found. Contents of tmp path:' | ||
ls -la /var/tmp/buildless | ||
fi | ||
- name: "Report: Agent State (Windows)" | ||
if: (success() || failure()) && matrix.os == 'windows-latest' | ||
shell: bash | ||
run: | | ||
if [ -f "/c/ProgramData/buildless/buildless-agent.json" ]; then | ||
echo 'Agent configuration:' && jq < /var/tmp/buildless/buildless-agent.json | ||
echo '' | ||
echo 'Contents of tmp path:' | ||
ls -la /c/ProgramData/buildless | ||
echo '' | ||
echo 'Agent process:' | ||
ps aux | pgrep buildless | ||
else | ||
echo 'No agent configuration found. Contents of tmp path:' | ||
ls -la /c/ProgramData/buildless | ||
echo '' | ||
echo 'Agent process:' | ||
ps aux | pgrep buildless | ||
fi | ||
test-noagent: | ||
name: "Test: No Agent" | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-13-xlarge] | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 | ||
with: | ||
egress-policy: audit | ||
- name: "Setup: Checkout" | ||
id: checkout | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
- name: "Test: Buildless Action" | ||
id: test-action | ||
uses: ./ | ||
with: | ||
agent: false | ||
- name: "Test: Print Output" | ||
id: output | ||
run: echo "${{ steps.test-action.outputs.path }}" | ||
- name: "Test: Agent Not Installed" | ||
run: test "Agent is not installed." = "$(buildless agent status)" | ||
test-smoketest: | ||
name: "Test: Smoke Test" | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-13-xlarge] | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 | ||
with: | ||
egress-policy: audit | ||
- name: "Setup: Checkout" | ||
id: checkout | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
- name: "Test: Buildless Action" | ||
id: test-action | ||
uses: ./ | ||
with: | ||
agent: false | ||
- name: "Test: Print Output" | ||
id: output | ||
run: echo "${{ steps.test-action.outputs.path }}" | ||
- name: "Test: Help" | ||
run: buildless --help | ||
- name: "Test: Version" | ||
run: buildless --version | ||
- name: "Test: Show" | ||
run: buildless --verbose=true show | ||
- name: "Test: Status" | ||
run: buildless --verbose=true status | ||
- name: "Test: Agent Status" | ||
run: buildless --verbose=true status | ||
- name: "Test: Legal" | ||
run: buildless legal | ||
check-dist: | ||
name: "Test: Dist" | ||
uses: ./.github/workflows/check.dist.yml | ||
secrets: inherit | ||
permissions: | ||
contents: read | ||
statuses: write |