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
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.name "github-actions[bot]"
git config --global user.email "gitea@catgirlsneed.homes"
git config --global user.name "Homeless Catgirl"
git status
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Update extensions repo"
git commit -m "Upload APKs"
git push
# Purge cached index on jsDelivr
curl https://purge.jsdelivr.net/gh/ItsLogic/ext@repo/index.min.json
else
echo "No changes to commit"
fi

View File

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

View File

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

View File

@ -19,7 +19,7 @@ env:
jobs:
prepare:
name: Prepare job
runs-on: self-hosted
runs-on: arch
outputs:
individualMatrix: ${{ steps.generate-matrices.outputs.individualMatrix }}
multisrcMatrix: ${{ steps.generate-matrices.outputs.multisrcMatrix }}
@ -66,15 +66,10 @@ jobs:
console.log(`Individual modules: ${numIndividualModules} (${numIndividualChunks} 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:
name: Build multisrc modules
needs: prepare
runs-on: self-hosted
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.multisrcMatrix) }}
runs-on: arch
steps:
- name: Checkout master branch
uses: actions/checkout@v4
@ -96,22 +91,20 @@ jobs:
with:
arguments: :multisrc:generateExtensions
- name: Build extensions (chunk ${{ matrix.chunk }})
- name: Build extensions
uses: gradle/gradle-build-action@v2
env:
CI_MULTISRC: "true"
CI_CHUNK_NUM: ${{ matrix.chunk }}
ALIAS: ${{ secrets.ALIAS }}
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
with:
arguments: assembleRelease
- name: Upload APKs (chunk ${{ matrix.chunk }})
- name: Upload APKs
uses: actions/upload-artifact@v3
if: "github.repository == 'ItsLogic/ext'"
with:
name: "multisrc-apks-${{ matrix.chunk }}"
name: "multisrc-apks"
path: "**/*.apk"
retention-days: 1
@ -121,9 +114,7 @@ jobs:
build_individual:
name: Build individual modules
needs: prepare
runs-on: self-hosted
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.individualMatrix) }}
runs-on: arch
steps:
- name: Checkout master branch
uses: actions/checkout@v4
@ -138,22 +129,20 @@ jobs:
run: |
echo ${{ secrets.SIGNING_KEY }} | base64 -d > signingkey.jks
- name: Build extensions (chunk ${{ matrix.chunk }})
- name: Build extensions
uses: gradle/gradle-build-action@v2
env:
CI_MULTISRC: "false"
CI_CHUNK_NUM: ${{ matrix.chunk }}
ALIAS: ${{ secrets.ALIAS }}
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
with:
arguments: assembleRelease
- name: Upload APKs (chunk ${{ matrix.chunk }})
- name: Upload APKs
uses: actions/upload-artifact@v3
if: "github.repository == 'ItsLogic/ext'"
with:
name: "individual-apks-${{ matrix.chunk }}"
name: "individual-apks"
path: "**/*.apk"
retention-days: 1
@ -165,8 +154,7 @@ jobs:
needs:
- build_multisrc
- build_individual
if: "github.repository == 'ItsLogic/ext'"
runs-on: ubuntu-latest
runs-on: arch
steps:
- name: Download APK artifacts
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)
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) {
include(":multisrc")
project(":multisrc").projectDir = File("multisrc")
// Loads generated extensions from multisrc
File(rootDir, "generated-src").getChunk(chunk, chunkSize)?.forEach {
val name = ":extensions:multisrc:${it.parentFile.name}:${it.name}"
println(name)
include(name)
project(name).projectDir = File("generated-src/${it.parentFile.name}/${it.name}")
File(rootDir, "generated-src").eachDir { dir ->
dir.eachDir { subdir ->
val name = ":extensions:multisrc:${dir.name}:${subdir.name}"
println(name)
include(name)
project(name).projectDir = File("generated-src/${dir.name}/${subdir.name}")
}
}
} else {
// Loads individual extensions
File(rootDir, "src").getChunk(chunk, chunkSize)?.forEach {
val name = ":extensions:individual:${it.parentFile.name}:${it.name}"
println(name)
include(name)
project(name).projectDir = File("src/${it.parentFile.name}/${it.name}")
File(rootDir, "src").eachDir { dir ->
dir.eachDir { subdir ->
val name = ":extensions:individual:${dir.name}:${subdir.name}"
println(name)
include(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}")
}
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) {
listFiles()?.filter { it.isDirectory }?.forEach { block(it) }
}
}