ci: dont run windows ut on branch builds #1
Workflow file for this run
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
name: Code check | ||
on: | ||
workflow_call: | ||
inputs: | ||
affected: | ||
type: boolean | ||
required: false | ||
default: false | ||
description: Run test only on affective packages if true | ||
skipNxCache: | ||
type: boolean | ||
default: false | ||
required: false | ||
description: Skip the nx cache | ||
secrets: | ||
NX_CLOUD_ACCESS_TOKEN: | ||
required: false | ||
description: Token to use Nx Cloud token | ||
env: | ||
NX_SKIP_NX_CACHE: ${{ inputs.skipNxCache }} | ||
jobs: | ||
test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest ${{ github.event_name != 'push' && ', windows-latest' || '' }} ] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: ${{ inputs.affected && '0' || '1' }} | ||
- name: Setup | ||
uses: ./tools/github-actions/setup | ||
- uses: ./.github/actions/setup-java | ||
with: | ||
install-jdk: 'true' | ||
- name: Cache Jest | ||
uses: actions/cache@v3 | ||
env: | ||
hash: ${{ hashFiles('package.json', 'tsconfig.base.json', 'tsconfig.build.json', 'nx.json') }} | ||
with: | ||
path: .cache/jest | ||
key: ${{ runner.os }}-jest-${{ env.hash }} | ||
restore-keys: | | ||
${{ runner.os }}-jest-${{ env.hash }} | ||
${{ runner.os }}-jest | ||
${{ runner.os }} | ||
- name: Build swagger generator | ||
run: yarn nx run ama-sdk-generator-sdk:build-swagger | ||
- name: Test | ||
env: | ||
testCmd: ${{ inputs.affected && format('test:affected --base=remotes/origin/{0}', github.base_ref || github.ref_name) || 'test'}} | ||
NODE_OPTIONS: ${{ runner.os == 'Windows' && '--max_old_space_size=4096' || '' }} | ||
run: yarn ${{ env.testCmd }} --output-style=stream | ||
- name: Publish tests reports | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ut-reports-${{ matrix.os }} | ||
path: | | ||
apps/**/dist-test/ut-report.xml | ||
packages/**/dist-test/ut-report.xml | ||
tools/**/dist-test/ut-report.xml | ||
lint: | ||
runs-on: ubuntu-latest | ||
env: | ||
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: ${{ inputs.affected && '0' || '1' }} | ||
- name: Setup | ||
uses: ./tools/github-actions/setup | ||
- name: Cache Eslint | ||
uses: actions/cache@v3 | ||
with: | ||
path: .cache/eslint | ||
key: ${{ runner.os }}-eslint-${{ hashFiles('yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-eslint-${{ env.hash }} | ||
${{ runner.os }}-eslint | ||
${{ runner.os }} | ||
- name: Dependency Check | ||
run: yarn in-source-dep-check --fail-on-error | ||
- name: Lint | ||
env: | ||
lintCmd: ${{ inputs.affected && format('lint:affected --base=remotes/origin/{0}', github.base_ref || github.ref_name) || 'lint'}} | ||
run: yarn ${{ env.lintCmd }} --configuration ci |