Skip to content

Commit

Permalink
Merge pull request #65 from what3words/task/MT-7156-Migrate-CI-Pipeli…
Browse files Browse the repository at this point in the history
…ne-from-CircleCI-to-GitHub-Actions-for-Public-OCR-Component-Repository

Migrate CI pipeline from CircleCi to GitHub Actions
  • Loading branch information
phpduy authored Nov 11, 2024
2 parents 9d3a525 + ec12b4e commit 1315f3c
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 104 deletions.
104 changes: 0 additions & 104 deletions .circleci/config.yml

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/BuildTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build Test

on:
push:
branches:
- 'task/**'
- 'bug/**'
- 'fix/**'
- 'epic/**'

jobs:
build_test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Enable KVM group perms
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
ls /dev/kvm
- name: Setup Java 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Accept licenses
run: yes | sdkmanager --licenses || true

- name: Setup GMD
run: ./gradlew :lib:pixel6Api33Setup
--info
-Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"

- name: Build lib and run instrumentation tests
run: ./gradlew :lib:pixel6Api33DebugAndroidTest
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
-Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true
-Pandroid.experimental.androidTest.numManagedDeviceShards=1
-Pandroid.experimental.testOptions.managedDevices.maxConcurrentDevices=1
-Pandroid.experimental.testOptions.managedDevices.setupTimeoutMinutes=5

- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: test-results
path: lib/build/outputs/androidTest-results
50 changes: 50 additions & 0 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and Deploy to SonarType

on:
push:
branches:
- 'staging'
- 'epic/**'

jobs:
build_release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Enable KVM group perms
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
ls /dev/kvm
- name: Setup Java 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Restore gradle.properties
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
SIGNING_KEY_PWD: ${{ secrets.SIGNING_KEY_PWD }}
shell: bash
run: |
mkdir -p ~/.gradle/
echo "GRADLE_USER_HOME=${HOME}/.gradle" >> $GITHUB_ENV
echo "OSSRH_USERNAME=${OSSRH_USERNAME}">> ~/.gradle/gradle.properties
echo "OSSRH_PASSWORD=${OSSRH_PASSWORD}">> ~/.gradle/gradle.properties
echo "SIGNING_KEY=${GPG_SIGNING_KEY}">> ~/.gradle/gradle.properties
echo "SIGNING_KEY_PWD=${SIGNING_KEY_PWD}">> ~/.gradle/gradle.properties
cat ~/.gradle/gradle.properties
- name: Snapshot Release Check
run: |
echo -e "\nIS_SNAPSHOT_RELEASE=$( [[ "${CIRCLE_BRANCH}" =~ ^epic.* ]] && echo true || echo false )" >> gradle.properties
- name: Publish to Maven
run: ./gradlew assemble publish
12 changes: 12 additions & 0 deletions lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ android {
withSourcesJar()
}
}

testOptions {
managedDevices {
localDevices {
create("pixel6Api33") {
device = "Pixel 6"
apiLevel = 33
systemImageSource = "aosp"
}
}
}
}
}

dependencies {
Expand Down

0 comments on commit 1315f3c

Please sign in to comment.