Skip to content

chore(deps): update mtfoley/pr-compliance-action digest to 11b664f (#23) #77

chore(deps): update mtfoley/pr-compliance-action digest to 11b664f (#23)

chore(deps): update mtfoley/pr-compliance-action digest to 11b664f (#23) #77

Workflow file for this run

name: Test External
on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
workflow_dispatch:
inputs:
moduleSet:
description: 'Module set'
required: true
default: 'nonCompliant'
type: choice
options:
- compliant
- nonCompliant
tsVersion:
description: 'Use TS version'
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
read_external_projects:
name: Read list of ${{ github.event.inputs.moduleSet || 'compliant' }} external projects
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: echo "matrix=$(cat workflow-external.json | jq -c '.${{ github.event.inputs.moduleSet || 'compliant' }}')" >> $GITHUB_OUTPUT
test_external:
needs: read_external_projects
name: Test ${{ matrix.project }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node_version: [lts/*]
project: ${{ fromJson(needs.read_external_projects.outputs.matrix) }}
steps:
- name: Checkout main project
uses: actions/checkout@v4
with:
path: main
- name: Checkout ${{ matrix.project }}
uses: actions/checkout@v4
with:
repository: ${{ matrix.project }}
path: project
- name: ensure project is still using this config
run: cat tsconfig.json| grep \"@voxpelli/tsconfig
working-directory: ./project
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
- name: install main
run: '[ -f package-lock.json ] && npm ci --ignore-scripts --force || npm install --ignore-scripts --force'
working-directory: ./main
- name: install project
run: '[ -f package-lock.json ] && npm ci --ignore-scripts --force || npm install --ignore-scripts --force'
working-directory: ./project
- name: Get source TS version
id: source-ts
run: echo "TS_VERSION=$(npx tsc --version | sed s/Version\ //)" >> $GITHUB_OUTPUT
working-directory: ./project
- name: Get target TS version
id: target-ts
run: echo "TS_VERSION=${{ github.event.inputs.tsVersion || '$(npx tsc --version | sed s/Version\ //)' }}" >> $GITHUB_OUTPUT
working-directory: ./main
- name: replace typescript version ${{ steps.source-ts.outputs.TS_VERSION }} with ${{ steps.target-ts.outputs.TS_VERSION }}
if: steps.source-ts.outputs.TS_VERSION != steps.target-ts.outputs.TS_VERSION
run: npm install --force typescript@${{ steps.target-ts.outputs.TS_VERSION }}
working-directory: ./project
- name: show installed typescript version
run: npx tsc --version
working-directory: ./project
- name: build project if needed
run: npm run build-for-test --if-present
working-directory: ./project
- name: modify project config
run: sed 's/"@voxpelli\/tsconfig\//"..\/main\//' tsconfig.json > tmp.tsconfig.json && rm tsconfig.json && mv tmp.tsconfig.json tsconfig.json
working-directory: ./project
- name: show modified config
run: cat tsconfig.json
working-directory: ./project
- run: npx tsc
working-directory: ./project