Skip to content

chore(hook): app-1821 github packages internal build #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 0 additions & 98 deletions .circleci/config.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
root: true,
extends: ['@react-native', 'prettier'],
rules: {
'react/react-in-jsx-scope': 'off',
'prettier/prettier': [
'error',
{
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
singleQuote: true,
trailingComma: 'all',
},
],
},
};
27 changes: 27 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Setup
description: Setup Node.js and install dependencies

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc

- name: Cache dependencies
id: yarn-cache
uses: actions/cache@v4
with:
path: |
**/node_modules
.yarn/install-state.gz
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-yarn-

- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
shell: bash
13 changes: 13 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Test
description: Test the code with Lint and Typecheck

runs:
using: composite
steps:
- name: Lint files
run: yarn lint
shell: bash

- name: Typecheck files
run: yarn typecheck
shell: bash
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build Github Packages

on:
workflow_dispatch:
inputs:
build_type:
description: Build Type
required: true
default: alpha
type: choice
options:
- alpha
- release

jobs:
internal-build:
timeout-minutes: 60
name: Test, Build and Publish
runs-on: ubuntu-22.04
env:
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
RUN_NUM: ${{ github.run_number }}
PKG_VERSION: ${{ vars.PKG_VERSION }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup
uses: ./.github/actions/setup

- name: Test
uses: ./.github/actions/test

- name: Initialise Git config
run: |
git config --global user.email github-actions
git config --global user.name github-actions@github.com

- name: Initialise NPM config
run: |
npm config set @arduino:registry=https://npm.pkg.github.com/ //npm.pkg.github.com/:_authToken=${REPO_ACCESS_TOKEN}

- name: Set package version
run: |
if [ ${{ inputs.build_type }} == "alpha" ]; then
npm version ${PKG_VERSION}-alpha.${RUN_NUM}
else
npm version ${PKG_VERSION}
fi

- name: Publish GH Package
run: npm publish
35 changes: 35 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check
on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
lint:
timeout-minutes: 60
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Test
uses: ./.github/actions/test

build-library:
timeout-minutes: 60
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Build package
run: yarn prepare
34 changes: 34 additions & 0 deletions .github/workflows/clean_cache_build_branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Cleanup Caches By a Branch
on:
pull_request:
types:
- closed

jobs:
cleanup:
timeout-minutes: 60
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Cleanup
run: |
gh extension install actions/gh-actions-cache

REPO=${{ github.repository }}
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"

echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )

## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
singleQuote: true,
trailingComma: 'all',
};
Loading
Loading