Skip to content

Typescript

Typescript #248

Workflow file for this run

# Workflow used as Continous Integration every time we have a PR.
name: Typescript
on:
# Only build when pushed to main
push:
branches:
- main
paths:
- 'packages/**'
- 'package.json'
# Build all pull requests
pull_request:
branches:
- main
paths:
- 'packages/**'
- 'package.json'
schedule:
- cron: '36 7 * * 0'
# TODO: Determine is this the safe permission. We probably don't want to allow all.
permissions: write-all
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: latest
- name: Setup Node
uses: actions/setup-node@v4
with:
registry-url: 'https://npm.pkg.github.com'
scope: '@saferplace'
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
env:
# Generate a new Classic PAT
# - scopes: read:packages
# NODE_AUTH_TOKEN: ${{ secrets.GH_NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ github.token }}
- name: Lint
continue-on-error: true
run: pnpm run ci:lint
- name: Annotate Linting Results
uses: ataylorme/[email protected]
with:
repo-token: "${{ github.token }}"
report-json: eslint_report.json
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false # Allow completion of the task if another package fails.
matrix:
# TODO: can this be a shared variable?
workspace:
- pwa
- review-ui
include:
- workspace: pwa
deploy: true
cloudflareProjectName: saferplace-app
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check Affected Workspaces
id: changes
uses: dorny/[email protected]
with:
filters: |
affected:
- packages/${{ matrix.workspace }}/**
- name: Skipping Workspace
if: steps.changes.outputs.affected == 'false'
run: echo "Skipping ${{ matrix.workspace }} as it has not changed"
- name: Setup pnpm
if: steps.changes.outputs.affected == 'true'
uses: pnpm/action-setup@v3
with:
version: latest
- name: Setup Node
if: steps.changes.outputs.affected == 'true'
uses: actions/setup-node@v4
with:
registry-url: 'https://npm.pkg.github.com'
scope: '@saferplace'
cache: pnpm
- name: Install Dependencies
if: steps.changes.outputs.affected == 'true'
run: pnpm install --frozen-lockfile
env:
# Generate a new Classic PAT
# - scopes: read:packages
# NODE_AUTH_TOKEN: ${{ secrets.GH_NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ github.token }}
- name: Build
if: steps.changes.outputs.affected == 'true'
working-directory: packages/${{ matrix.workspace }}
run: pnpm run build
- name: Deploy
if: matrix.deploy && steps.changes.outputs.affected == 'true'
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
projectName: ${{ matrix.cloudflareProjectName }}
accountId: 77fe99c5bfc86a6c12a8092954daec44
directory: packages/${{ matrix.workspace }}/dist
gitHubToken: ${{ github.token }}
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ubuntu-latest
timeout-minutes: 360
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: 'javascript'
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:javascript"