Add GitHub Action test for S3 upload #24
Workflow file for this run
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: Test upload functionality | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ !contains(github.event.head_commit.message, 'docs:') }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install sitespeed.io | |
run: npm ci | |
- name: Install Chrome | |
run: | | |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' | |
sudo apt-get update | |
sudo apt-get --only-upgrade install google-chrome-stable | |
google-chrome --version | |
- name: Setup SSH/SCP container | |
run: | | |
docker build --load -t ssh-server-password --file test/docker/Dockerfile.scp . | |
docker run -d -p 2222:22 ssh-server-password | |
- name: Setup GCS container | |
run: | | |
docker run -d -p 8081:8081 fsouza/fake-gcs-server:1.50 -scheme http -port 8081 -external-url http://localhost:8081 -backend memory | |
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 run -d -p 9000:9000 -p 9001:9001 -e MINIO_ROOT_USER=user -e MINIO_ROOT_PASSWORD=password minio/minio:RELEASE.2024-05-10T01-41-38Z server /data --console-address ":9001" | |
docker run --rm --network host minio/mc:RELEASE.2024-10-08T09-37-26Z alias set myminio http://localhost:9000 user password | |
docker run --rm --network host minio/mc:RELEASE.2024-10-08T09-37-26Z mb --region=motown myminio/mybucket || echo "Bucket already exists" | |
docker run --rm --network host minio/mc:RELEASE.2024-10-08T09-37-26Z anonymous set public myminio/mybucket | |
docker run --rm --network host minio/mc:RELEASE.2024-10-08T09-37-26Z ls myminio/mybucket | |
- name: Install local HTTP server | |
run: npm install serve -g | |
- name: Start local HTTP server | |
run: (serve test/data/html/ -l 3001&) | |
- 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 | |
- 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 mybucket --s3.key user --s3.secret password --s3.region motown |