Skip to content

Commit c7c67d8

Browse files
authored
Merge pull request #77 from material-elements/workflow/test
[workflow/test] Fixing test cases and code checks
2 parents 572df0a + 3e11807 commit c7c67d8

File tree

101 files changed

+1500
-503
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+1500
-503
lines changed

.eslintignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
examples/
3+
__test__/
4+
5+
.github
6+
coverage/

.eslintrc.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
11
module.exports = {
22
root: true,
3-
extends: '@react-native',
3+
extends: ['@react-native', 'plugin:testing-library/react'],
4+
ignorePatterns: ['.eslintrc.js', '**/*.config.js', '**/*.setup.ts'],
5+
env: { jest: true },
6+
parserOptions: {
7+
sourceType: 'module',
8+
useJSXTextNode: true,
9+
tsconfigRootDir: __dirname,
10+
project: './tsconfig.json',
11+
},
12+
plugins: ['unused-imports'],
13+
overrides: [
14+
{
15+
files: ['src/**/*.{ts,tsx,js,jsx}'],
16+
rules: {
17+
'object-curly-spacing': ['error', 'always'],
18+
'unused-imports/no-unused-imports': 'error',
19+
complexity: ['error', 8],
20+
'import/extensions': 0,
21+
'react/jsx-filename-extension': [2, { extensions: ['.tsx'] }],
22+
},
23+
},
24+
],
425
};

.github/actions/install-dependencies/action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@ runs:
66
- name: Setup Node.js
77
uses: actions/setup-node@v3
88
with:
9-
node-version: 22.9.0
9+
node-version: 20
1010
cache: 'yarn'
1111

12+
- name: Cache node modules
13+
uses: actions/cache@v3
14+
with:
15+
path: node_modules
16+
key: ${{ runner.os }}-node-${{ hashFiles('yarn.lock') }}
17+
restore-keys: |
18+
${{ runner.os }}-node-
19+
1220
- name: Install dependencies
1321
run: yarn install
1422
shell: bash

.github/workflows/code-check.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
env:
2020
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2121

22-
- name: Run unit tests
23-
run: yarn run test --coverage --forceExit --maxWorkers=2
24-
continue-on-error: false
22+
- name: SonarCloud Scan
23+
uses: sonarsource/sonarcloud-github-action@v2
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/codeql.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: "CodeQL Analysis"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches:
8+
- master
9+
schedule:
10+
- cron: '0 0 * * 0'
11+
12+
jobs:
13+
codeql:
14+
name: Analyze
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v3
20+
21+
- name: Initialize CodeQL
22+
uses: github/codeql-action/init@v3
23+
with:
24+
languages: typescript, javascript
25+
26+
- name: Autobuild
27+
uses: github/codeql-action/autobuild@v3
28+
29+
- name: Perform CodeQL Analysis
30+
uses: github/codeql-action/analyze@v3

.github/workflows/lint.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Lint
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
9+
jobs:
10+
eslint:
11+
name: "Eslint check"
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Install dependencies
20+
uses: ./.github/actions/install-dependencies
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Run ESLint
25+
run: yarn run lint
26+
continue-on-error: false

.github/workflows/test-runner.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Test
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
jobs:
9+
code-quality-check:
10+
name: Test Runner
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Install dependencies
18+
uses: ./.github/actions/install-dependencies
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Run unit tests
23+
run: yarn run test --coverage --forceExit --maxWorkers=2
24+
continue-on-error: false

.github/workflows/type-check.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: TSC
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
jobs:
9+
code-quality-check:
10+
name: Type Check
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v3
15+
16+
- name: Install dependencies
17+
uses: ./.github/actions/install-dependencies
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
21+
- name: Run TypeScript type check
22+
run: npx tsc --noEmit
23+
continue-on-error: false

.prettierrc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
module.exports = {
22
arrowParens: 'avoid',
33
bracketSameLine: true,
4-
bracketSpacing: false,
4+
bracketSpacing: true,
55
singleQuote: true,
66
trailingComma: 'all',
7+
tabWidth: 2,
8+
printWidth: 130,
79
};

.sonarlint/Ffi_staticLib.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"sonarCloudOrganization": "material-elements",
3+
"projectKey": "material-elements_react-native-material-elements",
4+
"region": "EU"
5+
}

0 commit comments

Comments
 (0)