From f766094d2ac8a467dc9970d2a20fd451d5f7eff8 Mon Sep 17 00:00:00 2001 From: Peter Hedenskog Date: Sat, 28 Dec 2024 18:24:52 +0100 Subject: [PATCH] Add GitHub Action test for S3 upload (#4367) --- .github/workflows/upload.yml | 7 +++++- test/docker/docker-compose.minio.yml | 32 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 test/docker/docker-compose.minio.yml diff --git a/.github/workflows/upload.yml b/.github/workflows/upload.yml index 7a172f844c..1a69c4bac3 100644 --- a/.github/workflows/upload.yml +++ b/.github/workflows/upload.yml @@ -35,6 +35,9 @@ jobs: curl -X POST -H "Content-Type: application/json" \ -d '{"name": "sitespeed"}' \ http://127.0.0.1:8081/storage/v1/b?project=sitespeed + - name: Setup minio/S3 container + run: | + docker compose -f test/docker/docker-compose.minio.yml up -d - name: Install local HTTP server run: npm install serve -g - name: Start local HTTP server @@ -42,4 +45,6 @@ jobs: - name: Run Chrome test sending data using scp run: bin/sitespeed.js http://127.0.0.1:3001/simple/ --xvfb -n 1 --scp.host localhost --scp.port 2222 --scp.username scpuser --scp.password password --scp.destinationPath /home/scpuser/ - name: Run Chrome test sending data to GCS - run: STORAGE_EMULATOR_HOST="http://localhost:8081" node bin/sitespeed.js http://127.0.0.1:3001/simple/ --xvfb -n 1 --gcs.bucketname sitespeed --gcs.projectId sitespeed \ No newline at end of file + run: STORAGE_EMULATOR_HOST="http://localhost:8081" node bin/sitespeed.js http://127.0.0.1:3001/simple/ --xvfb -n 1 --gcs.bucketname sitespeed --gcs.projectId sitespeed + - name: Run Chrome test sending data to S3 + run: node bin/sitespeed.js http://127.0.0.1:3001/simple/ --xvfb -n 1 --s3.endpoint http://127.0.0.1:9000 --s3.bucketname sitespeedio --s3.key user --s3.secret password --s3.region motown \ No newline at end of file diff --git a/test/docker/docker-compose.minio.yml b/test/docker/docker-compose.minio.yml new file mode 100644 index 0000000000..02b64b767f --- /dev/null +++ b/test/docker/docker-compose.minio.yml @@ -0,0 +1,32 @@ +services: + minio: + image: minio/minio:RELEASE.2024-05-10T01-41-38Z + volumes: + - minio-data:/data + ports: + - "9000:9000" + environment: + - MINIO_ROOT_USER=user + - MINIO_ROOT_PASSWORD=password + command: server /data --console-address ":9001" + networks: + - skynet + mc: + image: minio/mc:RELEASE.2024-10-08T09-37-26Z + depends_on: + - minio + networks: + - skynet + entrypoint: > + /bin/sh -c " + /usr/bin/mc alias set sitespeedio http://minio:9000 user password && + (/usr/bin/mc mb --region=motown sitespeedio/sitespeedio || echo 'Bucket already exists') && + /usr/bin/mc ilm rule add --expire-days 30 sitespeedio/sitespeedio && + /usr/bin/mc anonymous set public sitespeedio/sitespeedio && + /usr/bin/mc admin config set sitespeedio compression extensions=\".html,.css,.js\" && + echo 'MinIO and lifecycle policy setup complete.'" +volumes: + minio-data: +networks: + skynet: + name: skynet \ No newline at end of file