ci: make ourstage and techdocs #27
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
# This workflow will do a clean installation of node dependencies, cache/ | |
# restore them, build the source code and run tests. | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: repo-tests | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
branches: ['main'] | |
# Enable manual triggers. | |
workflow_dispatch: | |
env: | |
CI: true | |
# DEBUG: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get npm version | |
id: npm-version | |
shell: bash | |
run: echo "NPM_VERSION=$(cat ./.npmrc)" >> $GITHUB_OUTPUT | |
- name: Get yarn version | |
id: yarn-version | |
shell: bash | |
working-directory: ./src/backstage/ourstage/ | |
run: cat ./package.json | jq -r .packageManager | sed 's\yarn@\\g' | xargs -I {} -n 1 echo 'YARN_VERSION={}' >> $GITHUB_OUTPUT | |
- name: Get pnpm version | |
id: pnpm-version | |
shell: bash | |
run: echo "PNPM_VERSION=$(cat ./.pnpmrc)" >> $GITHUB_OUTPUT | |
- uses: pnpm/action-setup@v2 | |
id: pnpm-install | |
with: | |
version: ${{ steps.pnpm-version.outputs.PNPM_VERSION }} | |
run_install: false | |
- uses: actions/setup-node@v3 | |
id: node-install | |
with: | |
node-version-file: './.nvmrc' | |
cache: 'pnpm' # caching pnpm dependencies | |
cache-dependency-path: '**/pnpm-lock.yaml' | |
- name: Install npm and yarn | |
id: npm-and-yarn-install | |
run: | | |
npm install --location=global \ | |
npm@${{ steps.npm-version.outputs.NPM_VERSION }} \ | |
yarn@${{ steps.yarn-version.outputs.YARN_VERSION }} | |
- name: Setup Wireit cache | |
id: cache-wireit | |
uses: google/wireit@setup-github-actions-caching/v1 | |
- name: Install NodeJS dependencies | |
id: install-dependencies | |
run: pnpm install --recursive --frozen-lockfile | |
- name: Run tests | |
run: pnpm test | |
- name: upload-task-output | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: task-output | |
path: | | |
**/.task-output/ | |
if-no-files-found: error |