Skip to content

Commit

Permalink
build: add or edit github actions (#8)
Browse files Browse the repository at this point in the history
Co-authored-by: axi92 <[email protected]>
  • Loading branch information
0x7061 and axi92 authored Sep 26, 2024
1 parent c087dd8 commit a5358a5
Show file tree
Hide file tree
Showing 18 changed files with 361 additions and 138 deletions.
53 changes: 53 additions & 0 deletions .github/actions/capacitor-setup-android/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 'capacitor-setup-android'
description: ''
runs:
using: 'composite'
steps:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Install Android SDK
uses: android-actions/setup-android@v3
- name: Enable KVM
shell: bash
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Cache node_modules
id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: node-modules
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
android/.gradle
~/.gradle/caches
key: gradle
- name: Cache Android SDK
id: android-sdk
uses: actions/cache@v4
with:
path: ~/Android/Sdk
key: android-sdk
- name: Cache AVD
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-29
- name: Npm Install
shell: bash
run: npm i
43 changes: 43 additions & 0 deletions .github/actions/capacitor-setup-ios/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'capacitor-setup-ios'
description: ''
runs:
using: 'composite'
steps:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Install Swift
uses: SwiftyLab/setup-swift@latest
with:
swift-version: '5.10.0'
- name: Cache node_modules
id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: node-modules
- name: Cache Pods
id: pods
uses: actions/cache@v4
with:
path: |
ios/Pods
key: pods
- name: Cache Xcode
uses: irgaly/[email protected]
with:
key: xcode-deriveddata
restore-keys: xcode-deriveddata
- name: Npm Install
shell: bash
run: npm i
- name: Pod Install
shell: bash
run: cd ios; pod install; cd -
19 changes: 19 additions & 0 deletions .github/actions/capacitor-setup-web/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'capacitor-setup-web'
description: ''
runs:
using: 'composite'
steps:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Cache node_modules
id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: node-modules
- name: Npm Install
shell: bash
run: npm i
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: build
on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
jobs:
build_web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Capacitor iOS
uses: ./.github/actions/capacitor-setup-web
- name: Run Build
run: npm run verify:web
build_ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup Capacitor iOS
uses: ./.github/actions/capacitor-setup-ios
- name: Run Build
env:
DEVELOPER_DIR: /Applications/Xcode_15.4.app
run: |
cd ios
xcodebuild \
-quiet \
-workspace Plugin.xcworkspace \
-scheme Plugin \
-destination 'platform=iOS Simulator,name=iPhone 15,OS=17.4'
build_android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Capacitor Android
uses: ./.github/actions/capacitor-setup-android
- name: Run Build
run: npm run verify:android
27 changes: 4 additions & 23 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
name: Cache
name: cache
on:
pull_request:
types:
- closed
jobs:
clear:
runs-on: ubuntu-latest
steps:
- name: Execute
run: |
gh extension install actions/gh-actions-cache
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | 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 }}
REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
cache_cleanup:
name: Clean up cache
uses: evva-sfw/workflows/.github/workflows/cache.yml@main
15 changes: 2 additions & 13 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint
name: lint
on:
push:
branches: [ 'main' ]
Expand All @@ -8,7 +8,7 @@ permissions:
id-token: write
attestations: write
jobs:
All:
lint_all:
runs-on: macos-latest
permissions:
id-token: write
Expand All @@ -29,15 +29,4 @@ jobs:
node_modules
key: node-modules
- run: npm i
- run: cd test-app && npm i
- run: npm run lint
- run: npm pack
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: package
path: '${{ github.workspace }}/*.tgz'
- name: Attest
uses: actions/attest-build-provenance@v1
with:
subject-path: '${{ github.workspace }}/*.tgz'
29 changes: 29 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: npm
on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
jobs:
npm_check-package-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Cache node_modules
id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
test-app/node_modules
key: node-modules
- name: NPM Install
run: npm i
- name: Check if git is clean
uses: CatChen/check-git-status-action@v1
with:
fail-if-not-clean: true
21 changes: 0 additions & 21 deletions .github/workflows/semantic-pr.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: semantic
on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened
permissions:
pull-requests: read
jobs:
semantic_pr-name:
name: semantic_pr-name
uses: evva-sfw/workflows/.github/workflows/semantic.yml@main
37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: test
on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
jobs:
test_ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup Capacitor iOS
uses: ./.github/actions/capacitor-setup-ios
- name: Run Tests
env:
DEVELOPER_DIR: /Applications/Xcode_15.4.app
run: |
cd ios
xcodebuild \
-quiet \
-workspace Plugin.xcworkspace \
-scheme Plugin \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 15,OS=17.4' \
test || exit 1
test_android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Capacitor Android
uses: ./.github/actions/capacitor-setup-android
- name: Run Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
working-directory: android/
script: ./gradlew clean build test connectedAndroidTest
12 changes: 9 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ext {
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
}

buildscript {
Expand Down Expand Up @@ -48,6 +48,12 @@ android {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
}
packagingOptions {
resources.excludes.add("META-INF/*")
}
}

repositories {
Expand All @@ -64,7 +70,7 @@ dependencies {
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation "androidx.core:core-ktx:$coreKtx"

implementation group: "com.evva.xesar", name: "abrevva-sdk-android", version: "1.0.19"
implementation group: "com.evva.xesar", name: "abrevva-sdk-android", version: "1.0.20"

testImplementation "junit:junit:$junitVersion"

Expand Down
19 changes: 19 additions & 0 deletions android/variables.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ext {
minSdkVersion = 29
compileSdkVersion = 34
targetSdkVersion = 34

androidxActivityVersion = '1.8.0'
androidxAppCompatVersion = '1.6.1'
androidxCoordinatorLayoutVersion = '1.2.0'
androidxCoreVersion = '1.12.0'
androidxFragmentVersion = '1.6.2'
androidxJunitVersion = '1.2.1'
androidxWebkitVersion = '1.9.0'

coreSplashScreenVersion = '1.0.1'

junitVersion = '4.13.2'
androidxEspressoCoreVersion = '3.6.1'
cordovaAndroidVersion = '10.1.1'
}
Loading

0 comments on commit a5358a5

Please sign in to comment.