-
Notifications
You must be signed in to change notification settings - Fork 662
123 lines (104 loc) · 4.02 KB
/
Copy pathnode-ci.yml
File metadata and controls
123 lines (104 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: node-ci
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
test:
name: ${{ matrix.os }} / node-${{ matrix.node == '22.13.0' && '22' || matrix.node }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: ["22.13.0"]
include:
- os: windows-latest
node: "24"
- os: ubuntu-latest
node: "24.0.0"
- os: ubuntu-latest
node: "24"
- os: ubuntu-latest
node: "26.0.0"
- os: ubuntu-latest
node: "26"
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
with:
package_json_file: sdk/typescript/package.json
cache: true
cache_dependency_path: sdk/typescript/pnpm-lock.yaml
- name: Set up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: ${{ matrix.node }}
cache: npm
cache-dependency-path: sdk/typescript/pnpm-lock.yaml
- name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.3.14"
- name: Install dependencies
run: pnpm --dir sdk/typescript install --frozen-lockfile
- name: Audit production dependencies
if: matrix.os == 'ubuntu-latest' && matrix.node == '22.13.0'
continue-on-error: true
run: pnpm --dir sdk/typescript run audit:prod
- name: Typecheck
run: pnpm --dir sdk/typescript run types
- name: Prepare private Windows test root
if: runner.os == 'Windows'
id: windows-temp
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$path = Join-Path $env:USERPROFILE '.codex-security-ci-temp'
New-Item -ItemType Directory -Path $path -Force | Out-Null
$sid = (whoami /user /fo csv /nh | ConvertFrom-Csv -Header Name, Sid).Sid
& icacls $path /inheritance:r /grant:r "*${sid}:(OI)(CI)F" '*S-1-5-18:(OI)(CI)F' '*S-1-5-32-544:(OI)(CI)F' | Out-Null
if ($LASTEXITCODE -ne 0) { throw 'Could not secure the Windows test root' }
"path=$path" >> $env:GITHUB_OUTPUT
- name: Test
timeout-minutes: 10
env:
TEMP: ${{ steps.windows-temp.outputs.path || runner.temp }}
TMP: ${{ steps.windows-temp.outputs.path || runner.temp }}
TMPDIR: ${{ steps.windows-temp.outputs.path || runner.temp }}
CODEX_SECURITY_ALLOW_MACHINE_POLICY_TEST: ${{ runner.environment == 'github-hosted' && runner.os == 'Windows' && 'true' || 'false' }}
run: pnpm --dir sdk/typescript run test
- name: Check formatting
run: pnpm --dir sdk/typescript run format
- name: Build
run: pnpm --dir sdk/typescript run build
- name: Pack
working-directory: sdk/typescript
run: pnpm pack --pack-destination ../../dist
- name: Inspect package
working-directory: sdk/typescript
shell: bash
run: pnpm run check:package ../../dist/*.tgz
- name: Smoke-test Node.js runtime
working-directory: sdk/typescript
shell: bash
run: |
set -euo pipefail
node --input-type=module --eval '
import { CodexSecurity } from "@openai/codex-security";
if (typeof CodexSecurity !== "function") {
throw new Error("The SDK does not export CodexSecurity.");
}
'
node bin/codex-security.mjs --version
node bin/codex-security.mjs --help