Skip to content

Commit

Permalink
CI: move tests workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Bulychev committed Aug 17, 2023
1 parent dc5ca1f commit a1ff988
Show file tree
Hide file tree
Showing 126 changed files with 52,254 additions and 8,141 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/devextreme_react_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: DevExtreme React Tests

on:
pull_request:
push:
branches: [23_2]

env:
NX_SKIP_NX_CACHE: ${{ (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'skip-cache')) && 'true' || 'false' }}

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 60

steps:
- name: Get sources
uses: actions/checkout@v2

- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Restore npm cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-modules

- name: Run npm install
run: npm i --no-audit --no-fund

# m.b. move to lint.yml?
- name: Run lint
working-directory: ./packages/devextreme-react
run: npm run lint

- name: Generate metadata
run: npm run react:discover-metadata

- name: Build generator
run: npm run react:build-generator

- name: Generate wrappers
working-directory: ./packages/devextreme-react
run: npm run generate

- name: Check generated code
shell: bash
run: |
git add . -N
changes=$(git diff --name-status HEAD -- packages/devextreme-react/src)
if [ -n "$changes" ]; then
echo "Generated code is outdated. The following files have uncommitted changes:"
echo "$changes";
echo "To update generated code, use "npm run react:generate" and commit changes."
exit 1
fi
- name: Archive internal-tools artifacts
uses: actions/upload-artifact@v3
with:
name: internal-tools-artifacts
path: artifacts/internal-tools/
retention-days: 7

- name: Build devextreme package
run: |
npx nx build devextreme-main
- name: Run tests with React
run: npx nx test devextreme-react

- name: Check packing
run: npx nx pack devextreme-react
2 changes: 1 addition & 1 deletion jest.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
]
},
testURL: 'http://localhost',
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
testRegex: "(\\.|/)(test|spec)\\.(jsx?|tsx?)$",
moduleFileExtensions: [
"ts",
"tsx",
Expand Down
5 changes: 5 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
"dependsOn": [
"build"
]
},
"test": {
"dependsOn": [
"^build"
]
}
},
"workspaceLayout": {
Expand Down
Loading

0 comments on commit a1ff988

Please sign in to comment.