Merge versions job into build-product to save on per-job overhead #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [master] | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build-product: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3.5.3 | |
- name: List Python versions | |
id: python-versions | |
run: | | |
( | |
echo "versions<<EOF" | |
target/list-versions.py --short | |
echo EOF | |
) >> $GITHUB_OUTPUT | |
- name: List Android Gradle plugin versions | |
id: agp-versions | |
run: | | |
cd product/gradle-plugin/src/test/integration/data | |
( | |
echo -n versions= | |
echo base-* | sed 's/base-//g' | jq -cR 'split(" ")' | |
) >> $GITHUB_OUTPUT | |
- uses: actions/setup-python@v4.6.1 | |
with: | |
python-version: ${{ steps.python-versions.outputs.versions }} | |
# This step is referenced from product/README.md. | |
- name: Download Android Python builds | |
run: | | |
cd target | |
for version in $(./list-versions.py --long); do | |
target_dir=../maven/com/chaquo/python/target/$version | |
./download-target.sh $target_dir | |
./unpackage-target.sh prefix $target_dir | |
done | |
- name: Install Python requirements | |
run: pip install -r product/runtime/requirements-build.txt | |
# TODO: move versions to a single location used by both CI and | |
# runtime/build.gradle. COMPILE_SDK_VERSION can then be removed from Common.java, | |
# since it's not used anywhere else. | |
- name: Set up Android SDK | |
run: | | |
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager \ | |
'cmake;3.22.1' 'ndk;22.1.7171670' 'platforms;android-30' | |
- uses: ./.github/actions/create-local-properties | |
- name: Build | |
run: | | |
cd product | |
./gradlew publish | |
- name: Upload Maven repository | |
uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: maven | |
# There's a fairly large per-file overhead, so exclude the hash files. | |
path: | | |
maven | |
!**/*.md5 | |
!**/*.sha1 | |
!**/*.sha256 | |
!**/*.sha512 | |
if-no-files-found: error | |
outputs: | |
python-versions: ${{ steps.python-versions.outputs.versions }} | |
agp-versions: ${{ steps.agp-versions.outputs.versions }} | |
test-integration: | |
needs: [build-product] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu] # TODO: macos, windows | |
agp-version: ["8.0"] # TODO: ${{ fromJSON(needs.build-product.outputs.agp-versions) }} | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- uses: actions/checkout@v3.5.3 | |
- uses: actions/setup-python@v4.6.1 | |
with: | |
python-version: ${{ needs.build-product.outputs.python-versions }} | |
- name: Download Maven repository | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
name: maven | |
path: maven | |
- name: Install Python requirements | |
run: | | |
python$(target/list-versions.py --default) -m \ | |
pip install -r product/gradle-plugin/src/test/integration/requirements.txt | |
- uses: ./.github/actions/create-local-properties | |
- name: Test | |
run: | | |
cd product | |
./gradlew testIntegration-${{ matrix.agp-version }} |