Skip to content

Commit

Permalink
Add test-npm & test-yarn CI jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
CAMOBAP committed Mar 24, 2022
1 parent 8765791 commit 382e898
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 7 deletions.
61 changes: 55 additions & 6 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,60 @@
name: CI
on: push
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:

env:
TEST_APP_DEPS: react-native-modal react-native-webview expo-constants@^10.0.1 @unimodules/core @unimodules/react-native-adapter react-native-unimodules
RN_BUNDLE_ARGS: --entry-file index.js --platform android --dev false --bundle-output android/main.jsbundle --assets-dest android

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn
- name: Run tests
run: yarn test
- uses: actions/checkout@v3
- run: yarn
- run: yarn test
test-yarn:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: react-native-hcaptcha
- run: npx react-native init rnexample
- name: Run yarn add ...
working-directory: rnexample
run: |
yarn add file:../react-native-hcaptcha
yarn add ${{ env.TEST_APP_DEPS }}
cp ../react-native-hcaptcha/Example.App.js App.js
cp ../react-native-hcaptcha/Example.jest.config.js jest.config.js
- run: yarn react-native bundle ${{ env.RN_BUNDLE_ARGS }}
working-directory: rnexample
- run: cat package.json
working-directory: rnexample
- run: yarn test
working-directory: rnexample
test-npm:
needs: build
runs-on: ubuntu-latest
steps:
- run: npx react-native init rnexample
- uses: actions/checkout@v3
with:
path: rnexample/react-native-hcaptcha
- name: Run npm install ...
working-directory: rnexample
run: |
npm i --save file:./react-native-hcaptcha
npm i --save ${{ env.TEST_APP_DEPS }}
cp ./react-native-hcaptcha/Example.App.js App.js
cp ./react-native-hcaptcha/Example.jest.config.js jest.config.js
- run: npx react-native bundle ${{ env.RN_BUNDLE_ARGS }}
working-directory: rnexample
- run: cat package.json
working-directory: rnexample
- run: npm run test --testPathPattern __tests__
working-directory: rnexample
15 changes: 15 additions & 0 deletions Example.jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
preset: 'react-native',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
transformIgnorePatterns: [
"node_modules/(?!(react-native"
+ "|@react-native"
+ "|@hcaptcha"
+ "|react-native-modal"
+ "|react-native-webview"
+ "|react-native-animatable"
+ "|expo-constants"
+ "|@unimodules"
+ ")/)",
],
}
2 changes: 1 addition & 1 deletion MAINTAINER.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ For iOS instead the last step do:

Problem:
```
Error: Unable to resolve module @hcaptcha/react-native-hcaptcha from /Users/camobap/Developers/Projects/hcaptcha/rnexample3/App.js: @hcaptcha/react-native-hcaptcha could not be found within the project or in these directories:
Error: Unable to resolve module @hcaptcha/react-native-hcaptcha from App.js: @hcaptcha/react-native-hcaptcha could not be found within the project or in these directories:
node_modules
```

Expand Down

0 comments on commit 382e898

Please sign in to comment.