Bump anyhow from 1.0.92 to 1.0.93 #215
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: End to End Test | |
on: | |
push: {} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: cargo build --release --locked | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: binary | |
path: target/release/mrpack-container | |
e2e: | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
matrix: | |
mrpackfile: [quilt-simple.mrpack, fabric-simple.mrpack] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
tests/mrpacks | |
- uses: actions/download-artifact@v4 | |
with: | |
name: binary | |
path: /usr/local/bin | |
merge-multiple: true | |
- name: Install mrpack-container | |
run: chmod +x /usr/local/bin/mrpack-container | |
- name: Build Container | |
run: mrpack-container --arches amd64 --output ./output "tests/mrpacks/${{ matrix.mrpackfile }}" | |
- name: Run Container | |
run: | | |
wget --no-verbose "https://piston-data.mojang.com/v1/objects/84194a2f286ef7c14ed7ce0090dba59902951553/server.jar" | |
container_id=$(tar cf - -C ./output . | podman load | awk '{ print $3 }') | |
mkdir /tmp/world | |
chmod a+rwx /tmp/world | |
echo "eula=true" > eula.txt | |
podman run \ | |
--detach \ | |
--publish 25565:25565 \ | |
--volume /tmp/world:/var/minecraft/world \ | |
--volume "$(pwd)"/server.jar:/usr/local/minecraft/server.jar:ro \ | |
--volume "$(pwd)"/eula.txt:/var/minecraft/eula.txt:ro \ | |
"$container_id" > running_container_id | |
- name: Verify Container is hosting a Minecraft Server | |
run: | | |
python3 -m pip install mcstatus | |
sleep 60 | |
podman logs $(cat running_container_id) | |
mcstatus localhost status | |
- name: Verify world save | |
run: | | |
if [ -f /tmp/world/level.dat ]; then | |
echo "Level file found in expected location" | |
else | |
echo "Level file not found!" | |
false | |
fi | |
# The stability test verifies that the output of mrpack-container is "stable". That is, if we build the same image | |
# multiple times do we get the same output byte-for-byte each time? We don't guarantee stability between different | |
# versions of mrpack-container (obviously), so this runs the same build on the same version three times, records the | |
# digests, and compares them. | |
stability-test: | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
matrix: | |
instance: [1, 2, 3] | |
outputs: | |
digest_amd64_1: ${{ steps.digest.outputs.digest_amd64_1 }} | |
digest_arm64_1: ${{ steps.digest.outputs.digest_arm64_1 }} | |
digest_amd64_2: ${{ steps.digest.outputs.digest_amd64_2 }} | |
digest_arm64_2: ${{ steps.digest.outputs.digest_arm64_2 }} | |
digest_amd64_3: ${{ steps.digest.outputs.digest_amd64_3 }} | |
digest_arm64_3: ${{ steps.digest.outputs.digest_arm64_3 }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
tests/mrpacks | |
- uses: actions/download-artifact@v4 | |
with: | |
name: binary | |
path: /usr/local/bin | |
merge-multiple: true | |
- name: Install mrpack-container | |
run: chmod +x /usr/local/bin/mrpack-container | |
- name: Build Container | |
run: mrpack-container --arch amd64 --arch arm64 --output ./output "tests/mrpacks/fabric-simple.mrpack" | |
- name: Debug Output for Investigations | |
run: | | |
tree output/ | |
ls -l output/blobs/sha256 | |
jq <output/index.json | |
jq <"output/blobs/sha256/$(jq <output/index.json -r '.manifests[0].digest' | awk '{split($0,a,":"); print a[2]}')" | |
jq <"output/blobs/sha256/$(jq <output/index.json -r '.manifests[1].digest' | awk '{split($0,a,":"); print a[2]}')" | |
# We can record and then compare just the digest reported in the index.json file. By definition, it will be the | |
# SHA256 sum of the manifest of the image, which itself contains the SHA256 sums of each layer tarball and the | |
# JSON config file. | |
- name: Report Image Digests | |
id: digest | |
run: | | |
echo "digest_arm64_${{matrix.instance}}=$(jq -r <output/index.json '.manifests[] | select(.platform.architecture == "arm64") | .digest')" >> "$GITHUB_OUTPUT" | |
echo "digest_amd64_${{matrix.instance}}=$(jq -r <output/index.json '.manifests[] | select(.platform.architecture == "amd64") | .digest')" >> "$GITHUB_OUTPUT" | |
verify-stability: | |
runs-on: ubuntu-latest | |
needs: stability-test | |
steps: | |
- name: Compare artifacts | |
run: | | |
echo '${{ toJSON(needs.stability-test.outputs) }}' | |
if [ '${{ needs.stability-test.outputs.digest_amd64_1 }}' != '${{ needs.stability-test.outputs.digest_amd64_2 }}' ]; then | |
echo 'Comparsion failure. Containers did not match!' | |
exit 1 | |
fi | |
if [ '${{ needs.stability-test.outputs.digest_amd64_1 }}' != '${{ needs.stability-test.outputs.digest_amd64_3 }}' ]; then | |
echo 'Comparsion failure. Containers did not match!' | |
exit 1 | |
fi | |
if [ '${{ needs.stability-test.outputs.digest_arm64_1 }}' != '${{ needs.stability-test.outputs.digest_arm64_2 }}' ]; then | |
echo 'Comparsion failure. Containers did not match!' | |
exit 1 | |
fi | |
if [ '${{ needs.stability-test.outputs.digest_arm64_1 }}' != '${{ needs.stability-test.outputs.digest_arm64_3 }}' ]; then | |
echo 'Comparsion failure. Containers did not match!' | |
exit 1 | |
fi |