code-foundry 0.24.1 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/licenses/AGPL-3.0-or-later.txt +661 -0
- package/.github/licenses/GPL-3.0-or-later.txt +674 -0
- package/.github/licenses/MIT.txt +4 -16
- package/.github/scripts/init-repo.sh +6 -2
- package/.github/scripts/sync-template.sh +17 -5
- package/.github/workflows/ci.yml +177 -14
- package/.github/workflows/ci_self-ci.yml +21 -0
- package/.github/workflows/codeql.yml +236 -16
- package/.github/workflows/codeql_self-ci.yml +26 -0
- package/.github/workflows/draft-pr.yml +49 -16
- package/.github/workflows/draft-pr_self-ci.yml +24 -0
- package/.github/workflows/release-pr.yml +91 -9
- package/.github/workflows/release-pr_self-ci.yml +17 -0
- package/.github/workflows/release.yml +107 -10
- package/.github/workflows/release_self-ci.yml +20 -0
- package/.github/workflows/security.yml +289 -14
- package/.github/workflows/security_self-ci.yml +21 -0
- package/.github/workflows/test.yml +246 -15
- package/.github/workflows/test_self-ci.yml +22 -0
- package/CHANGELOG.md +19 -0
- package/README.md +3 -2
- package/docs/CONFIGURATION.md +1 -1
- package/docs/INITIALIZATION.md +3 -0
- package/package.json +1 -1
- package/.github/workflows/reusable-ci.yml +0 -184
- package/.github/workflows/reusable-codeql.yml +0 -246
- package/.github/workflows/reusable-draft-pr.yml +0 -57
- package/.github/workflows/reusable-release-pr.yml +0 -99
- package/.github/workflows/reusable-release.yml +0 -117
- package/.github/workflows/reusable-security.yml +0 -296
- package/.github/workflows/reusable-test.yml +0 -253
package/.github/licenses/MIT.txt
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) <year> <copyright holders>
|
|
4
4
|
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
11
6
|
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
14
8
|
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -17,7 +17,7 @@ bootstrap=true
|
|
|
17
17
|
release_type="${REPO_FOUNDRY_RELEASE_TYPE:-auto}"
|
|
18
18
|
npm_publish="${REPO_FOUNDRY_NPM_PUBLISH:-false}"
|
|
19
19
|
prune_standard="${REPO_FOUNDRY_PRUNE_STANDARD:-false}"
|
|
20
|
-
license="${REPO_FOUNDRY_LICENSE:-
|
|
20
|
+
license="${REPO_FOUNDRY_LICENSE:-gpl-3.0-or-later}"
|
|
21
21
|
license_file="${REPO_FOUNDRY_LICENSE_FILE:-}"
|
|
22
22
|
runner="${REPO_FOUNDRY_RUNNER:-ubuntu-latest}"
|
|
23
23
|
unit_runner="${REPO_FOUNDRY_UNIT_RUNNER:-ubuntu-slim}"
|
|
@@ -74,7 +74,7 @@ Options:
|
|
|
74
74
|
--runtime-repository OWNER/REPO Reusable workflow runtime repository (auto from source)
|
|
75
75
|
--runtime-ref REF Reusable workflow runtime tag or branch
|
|
76
76
|
--release-type NAME auto, node, python, rust, or simple
|
|
77
|
-
--license NAME agpl-3.0-or-later, mit, preserve, or none
|
|
77
|
+
--license NAME gpl-3.0-or-later, agpl-3.0-or-later, mit, preserve, or none
|
|
78
78
|
--license-file PATH Use an exact custom license file
|
|
79
79
|
--npm-publish Enable npm publication in the release workflow
|
|
80
80
|
--dry-run Preview changes without writing files
|
|
@@ -160,6 +160,10 @@ if [ -f "$config_path" ]; then
|
|
|
160
160
|
[ -n "$turbo_remote" ] || turbo_remote=auto
|
|
161
161
|
[ -n "$prune_standard" ] || prune_standard=false
|
|
162
162
|
[ "$prune_standard" = true ] && prune=true
|
|
163
|
+
elif [ -f LICENSE ] && [ -z "${REPO_FOUNDRY_LICENSE:-}" ] && [ "$license_set" = false ]; then
|
|
164
|
+
# Existing projects keep their authored license unless the user explicitly
|
|
165
|
+
# selects a replacement in the generated configuration.
|
|
166
|
+
license=preserve
|
|
163
167
|
fi
|
|
164
168
|
|
|
165
169
|
case "$package_manager" in
|
|
@@ -15,7 +15,7 @@ Options:
|
|
|
15
15
|
--package-manager NAME auto, bun, pnpm, yarn, or npm
|
|
16
16
|
--runtime-repository OWNER/REPO Reusable workflow runtime repository
|
|
17
17
|
--runtime-ref REF Reusable workflow runtime tag or branch
|
|
18
|
-
--license NAME preserve, agpl-3.0-or-later, mit, or none
|
|
18
|
+
--license NAME preserve, gpl-3.0-or-later, agpl-3.0-or-later, mit, or none
|
|
19
19
|
--license-file PATH Use an exact custom license file
|
|
20
20
|
--check Preview changes (default)
|
|
21
21
|
--apply Apply changes
|
|
@@ -249,7 +249,7 @@ contains_word "$valid_release_types" "$release_type" || {
|
|
|
249
249
|
exit 2
|
|
250
250
|
}
|
|
251
251
|
case "$license" in
|
|
252
|
-
preserve|agpl-3.0-or-later|mit|custom|none) ;;
|
|
252
|
+
preserve|gpl-3.0-or-later|agpl-3.0-or-later|mit|custom|none) ;;
|
|
253
253
|
*) printf 'Unsupported license: %s\n' "$license" >&2; exit 2 ;;
|
|
254
254
|
esac
|
|
255
255
|
[ -z "$license_file" ] || license=custom
|
|
@@ -371,6 +371,9 @@ removed_files=(
|
|
|
371
371
|
.github/scripts/sync-template.sh
|
|
372
372
|
.github/scripts/sitecustomize.py
|
|
373
373
|
.github/scripts/turbo-cache-probe.sh
|
|
374
|
+
.github/licenses/MIT.txt
|
|
375
|
+
.github/licenses/GPL-3.0-or-later.txt
|
|
376
|
+
.github/licenses/AGPL-3.0-or-later.txt
|
|
374
377
|
)
|
|
375
378
|
for file in "${removed_files[@]}"; do
|
|
376
379
|
if [ -e "$file" ]; then
|
|
@@ -390,7 +393,7 @@ done
|
|
|
390
393
|
standard_workflow() {
|
|
391
394
|
case "$1" in
|
|
392
395
|
ci.yml|codeql.yml|draft-pr.yml|release-pr.yml|release.yml|security.yml|test.yml) return 0 ;;
|
|
393
|
-
|
|
396
|
+
*_self-ci.yml) return 0 ;;
|
|
394
397
|
*) return 1 ;;
|
|
395
398
|
esac
|
|
396
399
|
}
|
|
@@ -417,6 +420,13 @@ fi
|
|
|
417
420
|
|
|
418
421
|
for file in "${files[@]}"; do
|
|
419
422
|
template_file="$template_root/$file"
|
|
423
|
+
case "$file" in
|
|
424
|
+
.github/workflows/*.yml)
|
|
425
|
+
workflow_name="${file##*/}"
|
|
426
|
+
workflow_name="${workflow_name%.yml}"
|
|
427
|
+
template_file="$template_root/.github/workflows/${workflow_name}_self-ci.yml"
|
|
428
|
+
;;
|
|
429
|
+
esac
|
|
420
430
|
# npm renames .gitignore to .npmignore when installing a package. Treat the
|
|
421
431
|
# renamed file as the same template asset so packaged initialization works.
|
|
422
432
|
if [ "$file" = .gitignore ] && [ ! -f "$template_file" ] && [ -f "$template_root/.npmignore" ]; then
|
|
@@ -489,7 +499,7 @@ fi
|
|
|
489
499
|
[ -n "$source_runtime_ref" ] || source_runtime_ref="$runtime_ref"
|
|
490
500
|
for file in .github/workflows/ci.yml .github/workflows/test.yml .github/workflows/security.yml .github/workflows/codeql.yml .github/workflows/draft-pr.yml .github/workflows/release-pr.yml .github/workflows/release.yml; do
|
|
491
501
|
[ -f "$file" ] || continue
|
|
492
|
-
if grep -qF "$source_runtime_repository@" "$file" || grep -q 'runtime-ref:' "$file"; then
|
|
502
|
+
if grep -qF "$source_runtime_repository@" "$file" || grep -q 'runtime-ref:' "$file" || grep -qF 'uses: ./.github/workflows/' "$file"; then
|
|
493
503
|
changed=$((changed + 1))
|
|
494
504
|
if [ "$mode" = "check" ]; then
|
|
495
505
|
printf 'Would render runtime repository in %s\n' "$file"
|
|
@@ -506,6 +516,7 @@ for file in .github/workflows/ci.yml .github/workflows/test.yml .github/workflow
|
|
|
506
516
|
rendered_workflow="$(mktemp)"
|
|
507
517
|
sed -E \
|
|
508
518
|
-e "s#${source_runtime_repository}@[^[:space:]]+#${runtime_repository}@${runtime_ref}#g" \
|
|
519
|
+
-e "s#uses: \.\/.github/workflows/([^[:space:]]+)#uses: ${runtime_repository}/.github/workflows/\\1@${runtime_ref}#g" \
|
|
509
520
|
-e "s#runtime-ref: [^[:space:]]+#runtime-ref: ${runtime_ref}#g" \
|
|
510
521
|
-e "s#^ runner: [^[:space:]]+# runner: ${runner_value}#" \
|
|
511
522
|
-e "s#^ unit-runner: [^[:space:]]+# unit-runner: ${unit_runner}#" \
|
|
@@ -525,7 +536,8 @@ write_license() {
|
|
|
525
536
|
license_source="$license_file"
|
|
526
537
|
else
|
|
527
538
|
case "$license" in
|
|
528
|
-
|
|
539
|
+
gpl-3.0-or-later) license_source="$template_root/.github/licenses/GPL-3.0-or-later.txt" ;;
|
|
540
|
+
agpl-3.0-or-later) license_source="$template_root/.github/licenses/AGPL-3.0-or-later.txt" ;;
|
|
529
541
|
mit) license_source="$template_root/.github/licenses/MIT.txt" ;;
|
|
530
542
|
esac
|
|
531
543
|
[ -f "$license_source" ] || { printf 'License template missing: %s\n' "$license_source" >&2; exit 1; }
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -1,21 +1,184 @@
|
|
|
1
|
-
name: CI
|
|
1
|
+
name: Code Foundry CI
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
workflow_call:
|
|
5
|
+
inputs:
|
|
6
|
+
runtime-repository:
|
|
7
|
+
description: Repository containing the Code Foundry runtime.
|
|
8
|
+
required: false
|
|
9
|
+
type: string
|
|
10
|
+
default: 0xPlayerOne/code-foundry
|
|
11
|
+
runtime-ref:
|
|
12
|
+
description: Code Foundry runtime tag or ref.
|
|
13
|
+
required: false
|
|
14
|
+
type: string
|
|
15
|
+
default: v0.20.2
|
|
16
|
+
runner:
|
|
17
|
+
description: Runner used by CI jobs.
|
|
18
|
+
required: false
|
|
19
|
+
type: string
|
|
20
|
+
default: ubuntu-latest
|
|
9
21
|
|
|
10
22
|
permissions:
|
|
11
23
|
contents: read
|
|
12
24
|
|
|
25
|
+
env:
|
|
26
|
+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
27
|
+
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
|
28
|
+
REPO_FOUNDRY_PROFILE: ${{ vars.REPO_FOUNDRY_PROFILE }}
|
|
29
|
+
REPO_FOUNDRY_LANGUAGES: ${{ vars.REPO_FOUNDRY_LANGUAGES }}
|
|
30
|
+
REPO_FOUNDRY_FEATURES: ${{ vars.REPO_FOUNDRY_FEATURES }}
|
|
31
|
+
REPO_FOUNDRY_PACKAGE_MANAGER: ${{ vars.REPO_FOUNDRY_PACKAGE_MANAGER }}
|
|
32
|
+
REPO_FOUNDRY_RUNNER: ${{ vars.REPO_FOUNDRY_RUNNER }}
|
|
33
|
+
REPO_FOUNDRY_CACHE_PACKAGES: ${{ vars.REPO_FOUNDRY_CACHE_PACKAGES || 'auto' }}
|
|
34
|
+
REPO_FOUNDRY_CACHE_BUILD: ${{ vars.REPO_FOUNDRY_CACHE_BUILD || 'auto' }}
|
|
35
|
+
REPO_FOUNDRY_BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before || '' }}
|
|
36
|
+
|
|
37
|
+
concurrency:
|
|
38
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.head.repo.full_name || github.repository }}-${{ github.event.pull_request.head.ref || github.ref_name }}
|
|
39
|
+
cancel-in-progress: true
|
|
40
|
+
|
|
13
41
|
jobs:
|
|
14
|
-
|
|
15
|
-
name:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
42
|
+
format:
|
|
43
|
+
name: Format
|
|
44
|
+
runs-on: ${{ inputs.runner }}
|
|
45
|
+
steps:
|
|
46
|
+
- name: Checkout
|
|
47
|
+
uses: actions/checkout@v7
|
|
48
|
+
- name: Runtime
|
|
49
|
+
uses: actions/checkout@v7
|
|
50
|
+
with:
|
|
51
|
+
repository: ${{ inputs.runtime-repository }}
|
|
52
|
+
ref: ${{ inputs.runtime-ref }}
|
|
53
|
+
path: .code-foundry
|
|
54
|
+
sparse-checkout: |
|
|
55
|
+
.github/actions
|
|
56
|
+
.github/scripts
|
|
57
|
+
- name: Install runtime
|
|
58
|
+
run: |
|
|
59
|
+
mkdir -p .github/actions .github/scripts
|
|
60
|
+
cp -R .code-foundry/.github/actions/. .github/actions/
|
|
61
|
+
cp -R .code-foundry/.github/scripts/. .github/scripts/
|
|
62
|
+
- name: Detect
|
|
63
|
+
id: applicability
|
|
64
|
+
run: bash .github/scripts/ci.sh should_run format >> "$GITHUB_OUTPUT"
|
|
65
|
+
- name: Fast path
|
|
66
|
+
if: steps.applicability.outputs.applicable == 'true'
|
|
67
|
+
run: bash .github/scripts/format-fast-path.sh
|
|
68
|
+
- name: Setup
|
|
69
|
+
if: steps.applicability.outputs.applicable == 'true'
|
|
70
|
+
uses: ./.github/actions/setup
|
|
71
|
+
with:
|
|
72
|
+
install: 'false'
|
|
73
|
+
cache-format: 'true'
|
|
74
|
+
cache-lint: 'false'
|
|
75
|
+
cache-build: 'false'
|
|
76
|
+
task: format
|
|
77
|
+
task-javascript: 'true'
|
|
78
|
+
task-python: 'false'
|
|
79
|
+
task-rust: 'false'
|
|
80
|
+
- name: Format
|
|
81
|
+
if: steps.applicability.outputs.applicable == 'true'
|
|
82
|
+
run: bash .github/scripts/ci.sh format
|
|
83
|
+
|
|
84
|
+
lint:
|
|
85
|
+
name: Lint
|
|
86
|
+
runs-on: ${{ inputs.runner }}
|
|
87
|
+
steps:
|
|
88
|
+
- name: Checkout
|
|
89
|
+
uses: actions/checkout@v7
|
|
90
|
+
- name: Runtime
|
|
91
|
+
uses: actions/checkout@v7
|
|
92
|
+
with:
|
|
93
|
+
repository: ${{ inputs.runtime-repository }}
|
|
94
|
+
ref: ${{ inputs.runtime-ref }}
|
|
95
|
+
path: .code-foundry
|
|
96
|
+
sparse-checkout: |
|
|
97
|
+
.github/actions
|
|
98
|
+
.github/scripts
|
|
99
|
+
- name: Install runtime
|
|
100
|
+
run: |
|
|
101
|
+
mkdir -p .github/actions .github/scripts
|
|
102
|
+
cp -R .code-foundry/.github/actions/. .github/actions/
|
|
103
|
+
cp -R .code-foundry/.github/scripts/. .github/scripts/
|
|
104
|
+
- name: Detect
|
|
105
|
+
id: applicability
|
|
106
|
+
run: bash .github/scripts/ci.sh should_run lint >> "$GITHUB_OUTPUT"
|
|
107
|
+
- name: Setup
|
|
108
|
+
if: steps.applicability.outputs.applicable == 'true'
|
|
109
|
+
uses: ./.github/actions/setup
|
|
110
|
+
with:
|
|
111
|
+
install: 'true'
|
|
112
|
+
cache-lint: 'true'
|
|
113
|
+
task: lint
|
|
114
|
+
- name: Lint
|
|
115
|
+
if: steps.applicability.outputs.applicable == 'true'
|
|
116
|
+
run: bash .github/scripts/ci.sh lint
|
|
117
|
+
|
|
118
|
+
type-check:
|
|
119
|
+
name: Type-Check
|
|
120
|
+
runs-on: ${{ inputs.runner }}
|
|
121
|
+
steps:
|
|
122
|
+
- name: Checkout
|
|
123
|
+
uses: actions/checkout@v7
|
|
124
|
+
- name: Runtime
|
|
125
|
+
uses: actions/checkout@v7
|
|
126
|
+
with:
|
|
127
|
+
repository: ${{ inputs.runtime-repository }}
|
|
128
|
+
ref: ${{ inputs.runtime-ref }}
|
|
129
|
+
path: .code-foundry
|
|
130
|
+
sparse-checkout: |
|
|
131
|
+
.github/actions
|
|
132
|
+
.github/scripts
|
|
133
|
+
- name: Install runtime
|
|
134
|
+
run: |
|
|
135
|
+
mkdir -p .github/actions .github/scripts
|
|
136
|
+
cp -R .code-foundry/.github/actions/. .github/actions/
|
|
137
|
+
cp -R .code-foundry/.github/scripts/. .github/scripts/
|
|
138
|
+
- name: Detect
|
|
139
|
+
id: applicability
|
|
140
|
+
run: bash .github/scripts/ci.sh should_run type_check >> "$GITHUB_OUTPUT"
|
|
141
|
+
- name: Setup
|
|
142
|
+
if: steps.applicability.outputs.applicable == 'true'
|
|
143
|
+
uses: ./.github/actions/setup
|
|
144
|
+
with:
|
|
145
|
+
install: 'true'
|
|
146
|
+
cache-build: 'true'
|
|
147
|
+
task: type_check
|
|
148
|
+
- name: Type-Check
|
|
149
|
+
if: steps.applicability.outputs.applicable == 'true'
|
|
150
|
+
run: bash .github/scripts/ci.sh type_check
|
|
151
|
+
|
|
152
|
+
build:
|
|
153
|
+
name: Build
|
|
154
|
+
runs-on: ${{ inputs.runner }}
|
|
155
|
+
steps:
|
|
156
|
+
- name: Checkout
|
|
157
|
+
uses: actions/checkout@v7
|
|
158
|
+
- name: Runtime
|
|
159
|
+
uses: actions/checkout@v7
|
|
160
|
+
with:
|
|
161
|
+
repository: ${{ inputs.runtime-repository }}
|
|
162
|
+
ref: ${{ inputs.runtime-ref }}
|
|
163
|
+
path: .code-foundry
|
|
164
|
+
sparse-checkout: |
|
|
165
|
+
.github/actions
|
|
166
|
+
.github/scripts
|
|
167
|
+
- name: Install runtime
|
|
168
|
+
run: |
|
|
169
|
+
mkdir -p .github/actions .github/scripts
|
|
170
|
+
cp -R .code-foundry/.github/actions/. .github/actions/
|
|
171
|
+
cp -R .code-foundry/.github/scripts/. .github/scripts/
|
|
172
|
+
- name: Detect
|
|
173
|
+
id: applicability
|
|
174
|
+
run: bash .github/scripts/ci.sh should_run build >> "$GITHUB_OUTPUT"
|
|
175
|
+
- name: Setup
|
|
176
|
+
if: steps.applicability.outputs.applicable == 'true'
|
|
177
|
+
uses: ./.github/actions/setup
|
|
178
|
+
with:
|
|
179
|
+
install: 'true'
|
|
180
|
+
cache-build: 'true'
|
|
181
|
+
task: build
|
|
182
|
+
- name: Build
|
|
183
|
+
if: steps.applicability.outputs.applicable == 'true'
|
|
184
|
+
run: bash .github/scripts/ci.sh build
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, staging]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [staging]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
ci:
|
|
15
|
+
name: CI
|
|
16
|
+
uses: ./.github/workflows/ci.yml
|
|
17
|
+
with:
|
|
18
|
+
runtime-repository: 0xPlayerOne/code-foundry
|
|
19
|
+
runtime-ref: v0.22.0
|
|
20
|
+
runner: ubuntu-latest
|
|
21
|
+
secrets: inherit
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
name: CodeQL
|
|
1
|
+
name: Code Foundry CodeQL
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
workflow_call:
|
|
5
|
+
inputs:
|
|
6
|
+
runtime-repository:
|
|
7
|
+
description: Repository containing the Code Foundry runtime.
|
|
8
|
+
required: false
|
|
9
|
+
type: string
|
|
10
|
+
default: 0xPlayerOne/code-foundry
|
|
11
|
+
runtime-ref:
|
|
12
|
+
description: Code Foundry runtime tag or ref.
|
|
13
|
+
required: false
|
|
14
|
+
type: string
|
|
15
|
+
default: v0.20.2
|
|
16
|
+
runner:
|
|
17
|
+
description: Runner used by CodeQL jobs.
|
|
18
|
+
required: false
|
|
19
|
+
type: string
|
|
20
|
+
default: ubuntu-latest
|
|
11
21
|
|
|
12
22
|
permissions:
|
|
13
23
|
actions: read
|
|
@@ -15,12 +25,222 @@ permissions:
|
|
|
15
25
|
packages: read
|
|
16
26
|
security-events: write
|
|
17
27
|
|
|
28
|
+
env:
|
|
29
|
+
REPO_FOUNDRY_PROFILE: ${{ vars.REPO_FOUNDRY_PROFILE }}
|
|
30
|
+
REPO_FOUNDRY_LANGUAGES: ${{ vars.REPO_FOUNDRY_LANGUAGES }}
|
|
31
|
+
REPO_FOUNDRY_FEATURES: ${{ vars.REPO_FOUNDRY_FEATURES }}
|
|
32
|
+
|
|
33
|
+
concurrency:
|
|
34
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.head.repo.full_name || github.repository }}-${{ github.event.pull_request.head.ref || github.ref_name }}
|
|
35
|
+
cancel-in-progress: true
|
|
36
|
+
|
|
18
37
|
jobs:
|
|
19
|
-
|
|
20
|
-
name:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
38
|
+
detect:
|
|
39
|
+
name: Detect
|
|
40
|
+
runs-on: ${{ inputs.runner }}
|
|
41
|
+
timeout-minutes: 10
|
|
42
|
+
outputs:
|
|
43
|
+
languages: ${{ steps.languages.outputs.languages }}
|
|
44
|
+
code_security: ${{ steps.security.outputs.status }}
|
|
45
|
+
actions_available: ${{ steps.languages.outputs.actions_available }}
|
|
46
|
+
actions_changed: ${{ steps.languages.outputs.actions_changed }}
|
|
47
|
+
actions_build_mode: ${{ steps.languages.outputs.actions_build_mode }}
|
|
48
|
+
javascript_available: ${{ steps.languages.outputs.javascript_available }}
|
|
49
|
+
javascript_changed: ${{ steps.languages.outputs.javascript_changed }}
|
|
50
|
+
javascript_build_mode: ${{ steps.languages.outputs.javascript_build_mode }}
|
|
51
|
+
python_available: ${{ steps.languages.outputs.python_available }}
|
|
52
|
+
python_changed: ${{ steps.languages.outputs.python_changed }}
|
|
53
|
+
python_build_mode: ${{ steps.languages.outputs.python_build_mode }}
|
|
54
|
+
rust_available: ${{ steps.languages.outputs.rust_available }}
|
|
55
|
+
rust_changed: ${{ steps.languages.outputs.rust_changed }}
|
|
56
|
+
rust_build_mode: ${{ steps.languages.outputs.rust_build_mode }}
|
|
57
|
+
steps:
|
|
58
|
+
- name: Detect Code Security
|
|
59
|
+
id: security
|
|
60
|
+
env:
|
|
61
|
+
GH_TOKEN: ${{ github.token }}
|
|
62
|
+
run: |
|
|
63
|
+
status="disabled"
|
|
64
|
+
if [ "${{ github.event.repository.private }}" != "true" ]; then
|
|
65
|
+
status="enabled"
|
|
66
|
+
else
|
|
67
|
+
status="$(gh api "repos/${GITHUB_REPOSITORY}" --jq '.security_and_analysis.code_security.status // "disabled"' 2>/dev/null || printf 'disabled')"
|
|
68
|
+
fi
|
|
69
|
+
printf 'status=%s\n' "$status" >> "$GITHUB_OUTPUT"
|
|
70
|
+
- name: Checkout
|
|
71
|
+
if: ${{ !github.event.repository.private || steps.security.outputs.status == 'enabled' }}
|
|
72
|
+
uses: actions/checkout@v7
|
|
73
|
+
with:
|
|
74
|
+
fetch-depth: 2
|
|
75
|
+
filter: blob:none
|
|
76
|
+
sparse-checkout: |
|
|
77
|
+
.github
|
|
78
|
+
.mise.toml
|
|
79
|
+
mise.lock
|
|
80
|
+
package.json
|
|
81
|
+
bun.lock
|
|
82
|
+
bun.lockb
|
|
83
|
+
pnpm-lock.yaml
|
|
84
|
+
yarn.lock
|
|
85
|
+
package-lock.json
|
|
86
|
+
sparse-checkout-cone-mode: false
|
|
87
|
+
- name: Runtime
|
|
88
|
+
if: ${{ !github.event.repository.private || steps.security.outputs.status == 'enabled' }}
|
|
89
|
+
uses: actions/checkout@v7
|
|
90
|
+
with:
|
|
91
|
+
repository: ${{ inputs.runtime-repository }}
|
|
92
|
+
ref: ${{ inputs.runtime-ref }}
|
|
93
|
+
path: .code-foundry
|
|
94
|
+
sparse-checkout: |
|
|
95
|
+
.github/actions
|
|
96
|
+
.github/scripts
|
|
97
|
+
- name: Install runtime
|
|
98
|
+
if: ${{ !github.event.repository.private || steps.security.outputs.status == 'enabled' }}
|
|
99
|
+
run: |
|
|
100
|
+
mkdir -p .github/actions .github/scripts
|
|
101
|
+
cp -R .code-foundry/.github/actions/. .github/actions/
|
|
102
|
+
cp -R .code-foundry/.github/scripts/. .github/scripts/
|
|
103
|
+
- id: languages
|
|
104
|
+
name: Detect languages
|
|
105
|
+
env:
|
|
106
|
+
CODEQL_BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
|
|
107
|
+
REPO_FOUNDRY_CODE_SECURITY: ${{ steps.security.outputs.status }}
|
|
108
|
+
REPO_FOUNDRY_PRIVATE: ${{ github.event.repository.private }}
|
|
109
|
+
run: |
|
|
110
|
+
if [ "$REPO_FOUNDRY_PRIVATE" = "true" ] && [ "$REPO_FOUNDRY_CODE_SECURITY" != "enabled" ]; then
|
|
111
|
+
echo 'languages=[]' >> "$GITHUB_OUTPUT"
|
|
112
|
+
else
|
|
113
|
+
bash .github/scripts/codeql-languages.sh
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
analyze-actions:
|
|
117
|
+
name: Analyze (Actions)
|
|
118
|
+
needs: detect
|
|
119
|
+
if: >-
|
|
120
|
+
( !github.event.repository.private || needs.detect.outputs.code_security == 'enabled' ) &&
|
|
121
|
+
needs.detect.outputs.actions_available == 'true' &&
|
|
122
|
+
needs.detect.outputs.actions_changed == 'true'
|
|
123
|
+
runs-on: ${{ inputs.runner }}
|
|
124
|
+
timeout-minutes: 30
|
|
125
|
+
steps:
|
|
126
|
+
- name: Checkout
|
|
127
|
+
uses: actions/checkout@v7
|
|
128
|
+
- name: Runtime
|
|
129
|
+
uses: actions/checkout@v7
|
|
130
|
+
with:
|
|
131
|
+
repository: ${{ inputs.runtime-repository }}
|
|
132
|
+
ref: ${{ inputs.runtime-ref }}
|
|
133
|
+
path: .code-foundry
|
|
134
|
+
sparse-checkout: |
|
|
135
|
+
.github/actions
|
|
136
|
+
.github/scripts
|
|
137
|
+
- name: Install runtime
|
|
138
|
+
run: |
|
|
139
|
+
mkdir -p .github/actions .github/scripts
|
|
140
|
+
cp -R .code-foundry/.github/actions/. .github/actions/
|
|
141
|
+
cp -R .code-foundry/.github/scripts/. .github/scripts/
|
|
142
|
+
- name: Analyze
|
|
143
|
+
uses: ./.github/actions/codeql
|
|
144
|
+
with:
|
|
145
|
+
language: actions
|
|
146
|
+
build-mode: ${{ needs.detect.outputs.actions_build_mode }}
|
|
147
|
+
category: /language:actions
|
|
148
|
+
|
|
149
|
+
analyze-typescript:
|
|
150
|
+
name: Analyze (TypeScript)
|
|
151
|
+
needs: detect
|
|
152
|
+
if: >-
|
|
153
|
+
( !github.event.repository.private || needs.detect.outputs.code_security == 'enabled' ) &&
|
|
154
|
+
needs.detect.outputs.javascript_available == 'true' &&
|
|
155
|
+
needs.detect.outputs.javascript_changed == 'true'
|
|
156
|
+
runs-on: ${{ inputs.runner }}
|
|
157
|
+
timeout-minutes: 30
|
|
158
|
+
steps:
|
|
159
|
+
- name: Checkout
|
|
160
|
+
uses: actions/checkout@v7
|
|
161
|
+
- name: Runtime
|
|
162
|
+
uses: actions/checkout@v7
|
|
163
|
+
with:
|
|
164
|
+
repository: ${{ inputs.runtime-repository }}
|
|
165
|
+
ref: ${{ inputs.runtime-ref }}
|
|
166
|
+
path: .code-foundry
|
|
167
|
+
sparse-checkout: |
|
|
168
|
+
.github/actions
|
|
169
|
+
.github/scripts
|
|
170
|
+
- name: Install runtime
|
|
171
|
+
run: |
|
|
172
|
+
mkdir -p .github/actions .github/scripts
|
|
173
|
+
cp -R .code-foundry/.github/actions/. .github/actions/
|
|
174
|
+
cp -R .code-foundry/.github/scripts/. .github/scripts/
|
|
175
|
+
- name: Analyze
|
|
176
|
+
uses: ./.github/actions/codeql
|
|
177
|
+
with:
|
|
178
|
+
language: javascript-typescript
|
|
179
|
+
build-mode: ${{ needs.detect.outputs.javascript_build_mode }}
|
|
180
|
+
category: /language:javascript-typescript
|
|
181
|
+
|
|
182
|
+
analyze-python:
|
|
183
|
+
name: Analyze (Python)
|
|
184
|
+
needs: detect
|
|
185
|
+
if: >-
|
|
186
|
+
( !github.event.repository.private || needs.detect.outputs.code_security == 'enabled' ) &&
|
|
187
|
+
needs.detect.outputs.python_available == 'true' &&
|
|
188
|
+
needs.detect.outputs.python_changed == 'true'
|
|
189
|
+
runs-on: ${{ inputs.runner }}
|
|
190
|
+
timeout-minutes: 30
|
|
191
|
+
steps:
|
|
192
|
+
- name: Checkout
|
|
193
|
+
uses: actions/checkout@v7
|
|
194
|
+
- name: Runtime
|
|
195
|
+
uses: actions/checkout@v7
|
|
196
|
+
with:
|
|
197
|
+
repository: ${{ inputs.runtime-repository }}
|
|
198
|
+
ref: ${{ inputs.runtime-ref }}
|
|
199
|
+
path: .code-foundry
|
|
200
|
+
sparse-checkout: |
|
|
201
|
+
.github/actions
|
|
202
|
+
.github/scripts
|
|
203
|
+
- name: Install runtime
|
|
204
|
+
run: |
|
|
205
|
+
mkdir -p .github/actions .github/scripts
|
|
206
|
+
cp -R .code-foundry/.github/actions/. .github/actions/
|
|
207
|
+
cp -R .code-foundry/.github/scripts/. .github/scripts/
|
|
208
|
+
- name: Analyze
|
|
209
|
+
uses: ./.github/actions/codeql
|
|
210
|
+
with:
|
|
211
|
+
language: python
|
|
212
|
+
build-mode: ${{ needs.detect.outputs.python_build_mode }}
|
|
213
|
+
category: /language:python
|
|
214
|
+
|
|
215
|
+
analyze-rust:
|
|
216
|
+
name: Analyze (Rust)
|
|
217
|
+
needs: detect
|
|
218
|
+
if: >-
|
|
219
|
+
( !github.event.repository.private || needs.detect.outputs.code_security == 'enabled' ) &&
|
|
220
|
+
needs.detect.outputs.rust_available == 'true' &&
|
|
221
|
+
needs.detect.outputs.rust_changed == 'true'
|
|
222
|
+
runs-on: ${{ inputs.runner }}
|
|
223
|
+
timeout-minutes: 30
|
|
224
|
+
steps:
|
|
225
|
+
- name: Checkout
|
|
226
|
+
uses: actions/checkout@v7
|
|
227
|
+
- name: Runtime
|
|
228
|
+
uses: actions/checkout@v7
|
|
229
|
+
with:
|
|
230
|
+
repository: ${{ inputs.runtime-repository }}
|
|
231
|
+
ref: ${{ inputs.runtime-ref }}
|
|
232
|
+
path: .code-foundry
|
|
233
|
+
sparse-checkout: |
|
|
234
|
+
.github/actions
|
|
235
|
+
.github/scripts
|
|
236
|
+
- name: Install runtime
|
|
237
|
+
run: |
|
|
238
|
+
mkdir -p .github/actions .github/scripts
|
|
239
|
+
cp -R .code-foundry/.github/actions/. .github/actions/
|
|
240
|
+
cp -R .code-foundry/.github/scripts/. .github/scripts/
|
|
241
|
+
- name: Analyze
|
|
242
|
+
uses: ./.github/actions/codeql
|
|
243
|
+
with:
|
|
244
|
+
language: rust
|
|
245
|
+
build-mode: ${{ needs.detect.outputs.rust_build_mode }}
|
|
246
|
+
category: /language:rust
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: CodeQL
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, staging]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [staging]
|
|
8
|
+
schedule:
|
|
9
|
+
- cron: '31 6 * * 1'
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
actions: read
|
|
14
|
+
contents: read
|
|
15
|
+
packages: read
|
|
16
|
+
security-events: write
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
codeql:
|
|
20
|
+
name: CodeQL
|
|
21
|
+
uses: ./.github/workflows/codeql.yml
|
|
22
|
+
with:
|
|
23
|
+
runtime-repository: 0xPlayerOne/code-foundry
|
|
24
|
+
runtime-ref: v0.22.0
|
|
25
|
+
runner: ubuntu-latest
|
|
26
|
+
secrets: inherit
|