Skip to content

Commit d2f5405

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

16 files changed

+11738
-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/build.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build Github Packages
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
build_type:
7+
description: Build Type
8+
required: true
9+
default: alpha
10+
type: choice
11+
options:
12+
- alpha
13+
- release
14+
15+
jobs:
16+
internal-build:
17+
timeout-minutes: 60
18+
name: Test, Build and Publish
19+
runs-on: ubuntu-22.04
20+
env:
21+
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
22+
RUN_NUM: ${{ github.run_number }}
23+
PKG_VERSION: ${{ vars.PKG_VERSION }}
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Setup
32+
uses: ./.github/actions/setup
33+
34+
- name: Test
35+
uses: ./.github/actions/test
36+
37+
- name: Initialise Git config
38+
run: |
39+
git config --global user.email github-actions
40+
git config --global user.name github-actions@github.com
41+
42+
- name: Initialise NPM config
43+
run: |
44+
npm config set @arduino:registry=https://npm.pkg.github.com/ //npm.pkg.github.com/:_authToken=${REPO_ACCESS_TOKEN}
45+
46+
- name: Set package version
47+
run: |
48+
if [ ${{ inputs.build_type }} == "alpha" ]; then
49+
npm version ${PKG_VERSION}-alpha.${RUN_NUM}
50+
else
51+
npm version ${PKG_VERSION}
52+
fi
53+
54+
- name: Publish GH Package
55+
run: npm publish

.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 }}

.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)