1
1
---
2
- # yamllint disable rule:line-length
3
2
name : lib
4
3
5
4
on : # yamllint disable-line rule:truthy
67
66
git-tag : ${{ steps.git-tag.outputs.tag }}
68
67
sdist-artifact-name : ${{ steps.artifact-name.outputs.sdist }}
69
68
wheel-artifact-name : ${{ steps.artifact-name.outputs.wheel }}
69
+ container-version : v${{ steps.container.outputs.version }}
70
70
steps :
71
71
- name : Switch to using Python 3.9 by default
72
72
uses : actions/setup-python@v2
@@ -195,6 +195,16 @@ jobs:
195
195
&& github.event.inputs.release-version
196
196
|| steps.scm-version.outputs.dist-version
197
197
}}-py3-none-any.whl')
198
+ - name : Calculate container attributes
199
+ id : container
200
+ shell : bash
201
+ run : >-
202
+ VER=$(echo '${{
203
+ steps.request-check.outputs.release-requested == 'true'
204
+ && github.event.inputs.release-version
205
+ || steps.scm-version.outputs.dist-version
206
+ }}' | tr + .);
207
+ echo "::set-output name=version::$VER"
198
208
199
209
build :
200
210
name : 👷 dists ${{ needs.pre-setup.outputs.git-tag }}
@@ -547,11 +557,6 @@ jobs:
547
557
# a pull request then we can checkout the head.
548
558
fetch-depth : 2
549
559
550
- # If this run was triggered by a pull request event, then checkout
551
- # the head of the pull request instead of the merge commit.
552
- - run : git checkout HEAD^2
553
- if : ${{ github.event_name == 'pull_request' }}
554
-
555
560
# Initializes the CodeQL tools for scanning.
556
561
- name : Initialize CodeQL
557
562
uses : github/codeql-action/init@v1
@@ -631,45 +636,67 @@ jobs:
631
636
npm run build
632
637
cd ..
633
638
634
- docker :
635
- # TODO: To build our docker container, we must wait for check,
636
- # so that we can use the same distribution available.
639
+ developer :
637
640
runs-on : ${{ matrix.os }}-latest
641
+ name : 🧑💻 👩💻 👨💻 Developer setup ${{ matrix.node }} @ ${{ matrix.os }}
642
+ strategy :
643
+ matrix :
644
+ os : [ubuntu, macOS]
645
+ python : ['3.10']
646
+ fail-fast : false
647
+ steps :
648
+ - uses : actions/checkout@v2
649
+ with :
650
+ fetch-depth : 0
651
+ - name : Setup Python
652
+ uses : actions/setup-python@v2
653
+ with :
654
+ python-version : ${{ matrix.python }}
655
+ - name : Install Pip Dependencies
656
+ run : |
657
+ make lib-dep
658
+ - name : Run essentials
659
+ run : |
660
+ ./write-scm-version.sh
661
+ python3 check.py
662
+ make https-certificates
663
+ make sign-https-certificates
664
+ make ca-certificates
665
+ python3 -m proxy --version
666
+
667
+ docker :
668
+ runs-on : Ubuntu-latest
669
+ permissions :
670
+ packages : write
638
671
needs :
639
672
- build
640
673
- pre-setup # transitive, for accessing settings
641
- name : 🐳 🐍${{ matrix.python }} @ ${{ matrix.targetplatform }}
674
+ name : 🐳 containerize
642
675
strategy :
643
- matrix :
644
- os :
645
- - Ubuntu
646
- python :
647
- - ' 3.10'
648
- targetplatform :
649
- - ' linux/386'
650
- - ' linux/amd64'
651
- - ' linux/arm/v6'
652
- - ' linux/arm/v7'
653
- - ' linux/arm64/v8'
654
- - ' linux/ppc64le'
655
- - ' linux/s390x'
656
- # max-parallel: 1
657
676
fail-fast : false
658
677
steps :
659
678
- name : Checkout
660
679
uses : actions/checkout@v2
680
+ - name : Download all the dists
681
+ uses : actions/download-artifact@v2
682
+ with :
683
+ name : python-package-distributions
684
+ path : dist/
685
+ - name : Login to GHCR
686
+ uses : docker/login-action@v1
687
+ with :
688
+ registry : ghcr.io
689
+ username : ${{ github.actor }}
690
+ password : ${{ secrets.GITHUB_TOKEN }}
661
691
- name : Set up Docker Buildx
662
692
id : buildx
663
693
uses : docker/setup-buildx-action@v1
694
+ # See https://github.com/docker/buildx/issues/850#issuecomment-996408167
664
695
with :
696
+ version : v0.7.0
665
697
buildkitd-flags : --debug
666
698
config : .github/buildkitd.toml
667
699
install : true
668
- - name : Download all the dists
669
- uses : actions/download-artifact@v2
670
- with :
671
- name : python-package-distributions
672
- path : dist/
673
700
- name : Enable Multiarch # This slows down arm build by 4-5x
674
701
run : |
675
702
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
@@ -679,32 +706,80 @@ jobs:
679
706
docker buildx use proxypybuilder
680
707
docker buildx inspect
681
708
docker buildx ls
682
- - name : Set PROXYPY_CONTAINER_VERSION
683
- run : |
684
- echo "PROXYPY_CONTAINER_VERSION=$(echo '${{ needs.pre-setup.outputs.dist-version }}' | tr + .)" > $GITHUB_ENV
685
- - name : Build container
686
- run : |
687
- make container-buildx \
688
- -e PROXYPY_PKG_PATH='dist/${{ needs.pre-setup.outputs.wheel-artifact-name }}' \
689
- -e BUILDX_TARGET_PLATFORM='${{ matrix.targetplatform }}' \
690
- -e PROXYPY_CONTAINER_VERSION='${{ env.PROXYPY_CONTAINER_VERSION }}'
709
+ - name : Build, run & test container
710
+ run : >-
711
+ CONTAINER_TAG="abhinavsingh/proxy.py:${{
712
+ needs.pre-setup.outputs.container-version
713
+ }}";
714
+ docker buildx build
715
+ --load
716
+ --build-arg PROXYPY_PKG_PATH='dist/${{
717
+ needs.pre-setup.outputs.wheel-artifact-name
718
+ }}'
719
+ -t $CONTAINER_TAG .
720
+ &&
721
+ docker run
722
+ -d
723
+ -p 8899:8899
724
+ $CONTAINER_TAG
725
+ --hostname 0.0.0.0
726
+ --enable-web-server
727
+ --local-executor && ./tests/integration/test_integration.sh 8899
728
+ - name : Push to GHCR
729
+ run : >-
730
+ PLATFORMS=linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x;
731
+ REGISTRY_URL="ghcr.io/abhinavsingh/proxy.py";
732
+ CONTAINER_TAG=$REGISTRY_URL:${{
733
+ needs.pre-setup.outputs.container-version
734
+ }};
735
+ LATEST_TAG=$REGISTRY_URL:latest;
736
+ docker buildx build
737
+ --push
738
+ --platform $PLATFORMS
739
+ --build-arg PROXYPY_PKG_PATH='dist/${{
740
+ needs.pre-setup.outputs.wheel-artifact-name
741
+ }}'
742
+ -t $CONTAINER_TAG
743
+ -t $LATEST_TAG .
744
+ - name : Login to DockerHub
745
+ uses : docker/login-action@v1
746
+ with :
747
+ username : abhinavsingh
748
+ password : ${{ secrets.DOCKER_ACCESS_TOKEN }}
749
+ - name : Push to DockerHub
750
+ run : >-
751
+ PLATFORMS=linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x;
752
+ REGISTRY_URL="abhinavsingh/proxy.py";
753
+ CONTAINER_TAG=$REGISTRY_URL:${{
754
+ needs.pre-setup.outputs.container-version
755
+ }};
756
+ docker buildx build
757
+ --push
758
+ --platform $PLATFORMS
759
+ --build-arg PROXYPY_PKG_PATH='dist/${{
760
+ needs.pre-setup.outputs.wheel-artifact-name
761
+ }}'
762
+ -t $CONTAINER_TAG .
691
763
692
764
check : # This job does nothing and is only used for the branch protection
765
+ if : always()
766
+
693
767
needs :
694
768
- analyze
695
769
- test
696
770
- lint
697
771
- docker
698
772
- dashboard
699
773
- brew
774
+ - developer
700
775
701
- runs-on : ubuntu -latest
776
+ runs-on : Ubuntu -latest
702
777
703
778
steps :
704
- - name : Report success of the test matrix
705
- run : >-
706
- print("All's good")
707
- shell : python
779
+ - name : Decide whether the needed jobs succeeded or failed
780
+ uses : re-actors/alls-green@release/v1
781
+ with :
782
+ jobs : ${{ toJSON(needs) }}
708
783
709
784
publish-pypi :
710
785
name : Publish 🐍📦 ${{ needs.pre-setup.outputs.git-tag }} to PyPI
@@ -729,13 +804,13 @@ jobs:
729
804
name : python-package-distributions
730
805
path : dist/
731
806
- name : >-
732
- Publish 🐍📦 v ${{ needs.pre-setup.outputs.git-tag }} to PyPI
807
+ Publish 🐍📦 ${{ needs.pre-setup.outputs.git-tag }} to PyPI
733
808
uses: pypa/gh-action-pypi-publish@release/v1
734
809
with:
735
810
password: ${{ secrets.PYPI_TOKEN }}
736
811
737
812
publish-testpypi :
738
- name : Publish 🐍📦 to TestPyPI
813
+ name : Publish 🐍📦 ${{ needs.pre-setup.outputs.git-tag }} to TestPyPI
739
814
needs :
740
815
- check
741
816
- pre-setup # transitive, for accessing settings
@@ -758,12 +833,41 @@ jobs:
758
833
name : python-package-distributions
759
834
path : dist/
760
835
- name : >-
761
- Publish 🐍📦 v ${{ needs.pre-setup.outputs.git-tag }} to TestPyPI
836
+ Publish 🐍📦 ${{ needs.pre-setup.outputs.git-tag }} to TestPyPI
762
837
uses: pypa/gh-action-pypi-publish@release/v1
763
838
with:
764
839
password: ${{ secrets.TESTPYPI_API_TOKEN }}
765
840
repository_url: https://test.pypi.org/legacy/
766
841
842
+ # publish-docker:
843
+ # name: Publish 🐳 📦 ${{ needs.pre-setup.outputs.git-tag }} to Docker Hub
844
+ # needs:
845
+ # - check
846
+ # - pre-setup # transitive, for accessing settings
847
+ # if: >-
848
+ # fromJSON(needs.pre-setup.outputs.release-requested)
849
+ # runs-on: Ubuntu-latest
850
+
851
+ # environment:
852
+ # name: release-docker
853
+ # url: >-
854
+ # https://test.pypi.org/project/proxy.py/${{
855
+ # needs.pre-setup.outputs.dist-version
856
+ # }}
857
+
858
+ # steps:
859
+ # - name: Download all the dists
860
+ # uses: actions/download-artifact@v2
861
+ # with:
862
+ # name: python-package-distributions
863
+ # path: dist/
864
+ # - name: >-
865
+ # Publish 🐳 📦 ${{ needs.pre-setup.outputs.git-tag }} to Docker Hub
866
+ # uses: pypa/gh-action-pypi-publish@release/v1
867
+ # with:
868
+ # password: ${{ secrets.TESTPYPI_API_TOKEN }}
869
+ # repository_url: https://test.pypi.org/legacy/
870
+
767
871
post-release-repo-update :
768
872
name : >-
769
873
Publish post-release Git tag
0 commit comments