Skip to content

Commit 4ed9f13

Browse files
authored
chore(ci) convert Circle CI config to github workflow (#64)
1 parent acdc1d5 commit 4ed9f13

File tree

10 files changed

+213
-109
lines changed

10 files changed

+213
-109
lines changed

.circleci/config.yml

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

.github/workflows/ci.yml

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
install-dependencies:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
cache-hit: ${{ steps.cache-deps.outputs.cache-hit }}
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '22'
22+
cache: 'yarn'
23+
24+
- name: Cache dependencies
25+
id: cache-deps
26+
uses: actions/cache@v3
27+
with:
28+
path: |
29+
node_modules
30+
example/node_modules
31+
key: ${{ runner.os }}-deps-${{ hashFiles('yarn.lock', 'example/yarn.lock') }}
32+
restore-keys: |
33+
${{ runner.os }}-deps-
34+
35+
- name: Install dependencies
36+
if: steps.cache-deps.outputs.cache-hit != 'true'
37+
run: |
38+
yarn install --cwd example --frozen-lockfile
39+
yarn install --frozen-lockfile
40+
41+
- name: Upload workspace
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: workspace
45+
path: |
46+
.
47+
!node_modules/.cache
48+
!example/node_modules/.cache
49+
retention-days: 1
50+
51+
lint:
52+
runs-on: ubuntu-latest
53+
needs: install-dependencies
54+
steps:
55+
- name: Download workspace
56+
uses: actions/download-artifact@v4
57+
with:
58+
name: workspace
59+
60+
- name: Setup Node.js
61+
uses: actions/setup-node@v4
62+
with:
63+
node-version: '22'
64+
cache: 'yarn'
65+
66+
- name: Restore dependencies cache
67+
uses: actions/cache@v3
68+
with:
69+
path: |
70+
node_modules
71+
example/node_modules
72+
key: ${{ runner.os }}-deps-${{ hashFiles('yarn.lock', 'example/yarn.lock') }}
73+
restore-keys: |
74+
${{ runner.os }}-deps-
75+
76+
- name: Lint files
77+
run: yarn lint
78+
79+
typescript:
80+
runs-on: ubuntu-latest
81+
needs: install-dependencies
82+
steps:
83+
- name: Download workspace
84+
uses: actions/download-artifact@v4
85+
with:
86+
name: workspace
87+
88+
- name: Setup Node.js
89+
uses: actions/setup-node@v4
90+
with:
91+
node-version: '22'
92+
cache: 'yarn'
93+
94+
- name: Restore dependencies cache
95+
uses: actions/cache@v3
96+
with:
97+
path: |
98+
node_modules
99+
example/node_modules
100+
key: ${{ runner.os }}-deps-${{ hashFiles('yarn.lock', 'example/yarn.lock') }}
101+
restore-keys: |
102+
${{ runner.os }}-deps-
103+
104+
- name: Typecheck files
105+
run: yarn typescript
106+
107+
unit-tests:
108+
runs-on: ubuntu-latest
109+
needs: install-dependencies
110+
steps:
111+
- name: Download workspace
112+
uses: actions/download-artifact@v4
113+
with:
114+
name: workspace
115+
116+
- name: Setup Node.js
117+
uses: actions/setup-node@v4
118+
with:
119+
node-version: '22'
120+
cache: 'yarn'
121+
122+
- name: Restore dependencies cache
123+
uses: actions/cache@v3
124+
with:
125+
path: |
126+
node_modules
127+
example/node_modules
128+
key: ${{ runner.os }}-deps-${{ hashFiles('yarn.lock', 'example/yarn.lock') }}
129+
restore-keys: |
130+
${{ runner.os }}-deps-
131+
132+
- name: Run unit tests
133+
run: yarn test --coverage
134+
135+
- name: Upload coverage artifacts
136+
uses: actions/upload-artifact@v4
137+
with:
138+
name: coverage
139+
path: coverage/
140+
retention-days: 30
141+
142+
- name: Upload coverage to Codecov
143+
uses: codecov/codecov-action@v3
144+
with:
145+
directory: ./coverage/
146+
fail_ci_if_error: false
147+
148+
build-package:
149+
runs-on: ubuntu-latest
150+
needs: install-dependencies
151+
steps:
152+
- name: Download workspace
153+
uses: actions/download-artifact@v4
154+
with:
155+
name: workspace
156+
157+
- name: Setup Node.js
158+
uses: actions/setup-node@v4
159+
with:
160+
node-version: '22'
161+
cache: 'yarn'
162+
163+
- name: Restore dependencies cache
164+
uses: actions/cache@v3
165+
with:
166+
path: |
167+
node_modules
168+
example/node_modules
169+
key: ${{ runner.os }}-deps-${{ hashFiles('yarn.lock', 'example/yarn.lock') }}
170+
restore-keys: |
171+
${{ runner.os }}-deps-
172+
173+
- name: Build package
174+
run: yarn prepare
175+
176+
- name: Upload build artifacts
177+
uses: actions/upload-artifact@v4
178+
with:
179+
name: build
180+
path: lib/
181+
retention-days: 30
182+
183+
# Summary job that depends on all other jobs
184+
ci-complete:
185+
runs-on: ubuntu-latest
186+
needs: [lint, typescript, unit-tests, build-package]
187+
if: always()
188+
steps:
189+
- name: Check all jobs status
190+
run: |
191+
if [[ "${{ needs.lint.result }}" == "failure" || "${{ needs.typescript.result }}" == "failure" || "${{ needs.unit-tests.result }}" == "failure" || "${{ needs.build-package.result }}" == "failure" ]]; then
192+
echo "One or more jobs failed"
193+
exit 1
194+
else
195+
echo "All jobs completed successfully"
196+
fi

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Checkout
10-
uses: actions/checkout@v3
10+
uses: actions/checkout@v4
1111
- name: Setup Node
12-
uses: actions/setup-node@v3
12+
uses: actions/setup-node@v4
1313
with:
14-
node-version: '16.x'
14+
node-version: '22.x'
1515
registry-url: 'https://registry.npmjs.org'
1616
- name: Install dependencies 🔧
1717
run: yarn install --frozen-lockfile

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,7 @@ android/keystores/debug.keystore
6666
# generated by bob
6767
lib/
6868

69+
# coverage reports
70+
coverage/
71+
6972
.xcode.env.local

example/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {AppRegistry} from 'react-native';
1+
import { AppRegistry } from 'react-native';
22
import App from './src/App';
33

44
AppRegistry.registerComponent('main', () => App);

example/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function App() {
3232
-1,
3333
true
3434
);
35-
}, []);
35+
}, [animatedHeight, animatedWidth]);
3636

3737
const animatedStyle = useAnimatedStyle(() => ({
3838
width: `${animatedWidth.value}%`,

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"!**/__mocks__"
2020
],
2121
"scripts": {
22-
"test": "jest",
22+
"test": "jest --passWithNoTests",
2323
"typescript": "tsc --noEmit",
2424
"lint": "eslint \"**/*.{js,ts,tsx}\"",
2525
"prepare": "bob build",
@@ -101,7 +101,8 @@
101101
},
102102
"eslintIgnore": [
103103
"node_modules/",
104-
"lib/"
104+
"lib/",
105+
"coverage/"
105106
],
106107
"prettier": {
107108
"quoteProps": "consistent",

src/ShadowedView.android.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React from 'react';
22
import {
33
I18nManager,
4-
StyleProp,
54
StyleSheet,
5+
StyleProp, // eslint-disable-line @typescript-eslint/no-unused-vars
66
ViewProps,
7-
ViewStyle,
7+
ViewStyle, // eslint-disable-line @typescript-eslint/no-unused-vars
88
} from 'react-native';
9+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
910
import { FastShadowView, FastShadowViewProps } from './FastShadowView';
1011

1112
export class ShadowedView extends React.Component<ViewProps> {

src/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
12
import { ColorValue, Platform, ViewStyle } from 'react-native';
23

34
export type ShadowParams = {

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"allowUnreachableCode": false,
88
"allowUnusedLabels": false,
99
"esModuleInterop": true,
10-
"importsNotUsedAsValues": "error",
1110
"forceConsistentCasingInFileNames": true,
1211
"jsx": "react",
1312
"lib": ["esnext"],
@@ -24,5 +23,6 @@
2423
"skipLibCheck": true,
2524
"strict": true,
2625
"target": "esnext"
27-
}
26+
},
27+
"exclude": ["example"]
2828
}

0 commit comments

Comments
 (0)