diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9dd52c7a..4da40f4d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,14 +8,11 @@ jobs: runs-on: ["self-hosted"] steps: - - name: Write test file - shell: bash --noprofile --norc -eo pipefail -x {0} - run: | - echo "$RUNNER_OS $GITHUB_RUN_ID" > test.txt - cat test.txt + - name: Generate a large test file + run: dd if=/dev/urandom of=large-file.bin bs=1M count=10240 # https://github.com/tespkg/actions-cache - - name: Save actions cache + - name: Save to actions cache uses: tespkg/actions-cache/save@cba095d7af782a955b8f4fa13396fbf0ab62bd4b # v1.7.1 with: endpoint: minio @@ -28,12 +25,7 @@ jobs: use-fallback: false key: test-${{ runner.os }}-${{ github.run_id }} path: | - test.txt - - - name: Remove test file - shell: bash --noprofile --norc -eo pipefail -x {0} - run: | - rm test.txt + large-file.bin # https://github.com/tespkg/actions-cache - name: Restore actions cache @@ -49,11 +41,9 @@ jobs: use-fallback: false key: test-${{ runner.os }}-${{ github.run_id }} path: | - test.txt + restored-file.bin restore-keys: | test-${{ runner.os }}- - - name: Verify restored cache - shell: bash --noprofile --norc -eo pipefail -x {0} - run: | - test "$RUNNER_OS $GITHUB_RUN_ID" = "$(<test.txt)" + - name: Verify restored file + run: diff large-file.bin restored-file.bin diff --git a/minio-init/tests/docker-compose.yml b/minio-init/tests/docker-compose.yml new file mode 100644 index 00000000..a835dea4 --- /dev/null +++ b/minio-init/tests/docker-compose.yml @@ -0,0 +1,67 @@ +services: + minio: + image: minio/minio:RELEASE.2024-10-29T16-01-48Z + command: server /data --console-address "" + environment: + MINIO_BROWSER: off + MINIO_ROOT_USER: minioadmin + MINIO_ROOT_PASSWORD: minioadmin + healthcheck: + test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/ready'] + interval: 5s + timeout: 5s + retries: 5 + networks: + - minio-network + volumes: + - minio-data:/data + tmpfs: + - /tmp + # - /data + + sut: + image: sut + build: ../ + networks: + - minio-network + depends_on: + - minio + tmpfs: + - /tmp + # volumes: + # - ../config:/config:ro + environment: + MINIO_SERVER_URL: http://minio:9000 + # These must match the root user credentials on minio + MINIO_ROOT_USER: minioadmin + MINIO_ROOT_PASSWORD: minioadmin + ACTIONS_CACHE_SECRET_KEY: GkZe6zWARpbmkrxRYVXgfnDpVr8grto9FPaqB4BZ + YOCTO_CACHE_SECRET_KEY: oDJpKOMNlxiSQ07XxivRFOkzTz3K292xi3WeRUgm + entrypoint: + - /bin/sh + - -c + command: + - | + set -ex + ansible-playbook playbooks/main.yml --inventory /config/inventory.ini + + mkdir -p /data/ + + # generate a +5GB file + dd if=/dev/urandom of=/data/5gb.bin bs=1M count=10240 + + # upload the file to minio + mc alias set minio http://minio:9000 actions-svcacct "$${ACTIONS_CACHE_SECRET_KEY}" + mc cp /data/5gb.bin minio/actions-cache/ + + # download the file from minio + mc cp minio/actions-cache/5gb.bin /data/5gb.new + + # verify the file is the same + diff /data/5gb.new /data/5gb.bin + +volumes: + minio-data: {} + +networks: + minio-network: {}