2023-08-01 21:31:45 +02:00
|
|
|
name: Wrangler Action Self Testing
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
2019-11-22 17:27:40 +01:00
|
|
|
|
|
|
|
jobs:
|
2023-08-01 21:31:45 +02:00
|
|
|
wrangler_action_self_testing:
|
2019-11-22 17:27:40 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-08-01 21:31:45 +02:00
|
|
|
- name: Checkout Repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Setup Node.js
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: "latest"
|
|
|
|
cache: "npm"
|
|
|
|
|
2023-08-08 20:03:11 +02:00
|
|
|
- name: Install modules and build
|
|
|
|
run: npm ci && npm run build
|
2023-08-01 21:31:45 +02:00
|
|
|
|
|
|
|
- name: Unit Tests
|
|
|
|
run: npm run test
|
|
|
|
|
|
|
|
- name: Check Formatting
|
|
|
|
run: npm run check
|
|
|
|
|
|
|
|
- name: Only build app
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
workingDirectory: "./test/base"
|
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
command: deploy --dry-run
|
|
|
|
|
2023-08-11 22:36:20 +02:00
|
|
|
- name: Only build app w/ quiet enabled
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
quiet: true
|
|
|
|
workingDirectory: "./test/base"
|
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
command: deploy --dry-run
|
|
|
|
|
2023-08-01 21:31:45 +02:00
|
|
|
# START Setup and teardown of Worker Environment Tests
|
|
|
|
- name: Environment support
|
2020-08-12 05:46:42 +02:00
|
|
|
uses: ./
|
|
|
|
with:
|
2023-08-01 21:31:45 +02:00
|
|
|
workingDirectory: "./test/environment"
|
2020-08-12 05:46:42 +02:00
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
2023-08-01 21:31:45 +02:00
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
environment: dev
|
2023-08-30 02:39:50 +02:00
|
|
|
preCommands: npx wrangler deploy --env dev # https://github.com/cloudflare/wrangler-action/issues/162
|
2020-08-12 05:46:42 +02:00
|
|
|
secrets: |
|
|
|
|
SECRET1
|
|
|
|
SECRET2
|
|
|
|
env:
|
|
|
|
SECRET1: ${{ secrets.SECRET1 }}
|
|
|
|
SECRET2: ${{ secrets.SECRET2 }}
|
2023-08-01 21:31:45 +02:00
|
|
|
|
|
|
|
- name: Clean up Deployed Environment Worker
|
2020-06-22 17:02:00 +02:00
|
|
|
uses: ./
|
|
|
|
with:
|
2023-08-01 21:31:45 +02:00
|
|
|
workingDirectory: "./test/base"
|
2020-06-22 17:02:00 +02:00
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
2023-08-01 21:31:45 +02:00
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
command: delete --name wrangler-action-dev-environment-test --force
|
|
|
|
|
|
|
|
# END Setup and teardown of Worker Environment Tests
|
|
|
|
# START Setup and teardown of Workers w/ Secrets Tests
|
|
|
|
- name: Deploy app secrets w/ hardcoded Wrangler v2
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
wranglerVersion: "2.20.0"
|
|
|
|
workingDirectory: "./test/base"
|
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
2020-06-22 17:02:00 +02:00
|
|
|
secrets: |
|
|
|
|
SECRET1
|
|
|
|
SECRET2
|
|
|
|
env:
|
|
|
|
SECRET1: ${{ secrets.SECRET1 }}
|
2023-08-01 21:31:45 +02:00
|
|
|
SECRET2: ${{ secrets.SECRET2 }}
|
|
|
|
|
|
|
|
- name: Health Check Deployed Worker
|
|
|
|
run: node .github/workflows/workerHealthCheck.cjs
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Deploy app secrets w/ default version
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
workingDirectory: "./test/base"
|
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
secrets: |
|
|
|
|
SECRET1
|
|
|
|
SECRET2
|
|
|
|
env:
|
|
|
|
SECRET1: ${{ secrets.SECRET1 }}
|
|
|
|
SECRET2: ${{ secrets.SECRET2 }}
|
|
|
|
|
|
|
|
- name: Health Check Deployed Worker
|
|
|
|
run: node .github/workflows/workerHealthCheck.cjs
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Clean Up Deployed Workers
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
workingDirectory: "./test/base"
|
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
command: delete --name wrangler-action-test --force
|
2023-09-01 23:43:35 +02:00
|
|
|
# END Setup and teardown of Workers w/ Secrets Tests
|
|
|
|
|
|
|
|
- name: Support packageManager variable
|
|
|
|
uses: ./
|
|
|
|
with:
|
2023-09-01 23:49:03 +02:00
|
|
|
workingDirectory: "./test/empty"
|
2023-09-01 23:43:35 +02:00
|
|
|
packageManager: "npm"
|
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
2023-10-10 00:20:09 +02:00
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
command: deploy --dry-run
|
|
|
|
|
|
|
|
- name: Support unspecified packageManager with no lockfile
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
workingDirectory: "./test/empty"
|
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
2023-09-01 23:43:35 +02:00
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
command: deploy --dry-run
|
|
|
|
|
|
|
|
- name: Support npm package manager
|
|
|
|
uses: ./
|
|
|
|
with:
|
2023-09-01 23:49:03 +02:00
|
|
|
workingDirectory: "./test/npm"
|
2023-09-01 23:43:35 +02:00
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
command: deploy --dry-run
|
|
|
|
|
2023-09-18 20:51:27 +02:00
|
|
|
- name: Install yarn
|
|
|
|
run: npm i -g yarn
|
|
|
|
|
2023-09-01 23:43:35 +02:00
|
|
|
- name: Support yarn package manager
|
|
|
|
uses: ./
|
|
|
|
with:
|
2023-09-01 23:49:03 +02:00
|
|
|
workingDirectory: "./test/yarn"
|
2023-09-01 23:43:35 +02:00
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
command: deploy --dry-run
|
|
|
|
|
2023-09-18 20:51:27 +02:00
|
|
|
- name: Install pnpm
|
|
|
|
run: npm i -g pnpm
|
|
|
|
|
2023-09-01 23:43:35 +02:00
|
|
|
- name: Support pnpm package manager
|
|
|
|
uses: ./
|
|
|
|
with:
|
2023-09-01 23:49:03 +02:00
|
|
|
workingDirectory: "./test/pnpm"
|
2023-09-01 23:43:35 +02:00
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
command: deploy --dry-run
|
2024-02-09 12:34:42 +01:00
|
|
|
|
|
|
|
- name: Change directory to pre-installed-wrangler and install dependencies
|
|
|
|
run: |
|
|
|
|
cd ./test/pre-installed-wrangler
|
|
|
|
npm install
|
|
|
|
|
|
|
|
- name: Support pre-installed wrangler
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
workingDirectory: "./test/pre-installed-wrangler"
|
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
command: deploy --dry-run
|