mirror of
https://github.com/openai/codex-security.git
synced 2026-11-25 02:58:16 +08:00
* chore(ci): share the pinned Bun version * test(ci): match the shared Bun setup step directly
160 lines
6.1 KiB
YAML
160 lines
6.1 KiB
YAML
name: Action CI
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
sdk-contracts:
|
|
description: Run the Action release contracts when the full SDK suite is skipped.
|
|
type: boolean
|
|
default: false
|
|
outputs:
|
|
passed:
|
|
description: Validation, dependency audits and eligible hosted smoke tests passed.
|
|
value: >-
|
|
${{ jobs.validate.outputs.result == 'success' &&
|
|
jobs.dependencies.outputs.result == 'success' &&
|
|
(jobs.smoke.outputs.result || 'skipped') == (github.event_name == 'pull_request' &&
|
|
github.event.pull_request.head.repo.full_name != github.repository && 'skipped' || 'success') }}
|
|
# node-ci owns PRs and main pushes. Fork branches and tags can exercise the Action directly.
|
|
push:
|
|
branches-ignore: [main]
|
|
tags: ["**"]
|
|
paths:
|
|
- action.yml
|
|
- github-action/**
|
|
- sdk/typescript/src/git-remote.ts
|
|
- plugins/codex-security/examples/completed-scan/**
|
|
- .github/workflows/action-ci.yml
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
# Keep each required main result. Superseded fork pushes can be cancelled.
|
|
group: action-ci-${{ github.event_name == 'push' && github.ref != 'refs/heads/main' && github.ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: github-action
|
|
|
|
jobs:
|
|
validate:
|
|
# Internal branches use PR validation; forks still exercise their push workflow.
|
|
if: &run-action-ci >-
|
|
github.event_name != 'push' || github.ref == 'refs/heads/main' ||
|
|
github.repository != 'openai/codex-security'
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 15
|
|
outputs: &action-result
|
|
result: ${{ job.status }}
|
|
steps:
|
|
- &actions-checkout
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- &actions-setup-node
|
|
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
with:
|
|
node-version: "24"
|
|
package-manager-cache: false
|
|
- run: npm ci --ignore-scripts --no-audit --no-fund
|
|
- run: npm run validate
|
|
- name: Set up Bun for Action release contracts
|
|
if: inputs.sdk-contracts
|
|
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
|
with:
|
|
bun-version-file: .bun-version
|
|
no-cache: true
|
|
- name: Test Action release contracts
|
|
if: inputs.sdk-contracts
|
|
working-directory: sdk/typescript
|
|
run: bun test --timeout 30000 tests-ts/action-release-workflow.test.ts tests-ts/codex-dependency-pins.test.ts
|
|
- name: Packaged Linux sandbox and configuration smoke test (no model calls)
|
|
run: node scripts/linux-smoke.mjs
|
|
- name: Install the pinned CLI for integration tests
|
|
run: npm ci --prefix runtime --ignore-scripts --no-audit --no-fund
|
|
- name: Published CLI result and SARIF compatibility (no model calls)
|
|
run: npm run test:cli
|
|
- name: Save generated release metadata
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: action-release-metadata
|
|
path: github-action/build/*.json
|
|
retention-days: 7
|
|
if-no-files-found: error
|
|
|
|
smoke:
|
|
name: Hosted Action smoke tests
|
|
# Fork PRs are unsupported; their push workflows exercise the Action instead.
|
|
if: >-
|
|
(github.event_name != 'push' || github.ref == 'refs/heads/main' ||
|
|
github.repository != 'openai/codex-security') &&
|
|
(github.event_name != 'pull_request' ||
|
|
github.event.pull_request.head.repo.full_name == github.repository)
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 15
|
|
outputs: *action-result
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
# Test the Action at its PR head.
|
|
fetch-depth: 2
|
|
persist-credentials: false
|
|
- *actions-setup-node
|
|
- name: Check out the PR head for the Action smoke tests
|
|
if: github.event_name == 'pull_request'
|
|
env:
|
|
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
run: git switch --detach "$PR_HEAD_SHA"
|
|
- name: Validate the default OpenAI configuration without model calls
|
|
id: openai
|
|
uses: ./
|
|
with:
|
|
dry-run: "true"
|
|
- name: Verify OpenAI dry-run outputs
|
|
env:
|
|
SCAN_STATUS: ${{ steps.openai.outputs.scan-status }}
|
|
SKIP_REASON: ${{ steps.openai.outputs.skip-reason }}
|
|
EXIT_CODE: ${{ steps.openai.outputs.exit-code }}
|
|
SCANNED_SHA: ${{ steps.openai.outputs.scanned-sha }}
|
|
EXPECTED_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
SARIF_UPLOAD_READY: ${{ steps.openai.outputs.sarif-upload-ready }}
|
|
run: &verify-dry-run-outputs |
|
|
test "$SCAN_STATUS" = skipped
|
|
test "$SKIP_REASON" = dry-run
|
|
test "$EXIT_CODE" = 0
|
|
test "$SCANNED_SHA" = "$EXPECTED_SHA"
|
|
test "$SARIF_UPLOAD_READY" = false
|
|
- name: Validate the Bedrock configuration without model calls
|
|
id: bedrock
|
|
uses: ./
|
|
with:
|
|
provider: amazon-bedrock
|
|
model: openai.gpt-5.6-luna
|
|
dry-run: "true"
|
|
- name: Verify Bedrock dry-run outputs
|
|
env:
|
|
SCAN_STATUS: ${{ steps.bedrock.outputs.scan-status }}
|
|
SKIP_REASON: ${{ steps.bedrock.outputs.skip-reason }}
|
|
EXIT_CODE: ${{ steps.bedrock.outputs.exit-code }}
|
|
SCANNED_SHA: ${{ steps.bedrock.outputs.scanned-sha }}
|
|
EXPECTED_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
SARIF_UPLOAD_READY: ${{ steps.bedrock.outputs.sarif-upload-ready }}
|
|
run: *verify-dry-run-outputs
|
|
|
|
dependencies:
|
|
if: *run-action-ci
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 10
|
|
outputs: *action-result
|
|
steps:
|
|
- *actions-checkout
|
|
- *actions-setup-node
|
|
- name: Check action dependencies
|
|
run: npm audit --audit-level=high
|
|
- name: Check locked CLI dependencies
|
|
if: always()
|
|
run: npm audit --prefix runtime --omit=dev --audit-level=high
|