Skip to content

Commit 1c97f5b

Browse files
committed
Test workflow.
1 parent 05f35b3 commit 1c97f5b

File tree

2 files changed

+88
-20
lines changed

2 files changed

+88
-20
lines changed

.github/workflows/python-publish.yml

Lines changed: 73 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
name: Upload Python Package
22

33
on:
4+
push:
45
release:
56
types: [published]
67

78
env:
89
REGISTRY: ghcr.io
910
DOCKER_REGISTRY: docker.io
10-
DOCKER_REGISTRY_USER: pinto0309
11+
DOCKER_REGISTRY_USER: sohma440
1112
IMAGE_NAME: ${{ github.repository }}
1213

1314
jobs:
1415
pypi-deploy:
16+
# todo
17+
if: ${{ false }}
1518
runs-on: ubuntu-latest
1619
steps:
1720
- uses: actions/checkout@v3
@@ -32,16 +35,19 @@ jobs:
3235
user: __token__
3336
password: ${{ secrets.PYPI_API_TOKEN }}
3437

35-
docker-deploy:
38+
build:
3639
runs-on: ubuntu-latest
37-
needs: pypi-deploy
40+
# todo
41+
# needs: pypi-deploy
3842
permissions:
3943
contents: read
4044
packages: write
4145
strategy:
4246
fail-fast: false # do not cancel even if any platform fails.
4347
matrix:
44-
platform: [linux/amd64,linux/arm64]
48+
platform:
49+
- linux/amd64
50+
- linux/arm64
4551
steps:
4652
- name: Git checkout
4753
uses: actions/checkout@v3
@@ -50,6 +56,11 @@ jobs:
5056
- name: Set up QEMU
5157
uses: docker/setup-qemu-action@v3
5258

59+
- name: Prepare
60+
run: |
61+
platform=${{ matrix.platform }}
62+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
63+
5364
- name: Log in to the GitHub Container registry
5465
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
5566
with:
@@ -61,6 +72,7 @@ jobs:
6172
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
6273
with:
6374
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
75+
6476
- name: Build and push Docker image
6577
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
6678
with:
@@ -81,11 +93,66 @@ jobs:
8193
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
8294
with:
8395
images: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}
84-
- name: Build and push Docker image
85-
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
96+
97+
- name: Build and push by digest
98+
id: build
99+
uses: docker/build-push-action@v5
86100
with:
87101
context: .
88102
platforms: ${{ matrix.platform }}
89103
push: true
90104
tags: ${{ steps.meta_dh.outputs.tags }}
91105
labels: ${{ steps.meta_dh.outputs.labels }}
106+
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
107+
108+
- name: Export digest
109+
run: |
110+
mkdir -p /tmp/digests
111+
digest="${{ steps.build.outputs.digest }}"
112+
touch "/tmp/digests/${digest#sha256:}"
113+
114+
- name: Upload digest
115+
uses: actions/upload-artifact@v4
116+
with:
117+
name: digests-${{ env.PLATFORM_PAIR }}
118+
path: /tmp/digests/*
119+
if-no-files-found: error
120+
retention-days: 1
121+
122+
merge:
123+
runs-on: ubuntu-latest
124+
needs:
125+
- build
126+
steps:
127+
- name: Download digests
128+
uses: actions/download-artifact@v4
129+
with:
130+
path: /tmp/digests
131+
pattern: digests-*
132+
merge-multiple: true
133+
134+
- name: Set up Docker Buildx
135+
uses: docker/setup-buildx-action@v3
136+
137+
- name: Docker meta
138+
id: meta
139+
uses: docker/metadata-action@v5
140+
with:
141+
images: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}
142+
143+
- name: Log in to the Docker Container registry
144+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
145+
with:
146+
registry: ${{ env.DOCKER_REGISTRY }}
147+
username: ${{ env.DOCKER_REGISTRY_USER }}
148+
password: ${{ secrets.DH_ACCESS_TOKEN }}
149+
150+
- name: Create manifest list and push
151+
working-directory: /tmp/digests
152+
run: |
153+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
154+
$(printf '${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
155+
156+
- name: Inspect image
157+
run: |
158+
docker buildx imagetools inspect ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}

Dockerfile

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,22 @@ RUN pip install pip -U \
3131
# Re-release flatc with some customizations of our own to address
3232
# the lack of arithmetic precision of the quantization parameters
3333
# https://github.com/PINTO0309/onnx2tf/issues/196
34-
RUN wget https://github.com/PINTO0309/onnx2tf/releases/download/1.16.31/flatc.tar.gz \
35-
&& tar -zxvf flatc.tar.gz \
36-
&& chmod +x flatc \
37-
&& mv flatc /usr/bin/
34+
# todo
35+
# RUN wget https://github.com/PINTO0309/onnx2tf/releases/download/1.16.31/flatc.tar.gz \
36+
# && tar -zxvf flatc.tar.gz \
37+
# && chmod +x flatc \
38+
# && mv flatc /usr/bin/
3839

39-
ENV USERNAME=user
40-
RUN echo "root:root" | chpasswd \
41-
&& adduser --disabled-password --gecos "" "${USERNAME}" \
42-
&& echo "${USERNAME}:${USERNAME}" | chpasswd \
43-
&& echo "%${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/${USERNAME} \
44-
&& chmod 0440 /etc/sudoers.d/${USERNAME}
45-
USER ${USERNAME}
46-
ARG WKDIR=/workdir
47-
WORKDIR ${WKDIR}
48-
RUN sudo chown ${USERNAME}:${USERNAME} ${WKDIR}
40+
# ENV USERNAME=user
41+
# RUN echo "root:root" | chpasswd \
42+
# && adduser --disabled-password --gecos "" "${USERNAME}" \
43+
# && echo "${USERNAME}:${USERNAME}" | chpasswd \
44+
# && echo "%${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/${USERNAME} \
45+
# && chmod 0440 /etc/sudoers.d/${USERNAME}
46+
# USER ${USERNAME}
47+
# ARG WKDIR=/workdir
48+
# WORKDIR ${WKDIR}
49+
# RUN sudo chown ${USERNAME}:${USERNAME} ${WKDIR}
4950

5051
RUN echo 'export CUDA_VISIBLE_DEVICES=-1' >> ${HOME}/.bashrc \
5152
&& echo 'export TF_CPP_MIN_LOG_LEVEL=3' >> ${HOME}/.bashrc

0 commit comments

Comments
 (0)