Skip to content

Commit f5b580c

Browse files
authored
Merge branch 'master' into bot/fix-usetable-isready-stale
2 parents 671c1b6 + 61be6e6 commit f5b580c

132 files changed

Lines changed: 6071 additions & 935 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/check-merge-labels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Check merge labels
22

33
on:
44
pull_request:
5-
types: [opened, reopened, labeled, unlabeled]
5+
types: [opened, reopened, synchronize, labeled, unlabeled]
66
merge_group:
77

88
permissions: read-all

.github/workflows/package.yml

Lines changed: 41 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ permissions:
1111

1212
jobs:
1313
build-cli:
14-
if: ${{ !(startsWith(github.ref, 'refs/tags/') && matrix.target == 'x86_64-pc-windows-msvc') }}
1514
strategy:
1615
fail-fast: false
1716
matrix:
@@ -51,81 +50,45 @@ jobs:
5150
- name: Install rust target
5251
run: rustup target add ${{ matrix.target }}
5352

54-
- name: Compile
55-
run: |
56-
cargo build --release --target ${{ matrix.target }} -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
57-
58-
- name: Package (unix)
59-
if: ${{ runner.os != 'Windows' }}
60-
shell: bash
61-
run: |
62-
mkdir build
63-
cd target/${{matrix.target}}/release
64-
cp spacetimedb-update ../../../build/spacetimedb-update-${{matrix.target}}
65-
tar -czf ../../../build/spacetime-${{matrix.target}}.tar.gz spacetimedb-{cli,standalone}
66-
67-
- name: Package (windows)
53+
- name: Add signtool.exe to PATH
6854
if: ${{ runner.os == 'Windows' }}
69-
shell: bash
55+
shell: pwsh
7056
run: |
71-
mkdir build
72-
cd target/${{matrix.target}}/release
73-
cp spacetimedb-update.exe ../../../build/spacetimedb-update-${{matrix.target}}.exe
74-
7z a ../../../build/spacetime-${{matrix.target}}.zip spacetimedb-cli.exe spacetimedb-standalone.exe
75-
76-
- name: Extract branch name
77-
shell: bash
78-
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
79-
id: extract_branch
80-
81-
- name: Upload to DO Spaces
82-
uses: shallwefootball/s3-upload-action@master
83-
with:
84-
aws_key_id: ${{ secrets.AWS_KEY_ID }}
85-
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
86-
aws_bucket: ${{ vars.AWS_BUCKET }}
87-
source_dir: build
88-
endpoint: https://nyc3.digitaloceanspaces.com
89-
destination_dir: ${{ steps.extract_branch.outputs.branch }}
90-
91-
build-cli-windows-signed:
92-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
93-
name: Build and sign CLI for x86_64 Windows
94-
runs-on: [self-hosted, windows, signing]
95-
environment: codesign
96-
concurrency:
97-
group: codesign-${{ github.ref }}
98-
cancel-in-progress: false
99-
100-
steps:
101-
- name: Checkout
102-
uses: actions/checkout@v3
103-
104-
- name: Install Rust
105-
uses: dsherret/rust-toolchain-file@v1
57+
$root = "${env:ProgramFiles(x86)}\Windows Kits\10\bin"
58+
$signtool = Get-ChildItem $root -Recurse -Filter signtool.exe -ErrorAction SilentlyContinue |
59+
Where-Object { $_.FullName -match '\\x64\\signtool\.exe$' } |
60+
Sort-Object FullName -Descending |
61+
Select-Object -First 1
10662
107-
- name: Install rust target
108-
run: rustup target add x86_64-pc-windows-msvc
63+
if (-not $signtool) { throw "signtool.exe not found under $root" }
10964
110-
- name: Compile
111-
run: |
112-
cargo build --release --target x86_64-pc-windows-msvc -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
65+
"Found: $($signtool.FullName)"
66+
$dir = Split-Path $signtool.FullName
67+
Add-Content -Path $env:GITHUB_PATH -Value $dir
11368
114-
- name: Write certificate file
69+
- name: Write certificate file for signing
70+
if: ${{ runner.os == 'Windows' }}
11571
shell: powershell
11672
env:
11773
DIGICERT_CERT_B64: ${{ secrets.DIGICERT_CERT_B64 }}
11874
run: |
119-
[IO.File]::WriteAllBytes("digicert.crt", [Convert]::FromBase64String($env:DIGICERT_CERT_B64))
75+
[IO.File]::WriteAllBytes("digicert.pfx", [Convert]::FromBase64String($env:DIGICERT_CERT_B64))
12076
121-
- name: Sign binaries
77+
- name: Compile
78+
run: |
79+
cargo build --release --target ${{ matrix.target }} -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
80+
81+
- name: Sign binaries for Windows
82+
# Disabled for now since the current flow isn't working.
83+
if: false
84+
#if: ${{ runner.os == 'Windows' }}
12285
shell: powershell
12386
env:
12487
DIGICERT_KEYPAIR_ALIAS: ${{ secrets.DIGICERT_KEYPAIR_ALIAS }}
12588
run: |
12689
$ErrorActionPreference = 'Stop'
12790
$targetDir = Join-Path $env:GITHUB_WORKSPACE 'target\x86_64-pc-windows-msvc\release'
128-
$certFile = Join-Path $env:GITHUB_WORKSPACE 'digicert.crt'
91+
$certFile = Join-Path $env:GITHUB_WORKSPACE 'digicert.pfx'
12992
13093
$signtool = Get-Command signtool.exe -ErrorAction Stop
13194
@@ -136,32 +99,31 @@ jobs:
13699
)
137100
138101
foreach ($file in $files) {
139-
& $signtool.Path sign /csp "DigiCert Signing Manager KSP" /kc $env:DIGICERT_KEYPAIR_ALIAS /f $certFile /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $file
102+
& $signtool.Path sign /f $certFile /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $file
140103
& $signtool.Path verify /v /pa $file
141104
}
142105
143-
- name: Package (windows)
144-
shell: powershell
106+
- name: Package (unix)
107+
if: ${{ runner.os != 'Windows' }}
108+
shell: bash
145109
run: |
146-
$ErrorActionPreference = 'Stop'
147-
New-Item -ItemType Directory -Force -Path build | Out-Null
148-
$releaseDir = Join-Path $env:GITHUB_WORKSPACE 'target\x86_64-pc-windows-msvc\release'
110+
mkdir build
111+
cd target/${{matrix.target}}/release
112+
cp spacetimedb-update ../../../build/spacetimedb-update-${{matrix.target}}
113+
tar -czf ../../../build/spacetime-${{matrix.target}}.tar.gz spacetimedb-{cli,standalone}
149114
150-
Copy-Item (Join-Path $releaseDir 'spacetimedb-update.exe') (Join-Path $env:GITHUB_WORKSPACE 'build\spacetimedb-update-x86_64-pc-windows-msvc.exe')
151-
Compress-Archive -Force -Path @(
152-
(Join-Path $releaseDir 'spacetimedb-cli.exe'),
153-
(Join-Path $releaseDir 'spacetimedb-standalone.exe')
154-
) -DestinationPath (Join-Path $env:GITHUB_WORKSPACE 'build\spacetime-x86_64-pc-windows-msvc.zip')
115+
- name: Package (windows)
116+
if: ${{ runner.os == 'Windows' }}
117+
shell: bash
118+
run: |
119+
mkdir build
120+
cd target/${{matrix.target}}/release
121+
cp spacetimedb-update.exe ../../../build/spacetimedb-update-${{matrix.target}}.exe
122+
7z a ../../../build/spacetime-${{matrix.target}}.zip spacetimedb-cli.exe spacetimedb-standalone.exe
155123
156124
- name: Extract branch name
157-
shell: powershell
158-
run: |
159-
$ErrorActionPreference = 'Stop'
160-
$branch = $env:GITHUB_HEAD_REF
161-
if ([string]::IsNullOrEmpty($branch)) {
162-
$branch = $env:GITHUB_REF -replace '^refs/heads/', ''
163-
}
164-
"branch=$branch" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
125+
shell: bash
126+
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
165127
id: extract_branch
166128

167129
- name: Upload to DO Spaces

.github/workflows/pr_approval_check.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
name: Review Checks
22

3+
# SECURITY: This workflow uses pull_request_target so that it has write access to
4+
# set commit statuses on external (fork) PRs. pull_request_target runs in the
5+
# context of the base branch, which grants the GITHUB_TOKEN write permissions
6+
# that a regular pull_request event on a fork would not have.
7+
#
8+
# IMPORTANT: This workflow must NEVER check out, build, or execute code from the
9+
# PR branch. Doing so would allow a malicious fork to run arbitrary code with
10+
# write access to the repository. This workflow only reads PR metadata via the
11+
# GitHub API, which is safe.
12+
313
on:
4-
pull_request:
14+
pull_request_target:
515
types: [opened, synchronize, reopened]
616
pull_request_review:
717
types: [submitted, dismissed]
@@ -21,6 +31,7 @@ jobs:
2131
name: Set approval status
2232
runs-on: ubuntu-latest
2333

34+
# SECURITY: Do not add a checkout step to this job. See comment at the top of this file.
2435
steps:
2536
- name: Evaluate and publish approval status
2637
uses: actions/github-script@v7
@@ -41,7 +52,10 @@ jobs:
4152
const pr = context.payload.pull_request;
4253
targetSha = pr.head.sha;
4354
44-
if (pr.user.login !== "clockwork-labs-bot") {
55+
if (pr.head.repo.fork) {
56+
state = "success";
57+
description = "Skipped for external PR";
58+
} else if (pr.user.login !== "clockwork-labs-bot") {
4559
state = "success";
4660
description = "PR author is not clockwork-labs-bot";
4761
} else {

0 commit comments

Comments
 (0)