Skip to content

Commit e98ae3d

Browse files
authored
Better ci (#131)
* Remove test folder * Update Github Actions * Add `error-on-fail` option
1 parent 455acb2 commit e98ae3d

File tree

88 files changed

+33
-18764
lines changed

Some content is hidden

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

88 files changed

+33
-18764
lines changed

.github/workflows/test.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,38 @@ on:
66
pull_request:
77
branches: [main]
88

9+
env:
10+
APP_NAME: MyApp
11+
NODEJS_VERSION: 24
12+
913
jobs:
10-
build:
14+
test:
15+
name: Analyze bundle with React Native ${{ matrix.rn-version }}
1116
runs-on: ubuntu-latest
1217
strategy:
1318
matrix:
14-
node-version: [12.x, 14.x, 16.x]
19+
rn-version: [latest, 0.83.4, 0.82.1]
1520
steps:
1621
- name: Checkout
17-
uses: actions/checkout@v2
22+
uses: actions/checkout@v6
1823

19-
- name: Use Node.js ${{ matrix.node-version }}
20-
uses: actions/setup-node@v2
24+
- name: Use Node.js ${{ env.NODEJS_VERSION }}
25+
uses: actions/setup-node@v6
2126
with:
22-
node-version: ${{ matrix.node-version }}
27+
node-version: ${{ env.NODEJS_VERSION }}
2328
cache: 'yarn'
2429

25-
- run: yarn install --frozen-lockfile
26-
- run: yarn test
30+
- name: Install node_modules in ${{ github.workspace }}
31+
run: yarn install --frozen-lockfile
32+
33+
- name: Install React Native ${{ matrix.rn-version }} and run the visualizer
34+
working-directory: /tmp
35+
shell: bash
36+
env:
37+
YARN_ENABLE_IMMUTABLE_INSTALLS: false
38+
run: |
39+
set -x # print all executed commands
40+
npx @react-native-community/cli@latest init ${{ env.APP_NAME }} --version ${{ matrix.rn-version }} --skip-git-init --install-pods false --pm yarn
41+
cd ${{ env.APP_NAME }}
42+
yarn add react-native-bundle-visualizer@portal:${{ github.workspace }}
43+
yarn run react-native-bundle-visualizer --verbose --error-on-fail

src/react-native-bundle-visualizer.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
const chalk = require('chalk');
33
const fs = require('fs-extra');
44
const os = require('os');
5+
const process = require('process');
56
const path = require('path');
67
const argv = require('minimist')(process.argv.slice(2));
78
const execa = require('execa');
@@ -70,6 +71,7 @@ const format = argv.format || 'html';
7071
const bundleOutputExplorerFile = path.join(outDir, 'explorer.' + format);
7172
const onlyMapped = !!argv['only-mapped'] || false;
7273
const borderChecks = argv['border-checks'] === true;
74+
const errorOnFail = argv['error-on-fail'] || false;
7375

7476
// Make sure the temp dir exists
7577
fs.ensureDirSync(baseDir);
@@ -184,4 +186,9 @@ bundlePromise
184186
// Open output file
185187
return open(bundleOutputExplorerFile);
186188
})
187-
.catch((error) => console.log(chalk.red('=== error ==='), error));
189+
.catch((error) => {
190+
console.log(chalk.red('=== error ==='), error)
191+
if (errorOnFail) {
192+
process.exit(1);
193+
}
194+
});

test/Expo42/.gitignore

Lines changed: 0 additions & 13 deletions
This file was deleted.

test/Expo42/App.tsx

Lines changed: 0 additions & 24 deletions
This file was deleted.

test/Expo42/app.json

Lines changed: 0 additions & 34 deletions
This file was deleted.
-91.1 KB
Binary file not shown.
-17.1 KB
Binary file not shown.
-1.43 KB
Binary file not shown.

test/Expo42/assets/images/icon.png

-21.9 KB
Binary file not shown.
-47.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)