Skip to content

Commit 0793f6d

Browse files
wip: Migrating circleci to github actions
1 parent 5504dc3 commit 0793f6d

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed

.github/actions/ci/action.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Shared CI Workflow
2+
3+
inputs:
4+
java_version:
5+
description: 'The Java version to use.'
6+
required: true
7+
java_distribution:
8+
description: 'The Java distribution to use.'
9+
required: false
10+
default: temurin
11+
run_tests:
12+
description: 'If true, run unit tests, otherwise skip them.'
13+
required: false
14+
default: true
15+
16+
runs:
17+
using: composite
18+
steps:
19+
- name: Setup Java
20+
uses: actions/setup-java@v4
21+
with:
22+
distribution: ${{ inputs.java_distribution }}
23+
java-version: ${{ inputs.java_version }}
24+
25+
- name: Copy gradle.properties
26+
shell: bash
27+
run: |
28+
cp gradle.properties.example gradle.properties
29+
30+
- name: Restore Dependencies
31+
shell: bash
32+
run: ./gradlew dependencies
33+
34+
- name: Build Jar
35+
shell: bash
36+
id: buildjar
37+
run: ./gradlew jar
38+
39+
- name: Check Style
40+
shell: bash
41+
run: ./gradlew checkstyleMain
42+
43+
- name: Run Tests
44+
if: steps.buildjar.outcome == 'success' && inputs.run_tests == true
45+
shell: bash
46+
run: ./gradlew test

.github/workflows/build-test.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches: [main, feat/**, abarker/**]
6+
paths-ignore:
7+
- '**.md' #Do not need to run CI for markdown changes.
8+
pull_request:
9+
branches: [main, feat/**]
10+
paths-ignore:
11+
- '**.md'
12+
13+
jobs:
14+
# build-test-linux:
15+
# strategy:
16+
# matrix:
17+
# os: [ubuntu-latest]
18+
# # javaversion: [8, 11, 17, 19]
19+
# javaversion: [8]
20+
# runs-on: ${{ matrix.os }}
21+
# steps:
22+
# - uses: actions/checkout@v3
23+
24+
# - name: Shared CI Steps
25+
# uses: ./.github/actions/ci
26+
# with:
27+
# os_type: ubuntu
28+
# java_version: ${{ matrix.javaversion }}
29+
30+
# build-test-windows:
31+
# strategy:
32+
# matrix:
33+
# os: [windows-latest]
34+
# # javaversion: [11, 17]
35+
# javaversion: [11]
36+
# runs-on: ${{ matrix.os }}
37+
# steps:
38+
# - uses: actions/checkout@v3
39+
40+
# - name: Shared CI Steps
41+
# uses: ./.github/actions/ci
42+
# with:
43+
# os_type: windows
44+
# java_version: ${{ matrix.javaversion }}
45+
46+
build-test-android:
47+
runs-on: ubuntu-22.04
48+
steps:
49+
- uses: actions/checkout@v3
50+
51+
- name: Copy Tests
52+
shell: bash
53+
run: |
54+
rsync -r ./src/test/java/ ./src/androidTest/java/ --exclude='BaseTest.java'
55+
56+
- name: Enable KVM group perms (for performance)
57+
run: |
58+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
59+
sudo udevadm control --reload-rules
60+
sudo udevadm trigger --name-match=kvm
61+
62+
- name: Setup Android SDK
63+
uses: android-actions/setup-android@v3
64+
65+
- name: Run Tests
66+
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2
67+
with:
68+
api-level: 25
69+
target: google_apis
70+
emulator-boot-timeout: 900
71+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
72+
disable-animations: true
73+
script: |
74+
./gradlew -b build-android.gradle :assembleAndroidTest
75+
./gradlew -b build-android.gradle :connectedAndroidTest

0 commit comments

Comments
 (0)