Skip to content

Commit

Permalink
Merge pull request #944 from EldersJavas/dev
Browse files Browse the repository at this point in the history
[CI] Improve CI & Add Nightly Build &other
  • Loading branch information
longjunyu2 authored Feb 21, 2021
2 parents 635e516 + fdbaa6e commit 4b348f9
Show file tree
Hide file tree
Showing 3 changed files with 326 additions and 16 deletions.
150 changes: 150 additions & 0 deletions .github/workflows/APK_Debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
name: APK Debug
on:
push:
paths-ignore:
- '**/*.md'
- .gitignore
- .editorconfig
- appveyor.yml
- 'azure-pipelines*.yml'
- 'ci/azure-pipelines/template*.yml'

pull_request:
paths-ignore:
- '**/*.md'
- .gitignore
- .editorconfig
- appveyor.yml
- 'azure-pipelines*.yml'
- 'ci/azure-pipelines/template*.yml'

jobs:
#Prepare:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Build MCinaBox APK with Gradle
# run: |
# chmod +x gradlew
# ./gradlew clean :app:assembleDebug
# - name: Upload APK
# uses: actions/upload-artifact@v2
# with:
# name: app-debug
# path: app/build/outputs/apk/debug/app-debug.apk

build_on_Windows:
name: Build on Windows
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/[email protected]
with:
java-version: 1.8
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
#保存cache时在Windows里遇到权限问题(太懒还没修复) :)

- name: Build MCinaBox Debug (with gradle)
run: |
chmod +x gradlew
./gradlew clean :app:assembleDebug
shell: bash
- name: Change APK name
run: |
mv app/build/outputs/apk/debug/app-debug.apk app/build/outputs/apk/debug/MCinaBox-${{ runner.os }}-Debug.apk
shell: bash
- name: Upload All Pack
uses: actions/upload-artifact@v2
with:
name: MCinaBox-${{ runner.os }}-DebugPack
path: app/build/outputs
- name: Upload APK
uses: actions/upload-artifact@v2
with:
name: MCinaBox-${{ runner.os }}-Debug.apk
path: app/build/outputs/apk/debug/MCinaBox-${{ runner.os }}-Debug.apk

build_on_Ubuntu:
name: Build on Ubuntu
runs-on: Ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/[email protected]
with:
java-version: 1.8
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build MCinaBox Debug (with gradle)
run: |
chmod +x gradlew
./gradlew clean :app:assembleDebug
shell: bash
- name: Change APK name
run: |
mv app/build/outputs/apk/debug/app-debug.apk app/build/outputs/apk/debug/MCinaBox-${{ runner.os }}-Debug.apk
shell: bash
- name: Upload All Pack
uses: actions/upload-artifact@v2
with:
name: MCinaBox-${{ runner.os }}-DebugPack
path: app/build/outputs
- name: Upload APK
uses: actions/upload-artifact@v2
with:
name: MCinaBox-${{ runner.os }}-Debug.apk
path: app/build/outputs/apk/debug/MCinaBox-${{ runner.os }}-Debug.apk

build_on_MacOS:
name: Build on MacOS
runs-on: MacOS-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/[email protected]
with:
java-version: 1.8
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build MCinaBox Debug (with gradle)
run: |
chmod +x gradlew
./gradlew clean :app:assembleDebug
shell: bash
- name: Change APK name
run: |
mv app/build/outputs/apk/debug/app-debug.apk app/build/outputs/apk/debug/MCinaBox-${{ runner.os }}-Debug.apk
shell: bash
- name: Upload All Pack
uses: actions/upload-artifact@v2
with:
name: MCinaBox-${{ runner.os }}-DebugPack
path: app/build/outputs
- name: Upload APK
uses: actions/upload-artifact@v2
with:
name: MCinaBox-${{ runner.os }}-Debug.apk
path: app/build/outputs/apk/debug/MCinaBox-${{ runner.os }}-Debug.apk
176 changes: 176 additions & 0 deletions .github/workflows/APK_Release_Nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
name: APK Release Nightly Build
on:
workflow_dispatch:
inputs:
Reason:
description: 'Reasons for temporary build'
required: true
default: 'No reason.Just do it.'
schedule:
- cron: '0 16 * * *'

# 北京时间0点开始构建,环境时间也重置成北京时间了哦 PS:<del>抱歉了世界各国朋友们</del>(这里标签没用...)
# 0:00 Beijing time (zone)

jobs:
#Prepare:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Build MCinaBox APK with Gradle
# run: |
# chmod +x gradlew
# ./gradlew clean :app:assembleRelease
# - name: Upload APK
# uses: actions/upload-artifact@v2
# with:
# name: app-debug
# path: app/build/outputs/apk/debug/app-debug.apk

# build_on_Windows:
# name: Build on Windows
# runs-on: windows-latest
#
# steps:
# - name: Setup timezone
# uses: zcong1993/setup-timezone@master
# with:
# timezone: Asia/Shanghai
#
# - name: Get current time
# uses: srfrnk/current-time@master
# id: current-time
# with:
# format: YYYY-MM-DD
#
# - uses: actions/checkout@v2
# - name: Set up JDK 1.8
# uses: actions/[email protected]
# with:
# java-version: 1.8
# - uses: actions/cache@v2
# with:
# path: |
# ~/.gradle/caches
# ~/.gradle/wrapper
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-
# - name: Build MCinaBox Release (with gradle)
# run: |
# chmod +x gradlew
# ./gradlew clean :app:assembleRelease
# shell: bash
# - name: Change APK name
# run: |
# mv app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/MCinaBox-${{ runner.os }}-Release-${{ steps.current-time.outputs.formattedTime }}.apk
# shell: bash
# - name: Upload All Pack
# uses: actions/upload-artifact@v2
# with:
# name: MCinaBox-${{ runner.os }}-ReleasePack-${{ steps.current-time.outputs.formattedTime }}
# path: app/build/outputs
# - name: Upload APK
# uses: actions/upload-artifact@v2
# with:
# name: MCinaBox-${{ runner.os }}-Release-${{ steps.current-time.outputs.formattedTime }}.apk
# path: app/build/outputs/apk/release/MCinaBox-${{ runner.os }}-Release-${{ steps.current-time.outputs.formattedTime }}.apk

build_on_Ubuntu:
name: Build on Ubuntu
runs-on: Ubuntu-latest

steps:
- name: Setup timezone
uses: zcong1993/setup-timezone@master
with:
timezone: Asia/Shanghai
#这玩意暂时只能用在Ubuntu,正在找其他系统解决方案

- name: Get current time
uses: srfrnk/current-time@master
id: current-time
with:
format: YYYY-MM-DD
#暂不知道这玩意是不是取的本地时间

- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/[email protected]
with:
java-version: 1.8
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build MCinaBox Release (with gradle)
run: |
chmod +x gradlew
./gradlew clean :app:assembleRelease
shell: bash
- name: Change APK name
run: |
mv app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/MCinaBox-${{ runner.os }}-Release-${{ steps.current-time.outputs.formattedTime }}.apk
shell: bash
- name: Upload All Pack
uses: actions/upload-artifact@v2
with:
name: MCinaBox-${{ runner.os }}-ReleasePack-${{ steps.current-time.outputs.formattedTime }}
path: app/build/outputs
- name: Upload APK
uses: actions/upload-artifact@v2
with:
name: MCinaBox-${{ runner.os }}-Release-${{ steps.current-time.outputs.formattedTime }}.apk
path: app/build/outputs/apk/release/MCinaBox-${{ runner.os }}-Release-${{ steps.current-time.outputs.formattedTime }}.apk

# build_on_MacOS:
# name: Build on MacOS
# runs-on: MacOS-latest
#
# steps:
# - name: Setup timezone
# uses: zcong1993/setup-timezone@master
# with:
# timezone: Asia/Shanghai
#
# - name: Get current time
# uses: srfrnk/current-time@master
# id: current-time
# with:
# format: YYYY-MM-DD
# - uses: actions/checkout@v2
# - name: Set up JDK 1.8
# uses: actions/[email protected]
# with:
# java-version: 1.8
# - uses: actions/cache@v2
# with:
# path: |
# ~/.gradle/caches
# ~/.gradle/wrapper
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-
# - name: Build MCinaBox Release (with gradle)
# run: |
# chmod +x gradlew
# ./gradlew clean :app:assembleRelease
# shell: bash
# - name: Change APK name
# run: |
# mv app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/MCinaBox-${{ runner.os }}-Release-${{ steps.current-time.outputs.formattedTime }}.apk
# shell: bash
# - name: Upload All Pack
# uses: actions/upload-artifact@v2
# with:
# name: MCinaBox-${{ runner.os }}-ReleasePack-${{ steps.current-time.outputs.formattedTime }}
# path: app/build/outputs
# - name: Upload APK
# uses: actions/upload-artifact@v2
# with:
# name: MCinaBox-${{ runner.os }}-Release-${{ steps.current-time.outputs.formattedTime }}.apk
# path: app/build/outputs/apk/release/MCinaBox-${{ runner.os }}-Release-${{ steps.current-time.outputs.formattedTime }}.apk
16 changes: 0 additions & 16 deletions .github/workflows/android_ci.yml

This file was deleted.

0 comments on commit 4b348f9

Please sign in to comment.