Skip to content

Commit

Permalink
Add GitHub Actions for library and example apps (#134)
Browse files Browse the repository at this point in the history
Co-authored-by: Tomek Zawadzki <[email protected]>
  • Loading branch information
robertKozik and tomekzaw authored Apr 11, 2024
1 parent ee2daf7 commit 0a6e54b
Show file tree
Hide file tree
Showing 10 changed files with 394 additions and 82 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Test Android build
on:
pull_request:
paths:
- .github/workflows/build-android.yml
- android/**
- cpp/**
- example/package.json
- example/android/**
- react-native.config.js
merge_group:
branches:
- main
push:
branches:
- main
paths:
- .github/workflows/build-android.yml
- android/**
- cpp/**
- example/package.json
- example/android/**
- react-native.config.js

jobs:
build:
if: github.repository == 'Expensify/react-native-live-markdown'
runs-on: ubuntu-latest
concurrency:
group: build-android-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Setup Java 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Install node_modules
run: yarn install --immutable

- name: Build app
working-directory: example/android
run: ./gradlew assembleDebug --build-cache -PreactNativeArchitectures=arm64-v8a
77 changes: 77 additions & 0 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Test iOS build
on:
pull_request:
paths:
- .github/workflows/build-ios.yml
- RNLiveMarkdown.podspec
- ios/**
- cpp/**
- example/package.json
- example/ios/**
merge_group:
branches:
- main
push:
branches:
- main
paths:
- .github/workflows/build-ios.yml
- RNLiveMarkdown.podspec
- ios/**
- cpp/**
- example/package.json
- example/ios/**

jobs:
build:
if: github.repository == 'Expensify/react-native-live-markdown'
runs-on: macos-13
concurrency:
group: build-ios-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Restore node_modules from cache
uses: actions/cache@v4
with:
path: |
node_modules
example/node_modules
key: build-ios-node-modules-${{ hashFiles('yarn.lock') }}
restore-keys: build-ios-node-modules-

- name: Install node_modules
run: yarn install --immutable

- name: Restore Pods from cache
uses: actions/cache@v4
with:
path: |
example/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: build-ios-pods-${{ hashFiles('example/ios/Podfile.lock') }}
restore-keys: build-ios-pods-

- name: Install Pods
working-directory: example/ios
run: |
bundler install
bundler exec pod install
- name: Remove .xcode.env.local
working-directory: example/ios
run: rm -rf .xcode.env.local

- name: Restore build artifacts from cache
uses: actions/cache@v4
with:
path: ~/Library/Developer/Xcode/DerivedData
key: build-ios-derived-data-${{ hashFiles('example/ios/Podfile.lock') }}
restore-keys: build-ios-derived-data-

- name: Build app
working-directory: example
run: npx react-native@latest run-ios --no-packager
39 changes: 39 additions & 0 deletions .github/workflows/build-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test web build
on:
pull_request:
paths:
- .github/workflows/build-web.yml
- src/**
- WebExample/**
merge_group:
branches:
- main
push:
branches:
- main
paths:
- .github/workflows/build-web.yml
- src/**
- WebExample/**

jobs:
build:
if: github.repository == 'Expensify/react-native-live-markdown'
runs-on: ubuntu-latest
concurrency:
group: build-web-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Install node_modules
run: yarn install --immutable

- name: Install WebExample node_modules
working-directory: WebExample
run: npm ci

- name: Build app
working-directory: WebExample
run: npx expo export:web
64 changes: 64 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Typecheck, lint and test
on:
pull_request:
merge_group:
branches:
- main
push:
branches:
- main

jobs:
check:
if: github.repository == 'Expensify/react-native-live-markdown'
runs-on: ubuntu-latest
concurrency:
group: check-root-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install node_modules
run: yarn install --immutable

- name: Install parser node_modules
working-directory: parser
run: npm ci

- name: Install WebExample node_modules
working-directory: WebExample
run: npm ci

- name: Verify there's no parser diff
working-directory: parser
run: |
npm run build
if ! git diff --name-only --exit-code; then
# shellcheck disable=SC2016
echo 'Error: Parser diff detected! Please run `cd parser && npm run build` and commit the changes.'
exit 1
fi
- name: Typecheck library
run: yarn tsc --project tsconfig.json --noEmit

- name: Typecheck parser
run: yarn tsc --project parser/tsconfig.json --noEmit

- name: Typecheck example app
run: yarn tsc --project example/tsconfig.json --noEmit

- name: Typecheck WebExample app
run: yarn tsc --project WebExample/tsconfig.json --noEmit

- name: Lint
run: yarn lint

- name: Test
run: yarn test
103 changes: 103 additions & 0 deletions example/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.7)
base64
nkf
rexml
activesupport (7.0.8.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
base64 (0.2.0)
claide (1.1.0)
cocoapods (1.14.3)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.14.3)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-core (1.14.3)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
netrc (~> 0.11)
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (2.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.2.3)
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.16.3)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
json (2.7.2)
minitest (5.22.3)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
nkf (0.2.0)
public_suffix (4.0.7)
rexml (3.2.6)
ruby-macho (2.5.1)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.24.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)

PLATFORMS
ruby

DEPENDENCIES
activesupport (>= 6.1.7.5, < 7.1.0)
cocoapods (>= 1.13, < 1.15)

RUBY VERSION
ruby 2.7.8p225

BUNDLED WITH
2.1.4
Loading

0 comments on commit 0a6e54b

Please sign in to comment.