Skip to content

Commit

Permalink
Change Git Checks
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgianSorinMaxim committed Mar 17, 2021
1 parent a47846c commit 5d4cee1
Show file tree
Hide file tree
Showing 10 changed files with 706 additions and 46 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
time: '21:00'
open-pull-requests-limit: 10
ignore:
- dependency-name: typeorm
versions:
- '> 0.2.24'
- '< 0.3'
reviewers:
- 'theappnest/backend'
40 changes: 40 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Git Checks

on: [push]

jobs:
build:
name: Run tests, linter, TS
runs-on: macOS-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12

- name: Install dependencies
run: yarn

- name: Pod Install
working-directory: ios
run: pod install

# TS
- name: Run TypeScript
run: yarn tsc

# Run linter
- name: Run linter
run: yarn lint

# Run Prettier
- name: Run prettier
run: yarn prettier

# Tests
- name: Run unit tests
run: yarn test
48 changes: 48 additions & 0 deletions .github/workflows/ts-ignore-counter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: TypeScript '@ts-ignore' counter
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v2
with:
ref: master
- name: Count ts-ignore on master
id: before
run: |
export BEFORE=`find . -type f \( -name "*.ts" -or -name "*.tsx" \) -exec grep -o "@ts-ignore" {} \; |wc -l`
echo "::set-output name=count::$BEFORE"
- uses: actions/checkout@v2
- name: Count ts-ignore on this commit
id: after
run: |
export AFTER=`find . -type f \( -name "*.ts" -or -name "*.tsx" \) -exec grep -o "@ts-ignore" {} \; |wc -l`
echo "::set-output name=count::$AFTER"
- name: Do the math
id: result
run: |
export BEFORE="${{ steps.before.outputs.count }}"
export AFTER="${{ steps.after.outputs.count }}"
if [[ `expr $AFTER - $BEFORE` -gt 0 ]]; then
export DIFF=`expr $AFTER - $BEFORE`
export CHANGE="(went up by $DIFF) "
for n in $(seq $DIFF); do export CHANGE="$CHANGE:broken_heart:"; done
elif [[ `expr $BEFORE - $AFTER` -gt 0 ]]; then
export DIFF=`expr $BEFORE - $AFTER`
export CHANGE="(went down by $DIFF) "
for n in $(seq $DIFF); do export CHANGE="$CHANGE:sparkles:"; done
else
export CHANGE="(unchanged)"
fi
echo "::set-output name=comment::**ts-ignore**'s: $AFTER $CHANGE"
- name: Post issue comment
run: |
jq --arg msg "${{ steps.result.outputs.comment }}" -nc '{"body": $msg}' | \
curl -sL -X POST -d @- \
-H "Content-Type: application/json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/comments"
32 changes: 32 additions & 0 deletions __mocks__/react-native-device-info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
getUserAgent: () => "TestUser/Agent",
getManufacturer: () => "Apple",
getDeviceId: () => "DeviceId",
getSystemVersion: () => "10.0",
getReadableVersion: () => "1.0.0.1",
getApplicationName: () => "Mindful Chef (Dev)",
isEmulator: () => true,
isTablet: () => false,
getModel: () => "Mock iPhone 12",
getVersion: jest.fn(() => Promise.resolve("24.0")),
getBundleId: jest.fn(() => Promise.resolve("com.mindfulchef.uat")),
getBuildNumber: jest.fn(() => Promise.resolve("3.0.0")),
getIpAddress: jest.fn(() => Promise.resolve("10.158.70.93")),
getUniqueID: jest.fn(),
getBrand: jest.fn(),
getSystemName: jest.fn(),
getDeviceName: jest.fn(),
getDeviceLocale: jest.fn(),
getDeviceCountry: jest.fn(),
getTimezone: jest.fn(),
is24Hour: jest.fn(),
isPinOrFingerprintSet: jest.fn(),
getAPILevel: jest.fn(),
getInstanceID: jest.fn(),
getPhoneNumber: jest.fn(),
getFirstInstallTime: jest.fn(),
getLastUpdateTime: jest.fn(),
getSerialNumber: jest.fn(),
getMACAddress: jest.fn(),
getCarrier: jest.fn(),
};
3 changes: 3 additions & 0 deletions __mocks__/react-native-permissions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
checkNotifications: () => true,
};
2 changes: 1 addition & 1 deletion src/components/__tests__/ButtonWithIcon.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ButtonWithIcon from "../ButtonWithIcon";
it(`renders correctly`, () => {
const defaultProps = {
label: "Google",
icon: "Icon",
icon: "add",
onPress: () => {},
};
const tree = renderer.create(<ButtonWithIcon {...defaultProps} />).toJSON();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ exports[`renders correctly 1`] = `
]
}
>
?
</Text>
</View>
<Text
Expand Down
104 changes: 63 additions & 41 deletions src/components/__tests__/__snapshots__/Card.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ exports[`renders correctly 1`] = `
style={
Object {
"alignItems": "flex-start",
"borderColor": "#D4AF37",
"borderColor": "#BABABA",
"borderRadius": 6,
"borderWidth": 1,
"display": "flex",
"flexDirection": "row",
"justifyContent": "space-between",
"marginBottom": 12,
"padding": 12,
"width": "100%",
Expand All @@ -34,65 +36,85 @@ exports[`renders correctly 1`] = `
<View
style={
Object {
"alignItems": "center",
"backgroundColor": "#f7f7f7",
"flexDirection": "row",
"height": 150,
"justifyContent": "center",
"width": "100%",
"width": "60%",
}
}
>
<Text
allowFontScaling={false}
style={
Array [
Object {
"color": undefined,
"fontSize": 60,
},
Object {
"color": "#BABABA",
"color": "#000",
"fontWeight": "bold",
"marginTop": 12,
"overflow": "hidden",
},
]
}
>
Google.com
</Text>
<Text
style={
Array [
Object {
"fontFamily": "Ionicons",
"fontStyle": "normal",
"fontWeight": "normal",
"color": "#000",
"overflow": "hidden",
"paddingTop": 12,
},
Object {},
]
}
>
, ,
</Text>
</View>
<Text
<View
style={
Array [
Object {
"color": "#D4AF37",
"fontWeight": "bold",
"marginTop": 12,
"overflow": "hidden",
},
]
Object {
"alignItems": "flex-end",
"width": "40%",
}
}
>
Google.com
</Text>
<Text
style={
Array [
<View
style={
Object {
"color": "#000",
"overflow": "hidden",
"paddingTop": 12,
},
]
}
>
, ,
</Text>
"alignItems": "center",
"backgroundColor": "#f7f7f7",
"flex": 1,
"height": 100,
"justifyContent": "center",
"width": 100,
}
}
>
<Text
allowFontScaling={false}
style={
Array [
Object {
"color": undefined,
"fontSize": 35,
},
Object {
"alignSelf": "center",
"color": "#BABABA",
"margin": 0,
"padding": 0,
},
Object {
"fontFamily": "Ionicons",
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
}
>
</Text>
</View>
</View>
</View>
</View>
`;
Loading

1 comment on commit 5d4cee1

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ts-ignore's: 16 (unchanged)

Please sign in to comment.