Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
test CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Thaumy committed Feb 12, 2023
1 parent 93f1568 commit 45cb272
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 13 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build & Release

on:
push:
branches: [ "main" ]
tags:
- "v*.*.*"
pull_request:
branches: [ "main" ]
workflow_dispatch:

permissions:
contents: write

jobs:

build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for protoc.sh
run: chmod +x protoc.sh
- name: Compile proto files
run: ./protoc.sh

- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build

- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: apk
path: app/build/outputs/apk/debug/app-debug.apk

release:
needs: build

if: startsWith(github.event.ref, 'refs/tags/v')

runs-on: ubuntu-latest
steps:

- name: Download APK from build
uses: actions/download-artifact@v3
with:
name: apk
path: artifact

- name: Rename APK
run: |
cd artifact
mv app-debug.apk jiligulu.apk
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: artifact/jiligulu.apk

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.*
build
!.github
build
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ dependencies {
implementation("androidx.compose.material:material:1.3.1")

val grpcKotlinVersion = "1.3.0"
val grpcVersion = "1.52.1"
val grpcVersion = "1.53.0"
val protobufVersion = "3.21.12"
implementation("io.grpc:grpc-kotlin-stub:$grpcKotlinVersion")
implementation("io.grpc:grpc-protobuf:$grpcVersion")
Expand Down
2 changes: 2 additions & 0 deletions bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
3 changes: 2 additions & 1 deletion grpc_kotlin_plugin.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env bash

declare protoc_gen_grpc_kotlin_jar_path=$HOME/.gradle/caches/modules-2/files-2.1/io.grpc/protoc-gen-grpc-kotlin/1.3.0/cb20cb447ec7c77d59d118580db3630c92b9b0bb/protoc-gen-grpc-kotlin-1.3.0-jdk8.jar
declare protoc_gen_grpc_kotlin_jar_path=./bin/protoc_gen_grpc_kotlin.jar

java -jar $protoc_gen_grpc_kotlin_jar_path $@

37 changes: 27 additions & 10 deletions protoc.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
#!/usr/bin/env bash

declare protoc_path=$HOME/.gradle/caches/modules-2/files-2.1/com.google.protobuf/protoc/3.21.12/62e794ebd383cad86347240f1c9b419c8d8fce10/protoc-3.21.12-linux-x86_64.exe
declare grpc_java_plugin_path=$HOME/.gradle/caches/modules-2/files-2.1/io.grpc/protoc-gen-grpc-java/1.51.3/6733a1769899769a54df42ad185108405b695b65/protoc-gen-grpc-java-1.51.3-linux-x86_64.exe
declare grpc_kotlin_plugin_path=./grpc_kotlin_plugin.sh
mkdir -p bin

declare in_root=./app/src/grpc_proto
declare java_out_root=./app/src/main/java
declare kotlin_out_root=./app/src/main/kotlin
rm -f bin/.gitignore
touch bin/.gitignore
printf "*\n!.gitignore" > bin/.gitignore

wget -nc -O bin/protoc "https://search.maven.org/remotecontent?filepath=com/google/protobuf/protoc/3.21.12/protoc-3.21.12-linux-x86_64.exe"
wget -nc -O bin/grpc_java_plugin "https://search.maven.org/remotecontent?filepath=io/grpc/protoc-gen-grpc-java/1.53.0/protoc-gen-grpc-java-1.53.0-linux-x86_64.exe"
wget -nc -O bin/protoc_gen_grpc_kotlin.jar "https://search.maven.org/remotecontent?filepath=io/grpc/protoc-gen-grpc-kotlin/1.3.0/protoc-gen-grpc-kotlin-1.3.0-jdk8.jar"

chmod +x bin/protoc
chmod +x bin/grpc_java_plugin

declare protoc_path=bin/protoc
declare grpc_java_plugin_path=bin/grpc_java_plugin
declare grpc_kotlin_plugin_path=grpc_kotlin_plugin.sh

declare in_root=app/src/grpc_proto
declare java_out_root=app/src/main/java
declare kotlin_out_root=app/src/main/kotlin

rm -rf $java_out_root/grpc_code_gen
rm -rf $kotlin_out_root/grpc_code_gen

mkdir $java_out_root/grpc_code_gen
mkdir $kotlin_out_root/grpc_code_gen

touch $java_out_root/grpc_code_gen/.gitignore
printf "*\n!.gitignore" > $java_out_root/grpc_code_gen/.gitignore
touch $kotlin_out_root/grpc_code_gen/.gitignore
printf "*\n!.gitignore" > $kotlin_out_root/grpc_code_gen/.gitignore

$protoc_path \
--plugin=protoc-gen-grpc-java=$grpc_java_plugin_path \
--plugin=protoc-gen-grpc-kotlin=$grpc_kotlin_plugin_path \
Expand Down Expand Up @@ -41,7 +62,3 @@ $protoc_path \
--grpc-kotlin_out=$kotlin_out_root \
$in_root/token/*.proto

touch $java_out_root/grpc_code_gen/.gitignore
printf "*\n!.gitignore" > $java_out_root/grpc_code_gen/.gitignore
touch $kotlin_out_root/grpc_code_gen/.gitignore
printf "*\n!.gitignore" > $kotlin_out_root/grpc_code_gen/.gitignore

0 comments on commit 45cb272

Please sign in to comment.