Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/js.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,62 @@ jobs:
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
AZURE_OPENAI_API_VERSION: ${{ secrets.AZURE_OPENAI_API_VERSION }}

cloudflare-worker-media:
runs-on: ubuntu-latest
needs: build
steps:
- name: Check Cloudflare credentials
id: cloudflare
env:
TEST_CLOUDFLARE_ACCOUNT_ID: ${{ secrets.TEST_CLOUDFLARE_ACCOUNT_ID }}
TEST_CLOUDFLARE_API_TOKEN: ${{ secrets.TEST_CLOUDFLARE_API_TOKEN }}
EVENT_NAME: ${{ github.event_name }}
HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
REPOSITORY: ${{ github.repository }}
run: |
if [ "$EVENT_NAME" = "pull_request" ] && [ "$HEAD_REPOSITORY" != "$REPOSITORY" ]; then
echo "run=false" >> "$GITHUB_OUTPUT"
echo "::notice::Skipping remote Cloudflare Worker media test for fork pull request"
exit 0
fi
if [ -z "${TEST_CLOUDFLARE_API_TOKEN:-}" ] || [ -z "${TEST_CLOUDFLARE_ACCOUNT_ID:-}" ]; then
echo "run=false" >> "$GITHUB_OUTPUT"
echo "::notice::Skipping remote Cloudflare Worker media test because Cloudflare secrets are unavailable"
exit 0
fi
echo "run=true" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
if: steps.cloudflare.outputs.run == 'true'
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
if: steps.cloudflare.outputs.run == 'true'
with:
node-version: 24
registry-url: "https://registry.npmjs.org"
- name: Setup pnpm
if: steps.cloudflare.outputs.run == 'true'
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.33.0
cache: true
- name: Get pnpm store directory
if: steps.cloudflare.outputs.run == 'true'
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
if: steps.cloudflare.outputs.run == 'true'
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
if: steps.cloudflare.outputs.run == 'true'
run: pnpm install --frozen-lockfile
- name: Run remote Cloudflare Worker media test
if: steps.cloudflare.outputs.run == 'true'
working-directory: packages/proxy
run: pnpm run test:cloudflare-worker
env:
TEST_CLOUDFLARE_ACCOUNT_ID: ${{ secrets.TEST_CLOUDFLARE_ACCOUNT_ID }}
TEST_CLOUDFLARE_API_TOKEN: ${{ secrets.TEST_CLOUDFLARE_API_TOKEN }}
4 changes: 3 additions & 1 deletion packages/proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"build": "tsup",
"watch": "tsup --watch",
"clean": "rm -r dist/*",
"test": "vitest run"
"test": "vitest run",
"test:cloudflare-worker": "tsx scripts/cloudflare_worker_media_test.ts"
Comment thread
ibolmo marked this conversation as resolved.
},
"exports": {
"./package.json": "./package.json",
Expand Down Expand Up @@ -99,6 +100,7 @@
"msw": "^2.8.2",
"openapi-zod-client": "^1.18.3",
"tsup": "^8.5.1",
"tsx": "^4.8.1",
"typescript": "5.5.4",
"vite": "7.3.2",
"vite-tsconfig-paths": "^6.1.1",
Expand Down
Loading
Loading