Skip to content

Commit 7d20e43

Browse files
authored
Build containers in parallel and pre-check (#954)
* Build containers in parallel and pre-check * Fix loop in workflow * Test container needs build
1 parent 32acdcb commit 7d20e43

File tree

1 file changed

+171
-42
lines changed

1 file changed

+171
-42
lines changed

.github/workflows/test-library.yml

Lines changed: 171 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,66 @@ jobs:
540540
flags: pytest, GHA, Python ${{ matrix.python }}, ${{ runner.os }}
541541
verbose: true
542542

543+
test-container:
544+
runs-on: Ubuntu-latest
545+
permissions:
546+
packages: write
547+
if: success()
548+
needs:
549+
- pre-setup # transitive, for accessing settings
550+
- build
551+
name: 🐳 Build & Test
552+
strategy:
553+
fail-fast: false
554+
steps:
555+
- name: Checkout
556+
uses: actions/checkout@v2
557+
with:
558+
ref: ${{ github.event.inputs.release-commitish }}
559+
- name: Download all the dists
560+
uses: actions/download-artifact@v2
561+
with:
562+
name: python-package-distributions
563+
path: dist/
564+
- name: Set up Docker Buildx
565+
id: buildx
566+
uses: docker/setup-buildx-action@v1
567+
# See https://github.com/docker/buildx/issues/850#issuecomment-996408167
568+
with:
569+
version: v0.7.0
570+
buildkitd-flags: --debug
571+
config: .github/buildkitd.toml
572+
install: true
573+
- name: Enable Multiarch # This slows down arm build by 4-5x
574+
run: |
575+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
576+
- name: Create builder
577+
run: |
578+
docker buildx create --name proxypybuilder
579+
docker buildx use proxypybuilder
580+
docker buildx inspect
581+
docker buildx ls
582+
- name: Build, run & test container
583+
run: >-
584+
CONTAINER_TAG="abhinavsingh/proxy.py:${{
585+
needs.pre-setup.outputs.container-version
586+
}}";
587+
docker buildx build
588+
--load
589+
--build-arg PROXYPY_PKG_PATH='dist/${{
590+
needs.pre-setup.outputs.wheel-artifact-name
591+
}}'
592+
-t $CONTAINER_TAG .
593+
&&
594+
docker run
595+
-d
596+
-p 8899:8899
597+
$CONTAINER_TAG
598+
--hostname 0.0.0.0
599+
--enable-web-server
600+
&&
601+
./tests/integration/test_integration.sh 8899
602+
543603
analyze:
544604
runs-on: ubuntu-latest
545605
name: 🛡️ Analyze
@@ -672,34 +732,15 @@ jobs:
672732
make ca-certificates
673733
python3 -m proxy --version
674734
675-
check: # This job does nothing and is only used for the branch protection
676-
if: always()
677-
678-
needs:
679-
- analyze
680-
- test
681-
- lint
682-
- dashboard
683-
- brew
684-
- developer
685-
686-
runs-on: Ubuntu-latest
687-
688-
steps:
689-
- name: Decide whether the needed jobs succeeded or failed
690-
uses: re-actors/alls-green@release/v1
691-
with:
692-
jobs: ${{ toJSON(needs) }}
693-
694-
docker:
735+
ghcr-latest:
695736
runs-on: Ubuntu-latest
696737
permissions:
697738
packages: write
698739
if: success()
699740
needs:
700-
- check
741+
- test-container
701742
- pre-setup # transitive, for accessing settings
702-
name: 🐳 containerize
743+
name: 🐳 ghcr:latest
703744
strategy:
704745
fail-fast: false
705746
steps:
@@ -736,26 +777,6 @@ jobs:
736777
docker buildx use proxypybuilder
737778
docker buildx inspect
738779
docker buildx ls
739-
- name: Build, run & test container
740-
run: >-
741-
CONTAINER_TAG="abhinavsingh/proxy.py:${{
742-
needs.pre-setup.outputs.container-version
743-
}}";
744-
docker buildx build
745-
--load
746-
--build-arg PROXYPY_PKG_PATH='dist/${{
747-
needs.pre-setup.outputs.wheel-artifact-name
748-
}}'
749-
-t $CONTAINER_TAG .
750-
&&
751-
docker run
752-
-d
753-
-p 8899:8899
754-
$CONTAINER_TAG
755-
--hostname 0.0.0.0
756-
--enable-web-server
757-
&&
758-
./tests/integration/test_integration.sh 8899
759780
- name: Push to GHCR
760781
run: >-
761782
REGISTRY_URL="ghcr.io/abhinavsingh/proxy.py";
@@ -794,6 +815,52 @@ jobs:
794815
needs.pre-setup.outputs.wheel-artifact-name
795816
}}'
796817
-t $LATEST_TAG .
818+
819+
ghcr-openssl:
820+
runs-on: Ubuntu-latest
821+
permissions:
822+
packages: write
823+
if: success()
824+
needs:
825+
- test-container
826+
- pre-setup # transitive, for accessing settings
827+
name: 🐳 ghcr:openssl
828+
strategy:
829+
fail-fast: false
830+
steps:
831+
- name: Checkout
832+
uses: actions/checkout@v2
833+
with:
834+
ref: ${{ github.event.inputs.release-commitish }}
835+
- name: Download all the dists
836+
uses: actions/download-artifact@v2
837+
with:
838+
name: python-package-distributions
839+
path: dist/
840+
- name: Login to GHCR
841+
uses: docker/login-action@v1
842+
with:
843+
registry: ghcr.io
844+
username: ${{ github.actor }}
845+
password: ${{ secrets.GITHUB_TOKEN }}
846+
- name: Set up Docker Buildx
847+
id: buildx
848+
uses: docker/setup-buildx-action@v1
849+
# See https://github.com/docker/buildx/issues/850#issuecomment-996408167
850+
with:
851+
version: v0.7.0
852+
buildkitd-flags: --debug
853+
config: .github/buildkitd.toml
854+
install: true
855+
- name: Enable Multiarch # This slows down arm build by 4-5x
856+
run: |
857+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
858+
- name: Create builder
859+
run: |
860+
docker buildx create --name proxypybuilder
861+
docker buildx use proxypybuilder
862+
docker buildx inspect
863+
docker buildx ls
797864
- name: Push openssl to GHCR
798865
run: >-
799866
REGISTRY_URL="ghcr.io/abhinavsingh/proxy.py";
@@ -830,6 +897,46 @@ jobs:
830897
needs.pre-setup.outputs.wheel-artifact-name
831898
}}'
832899
-t $LATEST_TAG .
900+
901+
docker-latest:
902+
runs-on: Ubuntu-latest
903+
permissions:
904+
packages: write
905+
if: success()
906+
needs:
907+
- test-container
908+
- pre-setup # transitive, for accessing settings
909+
name: 🐳 docker:latest
910+
strategy:
911+
fail-fast: false
912+
steps:
913+
- name: Checkout
914+
uses: actions/checkout@v2
915+
with:
916+
ref: ${{ github.event.inputs.release-commitish }}
917+
- name: Download all the dists
918+
uses: actions/download-artifact@v2
919+
with:
920+
name: python-package-distributions
921+
path: dist/
922+
- name: Set up Docker Buildx
923+
id: buildx
924+
uses: docker/setup-buildx-action@v1
925+
# See https://github.com/docker/buildx/issues/850#issuecomment-996408167
926+
with:
927+
version: v0.7.0
928+
buildkitd-flags: --debug
929+
config: .github/buildkitd.toml
930+
install: true
931+
- name: Enable Multiarch # This slows down arm build by 4-5x
932+
run: |
933+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
934+
- name: Create builder
935+
run: |
936+
docker buildx create --name proxypybuilder
937+
docker buildx use proxypybuilder
938+
docker buildx inspect
939+
docker buildx ls
833940
- name: Login to DockerHub
834941
uses: docker/login-action@v1
835942
with:
@@ -853,6 +960,28 @@ jobs:
853960
}}'
854961
-t $CONTAINER_TAG .
855962
963+
check: # This job does nothing and is only used for the branch protection
964+
if: always()
965+
966+
needs:
967+
- analyze
968+
- test
969+
- lint
970+
- dashboard
971+
- brew
972+
- developer
973+
- ghcr-latest
974+
- ghcr-openssl
975+
- docker-latest
976+
977+
runs-on: Ubuntu-latest
978+
979+
steps:
980+
- name: Decide whether the needed jobs succeeded or failed
981+
uses: re-actors/alls-green@release/v1
982+
with:
983+
jobs: ${{ toJSON(needs) }}
984+
856985
publish-pypi:
857986
name: Publish 🐍📦 ${{ needs.pre-setup.outputs.git-tag }} to PyPI
858987
needs:

0 commit comments

Comments
 (0)