Skip to content

Commit

Permalink
Merge versions job into build-product to save on per-job overhead
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsmith committed Jul 19, 2023
1 parent 5ac45da commit 26ec8ae
Showing 1 changed file with 28 additions and 34 deletions.
62 changes: 28 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,48 +12,34 @@ defaults:
shell: bash

jobs:
versions:
name: List versions
build-product:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3.5.3

- id: python
- name: List Python versions
id: python-versions
run: |
cd target
echo default=$(./list-versions.py --default)
for mode in short long; do
echo "$mode<<EOF"
./list-versions.py --$mode
(
echo "versions<<EOF"
target/list-versions.py --short
echo EOF
done >> $GITHUB_OUTPUT
) >> $GITHUB_OUTPUT
- id: agp
- 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
outputs:
python-default: ${{ steps.python.outputs.default }}
python-short: ${{ steps.python.outputs.short }}
python-long: ${{ steps.python.outputs.long }}
agp: ${{ steps.agp.outputs.versions }}

build-product:
needs: versions
runs-on: macos-latest
steps:
- uses: actions/checkout@v3.5.3

- uses: actions/setup-python@v4.6.1
with:
python-version: ${{ needs.versions.outputs.python-short }}
python-version: ${{ steps.python-versions.outputs.versions }}

# This step uses a self-contained script rather than needs.versions,
# because it's referenced from product/README.md.
# This step is referenced from product/README.md.
- name: Download Android Python builds
run: |
cd target
Expand Down Expand Up @@ -85,24 +71,34 @@ jobs:
uses: actions/upload-artifact@v3.1.2
with:
name: maven
path: 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: [versions, build-product]
needs: [build-product]
strategy:
fail-fast: false
matrix:
os: [macos, ubuntu, windows]
agp-version: ${{ fromJSON(needs.versions.outputs.agp) }}
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.versions.outputs.python-short }}
python-version: ${{ needs.build-product.outputs.python-versions }}

- name: Download Maven repository
uses: actions/download-artifact@v3.0.2
Expand All @@ -112,14 +108,12 @@ jobs:

- name: Install Python requirements
run: |
python${{ needs.versions.outputs.python-default }} -m \
pip install -r gradle-plugin/src/test/integration/requirements.txt
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 }}

0 comments on commit 26ec8ae

Please sign in to comment.