fix actions
CI / Prepare job (push) Successful in 49s Details
CI / Build multisrc modules (push) Successful in 2m10s Details
CI / Build individual modules (push) Successful in 45s Details
CI / Publish repo (push) Successful in 2m55s Details

This commit is contained in:
Draff 2024-01-09 03:14:00 +00:00
parent c0271a4046
commit f06f4e15e8
5 changed files with 34 additions and 68 deletions

View File

@ -2,16 +2,13 @@
set -e set -e
rsync -a --delete --exclude .git --exclude .gitignore ../master/repo/ . rsync -a --delete --exclude .git --exclude .gitignore ../master/repo/ .
git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.email "gitea@catgirlsneed.homes"
git config --global user.name "github-actions[bot]" git config --global user.name "Homeless Catgirl"
git status git status
if [ -n "$(git status --porcelain)" ]; then if [ -n "$(git status --porcelain)" ]; then
git add . git add .
git commit -m "Update extensions repo" git commit -m "Upload APKs"
git push git push
# Purge cached index on jsDelivr
curl https://purge.jsdelivr.net/gh/ItsLogic/ext@repo/index.min.json
else else
echo "No changes to commit" echo "No changes to commit"
fi fi

View File

@ -6,13 +6,12 @@ TOOLS="$(ls -d ${ANDROID_HOME}/build-tools/* | tail -1)"
mkdir -p repo/apk mkdir -p repo/apk
mkdir -p repo/icon mkdir -p repo/icon
cp -f apk/* repo/apk
cd repo cd repo
APKS=( ../apk/*".apk" ) APKS=( ../apk/*".apk" )
for APK in ${APKS[@]}; do for APK in ${APKS[@]}; do
cp $APK apk/
FILENAME=$(basename ${APK}) FILENAME=$(basename ${APK})
BADGING="$(${TOOLS}/aapt dump --include-meta-data badging $APK)" BADGING="$(${TOOLS}/aapt dump --include-meta-data badging $APK)"

View File

@ -16,10 +16,8 @@ env:
jobs: jobs:
prepare: prepare:
name: Prepare job name: Prepare job
runs-on: ubuntu-latest runs-on: arch
outputs: outputs:
individualMatrix: ${{ steps.generate-matrices.outputs.individualMatrix }}
multisrcMatrix: ${{ steps.generate-matrices.outputs.multisrcMatrix }}
isIndividualChanged: ${{ steps.parse-changed-files.outputs.isIndividualChanged }} isIndividualChanged: ${{ steps.parse-changed-files.outputs.isIndividualChanged }}
isMultisrcChanged: ${{ steps.parse-changed-files.outputs.isMultisrcChanged }} isMultisrcChanged: ${{ steps.parse-changed-files.outputs.isMultisrcChanged }}
env: env:
@ -100,9 +98,7 @@ jobs:
name: Build multisrc modules name: Build multisrc modules
needs: prepare needs: prepare
if: ${{ needs.prepare.outputs.isMultisrcChanged == '1' }} if: ${{ needs.prepare.outputs.isMultisrcChanged == '1' }}
runs-on: ubuntu-latest runs-on: arch
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.multisrcMatrix) }}
steps: steps:
- name: Checkout PR - name: Checkout PR
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -121,11 +117,10 @@ jobs:
arguments: :multisrc:generateExtensions arguments: :multisrc:generateExtensions
cache-read-only: true cache-read-only: true
- name: Build extensions (chunk ${{ matrix.chunk }}) - name: Build extensions)
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
env: env:
CI_MULTISRC: "true" CI_MULTISRC: "true"
CI_CHUNK_NUM: ${{ matrix.chunk }}
with: with:
arguments: assembleDebug arguments: assembleDebug
cache-read-only: true cache-read-only: true
@ -134,9 +129,7 @@ jobs:
name: Build individual modules name: Build individual modules
needs: prepare needs: prepare
if: ${{ needs.prepare.outputs.isIndividualChanged == '1' }} if: ${{ needs.prepare.outputs.isIndividualChanged == '1' }}
runs-on: ubuntu-latest runs-on: arch
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.individualMatrix) }}
steps: steps:
- name: Checkout PR - name: Checkout PR
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -147,11 +140,10 @@ jobs:
java-version: 11 java-version: 11
distribution: adopt distribution: adopt
- name: Build extensions (chunk ${{ matrix.chunk }}) - name: Build extensions
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
env: env:
CI_MULTISRC: "false" CI_MULTISRC: "false"
CI_CHUNK_NUM: ${{ matrix.chunk }}
with: with:
arguments: assembleDebug arguments: assembleDebug
cache-read-only: true cache-read-only: true

View File

@ -19,7 +19,7 @@ env:
jobs: jobs:
prepare: prepare:
name: Prepare job name: Prepare job
runs-on: self-hosted runs-on: arch
outputs: outputs:
individualMatrix: ${{ steps.generate-matrices.outputs.individualMatrix }} individualMatrix: ${{ steps.generate-matrices.outputs.individualMatrix }}
multisrcMatrix: ${{ steps.generate-matrices.outputs.multisrcMatrix }} multisrcMatrix: ${{ steps.generate-matrices.outputs.multisrcMatrix }}
@ -66,15 +66,10 @@ jobs:
console.log(`Individual modules: ${numIndividualModules} (${numIndividualChunks} chunks of ${chunkSize})`); console.log(`Individual modules: ${numIndividualModules} (${numIndividualChunks} chunks of ${chunkSize})`);
console.log(`Multi-source modules: ${numMultisrcModules} (${numMultisrcChunks} chunks of ${chunkSize})`); console.log(`Multi-source modules: ${numMultisrcModules} (${numMultisrcChunks} chunks of ${chunkSize})`);
core.setOutput('individualMatrix', { 'chunk': [...Array(numIndividualChunks).keys()] });
core.setOutput('multisrcMatrix', { 'chunk': [...Array(numMultisrcChunks).keys()] });
build_multisrc: build_multisrc:
name: Build multisrc modules name: Build multisrc modules
needs: prepare needs: prepare
runs-on: self-hosted runs-on: arch
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.multisrcMatrix) }}
steps: steps:
- name: Checkout master branch - name: Checkout master branch
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -96,22 +91,20 @@ jobs:
with: with:
arguments: :multisrc:generateExtensions arguments: :multisrc:generateExtensions
- name: Build extensions (chunk ${{ matrix.chunk }}) - name: Build extensions
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
env: env:
CI_MULTISRC: "true" CI_MULTISRC: "true"
CI_CHUNK_NUM: ${{ matrix.chunk }}
ALIAS: ${{ secrets.ALIAS }} ALIAS: ${{ secrets.ALIAS }}
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} KEY_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
with: with:
arguments: assembleRelease arguments: assembleRelease
- name: Upload APKs (chunk ${{ matrix.chunk }}) - name: Upload APKs
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: "github.repository == 'ItsLogic/ext'"
with: with:
name: "multisrc-apks-${{ matrix.chunk }}" name: "multisrc-apks"
path: "**/*.apk" path: "**/*.apk"
retention-days: 1 retention-days: 1
@ -121,9 +114,7 @@ jobs:
build_individual: build_individual:
name: Build individual modules name: Build individual modules
needs: prepare needs: prepare
runs-on: self-hosted runs-on: arch
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.individualMatrix) }}
steps: steps:
- name: Checkout master branch - name: Checkout master branch
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -138,22 +129,20 @@ jobs:
run: | run: |
echo ${{ secrets.SIGNING_KEY }} | base64 -d > signingkey.jks echo ${{ secrets.SIGNING_KEY }} | base64 -d > signingkey.jks
- name: Build extensions (chunk ${{ matrix.chunk }}) - name: Build extensions
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
env: env:
CI_MULTISRC: "false" CI_MULTISRC: "false"
CI_CHUNK_NUM: ${{ matrix.chunk }}
ALIAS: ${{ secrets.ALIAS }} ALIAS: ${{ secrets.ALIAS }}
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} KEY_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
with: with:
arguments: assembleRelease arguments: assembleRelease
- name: Upload APKs (chunk ${{ matrix.chunk }}) - name: Upload APKs
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: "github.repository == 'ItsLogic/ext'"
with: with:
name: "individual-apks-${{ matrix.chunk }}" name: "individual-apks"
path: "**/*.apk" path: "**/*.apk"
retention-days: 1 retention-days: 1
@ -165,8 +154,7 @@ jobs:
needs: needs:
- build_multisrc - build_multisrc
- build_individual - build_individual
if: "github.repository == 'ItsLogic/ext'" runs-on: arch
runs-on: ubuntu-latest
steps: steps:
- name: Download APK artifacts - name: Download APK artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3

View File

@ -25,27 +25,29 @@ if (System.getenv("CI") == null || System.getenv("CI_MODULE_GEN") == "true") {
// Running in CI (GitHub Actions) // Running in CI (GitHub Actions)
val isMultisrc = System.getenv("CI_MULTISRC") == "true" val isMultisrc = System.getenv("CI_MULTISRC") == "true"
val chunkSize = System.getenv("CI_CHUNK_SIZE").toInt()
val chunk = System.getenv("CI_CHUNK_NUM").toInt()
if (isMultisrc) { if (isMultisrc) {
include(":multisrc") include(":multisrc")
project(":multisrc").projectDir = File("multisrc") project(":multisrc").projectDir = File("multisrc")
// Loads generated extensions from multisrc // Loads generated extensions from multisrc
File(rootDir, "generated-src").getChunk(chunk, chunkSize)?.forEach { File(rootDir, "generated-src").eachDir { dir ->
val name = ":extensions:multisrc:${it.parentFile.name}:${it.name}" dir.eachDir { subdir ->
val name = ":extensions:multisrc:${dir.name}:${subdir.name}"
println(name) println(name)
include(name) include(name)
project(name).projectDir = File("generated-src/${it.parentFile.name}/${it.name}") project(name).projectDir = File("generated-src/${dir.name}/${subdir.name}")
}
} }
} else { } else {
// Loads individual extensions // Loads individual extensions
File(rootDir, "src").getChunk(chunk, chunkSize)?.forEach { File(rootDir, "src").eachDir { dir ->
val name = ":extensions:individual:${it.parentFile.name}:${it.name}" dir.eachDir { subdir ->
val name = ":extensions:individual:${dir.name}:${subdir.name}"
println(name) println(name)
include(name) include(name)
project(name).projectDir = File("src/${it.parentFile.name}/${it.name}") project(name).projectDir = File("src/${dir.name}/${subdir.name}")
}
} }
} }
} }
@ -79,18 +81,6 @@ fun loadGeneratedMultisrcExtension(lang: String, name: String) {
project(projectName).projectDir = File("generated-src/${lang}/${name}") project(projectName).projectDir = File("generated-src/${lang}/${name}")
} }
fun File.getChunk(chunk: Int, chunkSize: Int): List<File>? {
return listFiles()
// Lang folder
?.filter { it.isDirectory }
// Extension subfolders
?.mapNotNull { dir -> dir.listFiles()?.filter { it.isDirectory } }
?.flatten()
?.sortedBy { it.name }
?.chunked(chunkSize)
?.get(chunk)
}
fun File.eachDir(block: (File) -> Unit) { fun File.eachDir(block: (File) -> Unit) {
listFiles()?.filter { it.isDirectory }?.forEach { block(it) } listFiles()?.filter { it.isDirectory }?.forEach { block(it) }
} }