forked from MiniMax-AI/minimax-code
-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (137 loc) · 5.8 KB
/
Copy pathsource-candidate.yml
File metadata and controls
137 lines (137 loc) · 5.8 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Source candidate
on:
workflow_dispatch:
workflow_call:
inputs:
revision:
type: string
required: true
env:
MCODE_CANDIDATE_REVISION: ${{ inputs.revision || github.sha }}
concurrency:
group: ${{ github.workflow }}-${{ inputs.revision || github.sha }}
cancel-in-progress: false
permissions:
contents: read
jobs:
export:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ env.MCODE_CANDIDATE_REVISION }}
fetch-depth: 0
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "24"
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Export committed source
shell: bash
run: |
mkdir "$RUNNER_TEMP/candidate"
node scripts/export-source-preview.mjs --out "$RUNNER_TEMP/candidate/minimax-code-source.tar.gz"
node scripts/source-candidate.mjs unpack --archive "$RUNNER_TEMP/candidate/minimax-code-source.tar.gz" --revision "$REVISION" --destination "$RUNNER_TEMP/source-audit"
env:
REVISION: ${{ env.MCODE_CANDIDATE_REVISION }}
- uses: ./.github/actions/setup-gitleaks
- name: Scan history and the exact exported source
shell: bash
run: |
gitleaks git --redact --config .gitleaks.toml --log-opts=--all
gitleaks dir "$RUNNER_TEMP/source-audit" --redact --config .gitleaks.toml
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: unverified-source-${{ env.MCODE_CANDIDATE_REVISION }}
path: ${{ runner.temp }}/candidate/
retention-days: 1
overwrite: true
if-no-files-found: error
validate:
needs: export
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
# Windows validation is temporarily paused until its checks are reliable.
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ env.MCODE_CANDIDATE_REVISION }}
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "24"
cache: pnpm
- run: pnpm install --frozen-lockfile
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: unverified-source-${{ env.MCODE_CANDIDATE_REVISION }}
path: ${{ runner.temp }}/candidate
- name: Authenticate and unpack into a fresh directory
shell: bash
run: node scripts/source-candidate.mjs unpack --archive "$RUNNER_TEMP/candidate/minimax-code-source.tar.gz" --revision "$REVISION" --destination "$RUNNER_TEMP/candidate-source"
env:
REVISION: ${{ env.MCODE_CANDIDATE_REVISION }}
- name: Cold install from the exported source
working-directory: ${{ runner.temp }}/candidate-source/minimax-code
shell: bash
run: pnpm install --frozen-lockfile --store-dir "$RUNNER_TEMP/candidate-store" --registry https://registry.npmjs.org/
- name: Verify the exported source
working-directory: ${{ runner.temp }}/candidate-source/minimax-code
run: pnpm verify --profile archive
env:
MCODE_VERIFY_REPORT_DIR: ${{ runner.temp }}/candidate-report
MCODE_VERIFY_REVISION: ${{ env.MCODE_CANDIDATE_REVISION }}
- uses: ./.github/actions/setup-gitleaks
if: runner.os == 'Linux'
- name: Scan the candidate Linux distribution
if: runner.os == 'Linux'
shell: bash
run: gitleaks dir "$RUNNER_TEMP/candidate-source/minimax-code/dist" --redact --config .gitleaks.toml
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
if: ${{ always() }}
timeout-minutes: 2
with:
name: candidate-validation-${{ matrix.os }}
path: ${{ runner.temp }}/candidate-report/
retention-days: 14
overwrite: true
publish:
needs: [export, validate]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ env.MCODE_CANDIDATE_REVISION }}
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "24"
cache: pnpm
- run: pnpm install --frozen-lockfile
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: unverified-source-${{ env.MCODE_CANDIDATE_REVISION }}
path: ${{ runner.temp }}/candidate
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
pattern: candidate-validation-*
path: ${{ runner.temp }}/candidate/reports
- name: Require matching Linux and macOS validation reports
shell: bash
run: node scripts/source-candidate.mjs finalize --archive "$RUNNER_TEMP/candidate/minimax-code-source.tar.gz" --revision "$REVISION" --reports "$RUNNER_TEMP/candidate/reports"
env:
REVISION: ${{ env.MCODE_CANDIDATE_REVISION }}
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: source-candidate-${{ env.MCODE_CANDIDATE_REVISION }}
path: ${{ runner.temp }}/candidate/
retention-days: 14
overwrite: true
if-no-files-found: error