Skip to content

ci: verify extra in the real docker build environment #13

ci: verify extra in the real docker build environment

ci: verify extra in the real docker build environment #13

Workflow file for this run

name: Verify extra packages
on:
push:
paths:
- 'src/requirements_extra.txt'
- '.github/workflows/verify_extra.yml'
jobs:
verify:
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.11', '3.12', '3.13'] # last 3 minor versions
slim: ['true', 'false']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '${{ matrix.python }}'
- name: Prepare requirements and Dockerfile
run: |
set -eux
mkdir extra_check
cp src/requirements_extra.txt extra_check/requirements_extra.txt
cd extra_check
python3 -m pip install -U pip
output=$(pip3 install --dry-run --no-deps -I --report - --quiet mcdreforged 2>/dev/null)
mcdr_version=$(echo -E "$output" | jq '.install[0].metadata.version' -r)
if [ -z $mcdr_version ]; then
echo "MCDR version not found. pip output:"
echo -E "$output"
exit 1
fi
echo "Latest MCDR version: $mcdr_version"
echo "mcdreforged==$mcdr_version" >> ./requirements_extra.txt
cat ./requirements_extra.txt
if [ "${{ matrix.slim }}" = "true" ]; then
IMAGE_TAG=${{ matrix.python }}-slim
else
IMAGE_TAG=${{ matrix.python }}
fi
cat <<EOF > Dockerfile
FROM python:${IMAGE_TAG}
COPY ./requirements_extra.txt /
RUN <<EOT
set -eux
export PIP_ROOT_USER_ACTION=ignore
python3 -m pip install -U pip
pip3 install -r /requirements_extra.txt
pip3 cache purge && rm -rf ~/.cache/
EOT
EOF
cat Dockerfile
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build check
id: build
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
file: extra_check/Dockerfile
context: extra_check
push: false
tags: mcdreforged/ci-extra-verification:latest
- name: pip freeze
uses: addnab/docker-run-action@v3
with:
image: mcdreforged/ci-extra-verification:latest
options: -v ./freeze_out:/freeze_out
run: pip3 freeze > /freeze_out/freeze.txt
- name: Report
run: |
echo "# Installation Summary (python ${{ matrix.python }}, slime ${{ matrix.slim }})" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
cat ./freeze_out/freeze.txt >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY