Unreverts #235 and don't automatically install wrangler when checking if it present #310
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Wrangler Action Self Testing | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
wrangler_action_self_testing: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "latest" | |
cache: "npm" | |
- name: Install modules and build | |
run: npm ci && npm run build | |
- name: Unit Tests | |
run: npm run test | |
- name: Check Formatting | |
run: npm run check | |
- name: Only build app | |
uses: ./ | |
with: | |
workingDirectory: "./test/only-build" | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: deploy --dry-run | |
- name: Only build app w/ quiet enabled | |
uses: ./ | |
with: | |
quiet: true | |
workingDirectory: "./test/build-quiet" | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: deploy --dry-run | |
- name: Environment support | |
uses: ./ | |
with: | |
workingDirectory: "./test/environment" | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
environment: dev | |
preCommands: npx wrangler deploy --env dev # https://github.com/cloudflare/wrangler-action/issues/162 | |
postCommands: npx wrangler delete --name wrangler-action-dev-environment-test --force | |
secrets: | | |
SECRET1 | |
SECRET2 | |
env: | |
SECRET1: ${{ secrets.SECRET1 }} | |
SECRET2: ${{ secrets.SECRET2 }} | |
# 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/secrets-v2" | |
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 wrangler-action-test-secrets-v2 | |
shell: bash | |
- name: Deploy app secrets w/ default version | |
uses: ./ | |
with: | |
workingDirectory: "./test/secrets-default" | |
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 wrangler-action-test-secrets-default | |
shell: bash | |
- name: Clean Up Deployed Workers | |
uses: ./ | |
with: | |
workingDirectory: "./test/secrets-default" | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: delete --name wrangler-action-test-secrets-v2 --force | |
postCommands: npx wrangler delete --name wrangler-action-test-secrets-default --force | |
# END Setup and teardown of Workers w/ Secrets Tests | |
- name: Support packageManager variable | |
uses: ./ | |
with: | |
workingDirectory: "./test/specify-package-manager" | |
packageManager: "npm" | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: deploy --dry-run | |
- name: Support unspecified packageManager with no lockfile | |
uses: ./ | |
with: | |
workingDirectory: "./test/unspecified-package-manager" | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: deploy --dry-run | |
- name: Support npm package manager | |
uses: ./ | |
with: | |
workingDirectory: "./test/npm" | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: deploy --dry-run | |
- name: Install yarn | |
run: npm i -g yarn | |
- name: Support yarn package manager | |
uses: ./ | |
with: | |
workingDirectory: "./test/yarn" | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: deploy --dry-run | |
- name: Install pnpm | |
run: npm i -g pnpm | |
- name: Support pnpm package manager | |
uses: ./ | |
with: | |
workingDirectory: "./test/pnpm" | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: deploy --dry-run | |
- 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" | |
command: action-test |