introduce indirection to be able to mock UrlFetchApp methods #322
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: 'Tests' | |
on: | |
workflow_dispatch: | |
push: | |
schedule: | |
- cron: "0 0 * * 0" | |
permissions: | |
actions: none | |
checks: none | |
contents: read | |
deployments: none | |
issues: none | |
packages: none | |
pull-requests: none | |
repository-projects: none | |
security-events: none | |
statuses: none | |
# This allows a subsequently queued workflow run to interrupt previous runs | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.10.x | |
cache: npm | |
- name: Install | |
run: npm ci | |
- name: Clasp Project | |
run: echo "$CLASP_PROJECT" > ./.clasp.json | |
env: | |
CLASP_PROJECT: ${{ secrets.CLASP_PROJECT }} | |
- name: Creds | |
run: echo "$CLASP_CREDENTIALS" > ~/.clasprc.json | |
env: | |
CLASP_CREDENTIALS: ${{ secrets.CLASP_CREDENTIALS }} | |
- name: Creds (local) | |
run: echo "$CLASP_CREDENTIALS_LOCAL" > .clasprc.json | |
env: | |
CLASP_CREDENTIALS_LOCAL: ${{ secrets.CLASP_CREDENTIALS_LOCAL }} | |
- name: Check clasp login status | |
run: npm run clasp -- login --status | |
- name: Update secrets if changed by clasp | |
run: npm run update-secrets-in-ci | |
env: | |
REPO_TOKEN: ${{ secrets.REPO_TOKEN }} | |
CLASP_CREDENTIALS: ${{ secrets.CLASP_CREDENTIALS }} | |
CLASP_CREDENTIALS_LOCAL: ${{ secrets.CLASP_CREDENTIALS_LOCAL }} | |
- name: Prepare | |
run: | | |
mkdir -p ./tests/utilities/mwp-localtunnel-client | |
curl "https://gist.githubusercontent.com/$MWP_LOCALTUNNEL_CLIENT_URL_PATH" > ./tests/utilities/mwp-localtunnel-client/index.js | |
env: | |
MWP_LOCALTUNNEL_CLIENT_URL_PATH: ${{ secrets.MWP_LOCALTUNNEL_CLIENT_URL_PATH }} | |
- name: Test | |
run: npm test | |
env: | |
USE_LOCALTUNNEL: ${{ secrets.USE_LOCALTUNNEL }} | |
- name: Archive test artifacts (actual) | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: test-output-actual | |
path: tests/appscript/actual |