Skip to content

setup(all): update tsconfigs to run eslint on all files including not… #97

setup(all): update tsconfigs to run eslint on all files including not…

setup(all): update tsconfigs to run eslint on all files including not… #97

Workflow file for this run

name: build
on:
push:
branches: [main, single-page, feat/*, fix/*, chore/*, debug/*]
pull_request:
branches: [main]
workflow_dispatch: {}
jobs:
build:
runs-on: ubuntu-latest
outputs:
affectedProjs: ${{ steps.affected.outputs.projs }}
# Workaround for tools (e.g., Node.js) not cached:
# https://gitea.com/gitea/act_runner/issues/70#issuecomment-734824
env:
RUNNER_TOOL_CACHE: /toolcache
strategy:
matrix:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [18.x, 20.x]
steps:
- name: Set common variables
id: common-vars
run: |
commit_id_8=${GITHUB_SHA::8}
CONTAINER_REGISTRY_DOMAIN=docker.io
echo commit_id_8=${commit_id_8} >> $GITHUB_OUTPUT
echo repo_url=https://github.com/${{ github.repository }} >> $GITHUB_OUTPUT
# Needs to come first, `actions/setup-node` uses `pnpm-lock.yaml`
- uses: actions/checkout@v3
with:
# TO IMPROVE: We need to fetch all branches and commits so that Nx affected has a base to compare against.
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
id: setSHAs
uses: nrwl/nx-set-shas@v4
# - run: |
# echo "BASE: ${{ env.NX_BASE }}" or ${{ steps.setSHAs.outputs.base }}"
# echo "HEAD: ${{ env.NX_HEAD }}" or ${{ steps.setSHAs.outputs.head }}"
- uses: pnpm/action-setup@v2
with:
version: 8
run_install: |
- args: [--global, zx, '@daotl/traf-nx']
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Calculate affected projects
id: affected
run: |
projs=$(traf-nx affected --base=${NX_BASE} --json=true)
projs=${projs#[}
projs=${projs%]}
projs=$(echo ${projs} | sed -e 's/\"//g')
if ! grep -qE '(^|,)root($|,)' <<< '${projs}'; then
projs="root,${projs}"
fi
echo Affected projects: ${projs}
echo projs=${projs} >> $GITHUB_OUTPUT
- name: pnpm install
# Fix: `pnpm install --filter` installing dependencies of all projects
# https://github.com/pnpm/pnpm/issues/6300#issuecomment-1722120409
run: CYPRESS_INSTALL_BINARY=0 ./scripts/pnpm-install-filtered.js --frozen-lockfile=true ${{ steps.affected.outputs.projs }}
- uses: docker/setup-buildx-action@v3
id: docker-setup-buildx
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.node-version == '20.x'
- uses: docker/login-action@v3
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.node-version == '20.x'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: nx affected
env:
INPUT_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUT_BUILDER: ${{ steps.docker-setup-buildx.outputs.name }}
# "--batch": Enable TypeScript batch mode: https://nx.dev/recipes/tips-n-tricks/enable-tsc-batch-mode
run: |
targets='build lint'
if [ '${{ github.ref }}' = 'refs/heads/main' ] && [ '${{ github.event_name }}' = 'push' ] && [ '${{ matrix.node-version }}' = '20.x' ]; then
targets="${targets} container"
fi
pnpm nx affected -t ${targets} -c ci --parallel 20 --batch