Skip to content

Commit

Permalink
build(devs-infra): make example apps' Windows tests working on CI aga…
Browse files Browse the repository at this point in the history
…in (#1649)
  • Loading branch information
ahnpnl authored Jun 18, 2022
1 parent cb7511b commit 155841a
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 486 deletions.
92 changes: 34 additions & 58 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,82 +9,58 @@ on:
- '**'

concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
cleanup-runs:
runs-on: ubuntu-latest
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
prepare-yarn-cache-ubuntu:
uses: ./.github/workflows/prepare-cache.yml
with:
os: ubuntu-latest
prepare-yarn-cache-windows:
uses: ./.github/workflows/prepare-cache.yml
with:
os: windows-latest

prepare-yarn-cache:
name: Prepare yarn cache
lint:
runs-on: ubuntu-latest
needs: prepare-yarn-cache-ubuntu

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: yarn
- name: Validate cache
env:
# Use PnP and disable postinstall scripts as this just needs to
# populate the cache for the other jobs
YARN_NODE_LINKER: pnp
YARN_ENABLE_SCRIPTS: false
run: yarn
- name: install
run: yarn --immutable
- name: build
run: yarn build
- name: run eslint
run: yarn lint
- name: run prettier
run: yarn lint-prettier-ci

lint-and-typecheck:
name: Running TypeScript compiler & ESLint
yarn-validate:
name: validate Yarn dependencies
runs-on: ubuntu-latest
needs: prepare-yarn-cache

needs: prepare-yarn-cache-ubuntu
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: yarn
- name: Install
run: yarn
- name: Run eslint
run: yarn lint
- name: Run prettier
run: yarn lint-prettier-ci

test:
name: Node v${{ matrix.node-version }} on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node-version: [14.x, 16.x]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
needs: prepare-yarn-cache
- name: 'Check for duplicate dependencies (fix w/ "yarn dedupe")'
run: yarn dedupe --check

steps:
- name: Set git config
shell: bash
run: |
git config --global core.autocrlf false
git config --global core.symlinks true
if: runner.os == 'Windows'
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Install
run: yarn
- name: Build
run: yarn build
- name: Run tests
run: yarn test
- name: Run tests in example projects
run: yarn test-examples
test-ubuntu:
uses: ./.github/workflows/test.yml
needs: prepare-yarn-cache-ubuntu
with:
os: ubuntu-latest
test-windows:
uses: ./.github/workflows/test.yml
needs: prepare-yarn-cache-windows
with:
os: windows-latest
29 changes: 29 additions & 0 deletions .github/workflows/prepare-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Prepare CI cache

on:
workflow_call:
inputs:
os:
required: true
type: string

jobs:
prepare-yarn-cache:
name: Prepare yarn cache for ${{ inputs.os }}
runs-on: ${{ inputs.os }}

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: yarn

- name: Validate cache
env:
# Use PnP and disable postinstall scripts as this just needs to
# populate the cache for the other jobs
YARN_NODE_LINKER: pnp
YARN_ENABLE_SCRIPTS: false
run: yarn --immutable
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test

on:
workflow_call:
inputs:
os:
required: true
type: string

jobs:
test:
strategy:
fail-fast: false
matrix:
node-version: [14.x, 16.x]
name: Node v${{ matrix.node-version }} on ${{ inputs.os }}
runs-on: ${{ inputs.os }}

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: install
run: yarn --immutable
- name: build
run: yarn build
- name: Run tests
run: yarn test
- name: Run tests in example projects
run: yarn test-examples
4 changes: 2 additions & 2 deletions scripts/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const glob = require('glob');

const rootDir = path.resolve(__dirname, '..');
const distDir = path.join(rootDir, 'build');
const examplesRootDir = path.join(rootDir, 'examples');
const exampleAppsToRun = glob
.sync(`${examplesRootDir}/*`)
.sync('examples/*')
.map((examplePath) => path.join(process.cwd(), examplePath))
.filter((examplePath) => lstatSync(examplePath).isDirectory() && existsSync(path.join(examplePath, 'package.json')))
.sort((a, b) => {
const ngVersion1 = +a.substring(a.indexOf('v') + 1);
Expand Down
74 changes: 0 additions & 74 deletions scripts/update-e2e.js

This file was deleted.

Loading

0 comments on commit 155841a

Please sign in to comment.