Skip to content

Commit f5602de

Browse files
chore(hook): app-1821 github packages internal build
1 parent 531b7e4 commit f5602de

16 files changed

+11724
-16001
lines changed

.circleci/config.yml

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

.eslintrc.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['@react-native', 'prettier'],
4+
rules: {
5+
'react/react-in-jsx-scope': 'off',
6+
'prettier/prettier': [
7+
'error',
8+
{
9+
arrowParens: 'avoid',
10+
bracketSameLine: true,
11+
bracketSpacing: false,
12+
singleQuote: true,
13+
trailingComma: 'all',
14+
},
15+
],
16+
},
17+
};

.github/actions/setup/action.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Setup
2+
description: Setup Node.js and install dependencies
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Setup Node.js
8+
uses: actions/setup-node@v4
9+
with:
10+
node-version-file: .nvmrc
11+
12+
- name: Cache dependencies
13+
id: yarn-cache
14+
uses: actions/cache@v4
15+
with:
16+
path: |
17+
**/node_modules
18+
.yarn/install-state.gz
19+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
20+
restore-keys: |
21+
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
22+
${{ runner.os }}-yarn-
23+
24+
- name: Install dependencies
25+
if: steps.yarn-cache.outputs.cache-hit != 'true'
26+
run: yarn install --frozen-lockfile
27+
shell: bash

.github/actions/test/action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Test
2+
description: Test the code with Lint and Typecheck
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Lint files
8+
run: yarn lint
9+
shell: bash
10+
11+
- name: Typecheck files
12+
run: yarn typecheck
13+
shell: bash

.github/workflows/check.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Check
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, ready_for_review, reopened]
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
9+
10+
jobs:
11+
lint:
12+
timeout-minutes: 60
13+
runs-on: ubuntu-22.04
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup
19+
uses: ./.github/actions/setup
20+
21+
- name: Test
22+
uses: ./.github/actions/test
23+
24+
build-library:
25+
timeout-minutes: 60
26+
runs-on: ubuntu-22.04
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Setup
32+
uses: ./.github/actions/setup
33+
34+
- name: Build package
35+
run: yarn prepare
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Cleanup Caches By a Branch
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
7+
jobs:
8+
cleanup:
9+
timeout-minutes: 60
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v3
14+
15+
- name: Cleanup
16+
run: |
17+
gh extension install actions/gh-actions-cache
18+
19+
REPO=${{ github.repository }}
20+
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
21+
22+
echo "Fetching list of cache key"
23+
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
24+
25+
## Setting this to not fail the workflow while deleting cache keys.
26+
set +e
27+
echo "Deleting caches..."
28+
for cacheKey in $cacheKeysForPR
29+
do
30+
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
31+
done
32+
echo "Done"
33+
env:
34+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/internal_build.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Internal Build Github Packages
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
internal-build:
8+
timeout-minutes: 60
9+
name: Test, Build and Publish
10+
runs-on: ubuntu-22.04
11+
env:
12+
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
13+
RUN_NUM: ${{ github.run_number }}
14+
PKG_VERSION: ${{ vars.PKG_VERSION }}
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup
23+
uses: ./.github/actions/setup
24+
25+
- name: Test
26+
uses: ./.github/actions/test
27+
28+
- name: Initialise Git config
29+
run: |
30+
git config --global user.email github-actions
31+
git config --global user.name github-actions@github.com
32+
33+
- name: Initialise NPM config
34+
run: |
35+
npm config set @arduino:registry=https://npm.pkg.github.com/ //npm.pkg.github.com/:_authToken=${REPO_ACCESS_TOKEN}
36+
37+
- name: Set package version
38+
run: npm version ${PKG_VERSION}-${RUN_NUM}
39+
40+
- name: Publish GH Package
41+
run: npm publish

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v18

.prettierrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
arrowParens: 'avoid',
3+
bracketSameLine: true,
4+
bracketSpacing: false,
5+
singleQuote: true,
6+
trailingComma: 'all',
7+
};

0 commit comments

Comments
 (0)