Skip to content

Commit

Permalink
try to make CI faster (#115)
Browse files Browse the repository at this point in the history
* try to make CI faster

* more parallel
  • Loading branch information
briantist authored Oct 9, 2023
1 parent d5822c6 commit eac159a
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@ jobs:
- name: Coverage
uses: codecov/codecov-action@v3

build:
needs: [test]

build-container:
permissions:
contents: read
runs-on: ubuntu-latest
strategy:
matrix:
platform: [arm64, amd64]
outputs:
container-description: ${{ steps.description.outputs.container-description }}
steps:
Expand All @@ -69,9 +72,11 @@ jobs:
show-progress: false

- name: Set up QEMU
if: matrix.platform == 'arm64'
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
if: matrix.platform == 'arm64'
uses: docker/setup-buildx-action@v3

- name: Build amd64
Expand All @@ -80,10 +85,11 @@ jobs:
push: false
context: .
load: true
platforms: linux/amd64
platforms: linux/${{ matrix.platform }}
tags: galactory:latest

- name: Run container
if: matrix.platform == 'amd64'
run: docker run --rm galactory --help

- name: Extract container description
Expand All @@ -92,17 +98,19 @@ jobs:
DESC=$(docker inspect --format '{{ index .Config.Labels "org.opencontainers.image.description" }}' galactory)
echo "container-description=$DESC" | tee --append $GITHUB_OUTPUT
- name: Build arm64
uses: docker/build-push-action@v5
build-python:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
push: false
context: .
platforms: linux/arm64
tags: galactory:latest
show-progress: false

- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'

- name: Pre-reqs
run: pip install --upgrade pip setuptools build twine
Expand All @@ -117,7 +125,7 @@ jobs:
id: checkver
if: startsWith(github.ref, 'refs/tags/')
run: |
VER_TAG=${{ needs.test.outputs.relver }}
VER_TAG=${GITHUB_REF/refs\/tags\/v/}
expected_sdist=galactory-${VER_TAG}.tar.gz
expected_wheel=galactory-${VER_TAG}-py3-none-any.whl
Expand All @@ -136,7 +144,7 @@ jobs:


container_release:
needs: [test, build]
needs: [test, build-container]
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -172,10 +180,11 @@ jobs:
tags: |
${{ env.UPSTREAM }}:${{ startsWith(github.ref, 'refs/tags/') && 'latest' || needs.test.outputs.branch }}
${{ env.UPSTREAM }}:${{ startsWith(github.ref, 'refs/tags/') && needs.test.outputs.relver || github.sha }}
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=${{ needs.build.outputs.container-description }}
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=${{ needs.build-container.outputs.container-description }}


pypi_release:
needs: [test, build]
needs: [test, build-python]
if: >-
github.event_name == 'push'
&& startsWith(github.ref, 'refs/tags/')
Expand All @@ -195,7 +204,8 @@ jobs:
github_release:
needs:
- test
- build
- build-container
- build-python
- container_release
- pypi_release
if: >-
Expand Down

0 comments on commit eac159a

Please sign in to comment.