Skip to content

Commit 54c4afc

Browse files
committed
ci: verify extra in the real docker build environment
1 parent 25fb0cb commit 54c4afc

File tree

1 file changed

+47
-7
lines changed

1 file changed

+47
-7
lines changed

.github/workflows/verify_extra.yml

+47-7
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,27 @@ on:
88

99
jobs:
1010
verify:
11+
name: Verify python:${{ matrix.python }}${{ matrix.slim == 'true' && '-slim' || '' }}
1112
runs-on: ubuntu-latest
1213
strategy:
1314
matrix:
1415
python: ['3.11', '3.12', '3.13'] # last 3 minor versions
16+
slim: ['true', 'false']
1517

1618
steps:
1719
- uses: actions/checkout@v4
1820
- uses: actions/setup-python@v5
1921
with:
2022
python-version: '${{ matrix.python }}'
2123

22-
- name: Verify Installability
24+
- name: Prepare requirements and Dockerfile
2325
run: |
24-
python3 -m pip install -U pip
26+
set -eux
27+
mkdir extra_check
28+
cp src/requirements_extra.txt extra_check/requirements_extra.txt
29+
cd extra_check
2530
31+
python3 -m pip install -U pip
2632
output=$(pip3 install --dry-run --no-deps -I --report - --quiet mcdreforged 2>/dev/null)
2733
mcdr_version=$(echo -E "$output" | jq '.install[0].metadata.version' -r)
2834
if [ -z $mcdr_version ]; then
@@ -31,11 +37,45 @@ jobs:
3137
exit 1
3238
fi
3339
echo "Latest MCDR version: $mcdr_version"
34-
echo "mcdreforged==$mcdr_version" >> src/requirements_extra.txt
35-
36-
pip3 install -r src/requirements_extra.txt
40+
echo "mcdreforged==$mcdr_version" >> ./requirements_extra.txt
41+
cat ./requirements_extra.txt
3742
38-
echo "# Installation Summary (python ${{matrix.python}})" >> $GITHUB_STEP_SUMMARY
43+
cat <<EOF > Dockerfile
44+
FROM python:${{ matrix.python }}${{ matrix.slim == 'true' && '-slim' || '' }}
45+
COPY ./requirements_extra.txt /
46+
RUN <<EOT
47+
set -eux
48+
export PIP_ROOT_USER_ACTION=ignore
49+
python3 -m pip install -U pip
50+
pip3 install -r /requirements_extra.txt
51+
pip3 cache purge && rm -rf ~/.cache/
52+
EOT
53+
EOF
54+
cat Dockerfile
55+
56+
- name: Set up Docker Buildx
57+
uses: docker/setup-buildx-action@v3
58+
- name: Build check
59+
id: build
60+
uses: docker/build-push-action@v5
61+
with:
62+
platforms: linux/amd64
63+
file: extra_check/Dockerfile
64+
context: extra_check
65+
push: false
66+
load: true
67+
tags: ci-extra-verification:latest
68+
69+
- name: pip freeze
70+
uses: addnab/docker-run-action@v3
71+
with:
72+
image: ci-extra-verification:latest
73+
options: -v ./freeze_out:/freeze_out
74+
run: pip3 freeze > /freeze_out/freeze.txt
75+
76+
- name: Report
77+
run: |
78+
echo "# Installation Summary (python ${{ matrix.python }}, slime ${{ matrix.slim }})" >> $GITHUB_STEP_SUMMARY
3979
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
40-
pip3 freeze >> $GITHUB_STEP_SUMMARY
80+
cat ./freeze_out/freeze.txt >> $GITHUB_STEP_SUMMARY
4181
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)