Skip to content

Commit

Permalink
Add action to test upload functionality (#4366)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore authored Dec 28, 2024
1 parent fe69cb1 commit 2b3fff4
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 15 deletions.
11 changes: 2 additions & 9 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@ jobs:
#with:
# firefox-version: '94.0'
- name: Setup environment
run: docker compose -f test/docker-compose.yml up -d
- name: Create test bucket
run: |
curl -X POST -H "Content-Type: application/json" \
-d '{"name": "sitespeed"}' \
http://127.0.0.1:8081/storage/v1/b?project=sitespeed
run: docker compose -f test/docker/docker-compose.yml up -d
- name: Browser versions
run: |
google-chrome --version
Expand Down Expand Up @@ -82,6 +77,4 @@ jobs:
- name: Run Chrome test with config
run: node bin/sitespeed.js --config test/exampleConfig.json http://127.0.0.1:3001/simple/ --xvfb
- name: Run Chrome test using compare plugin
run: node bin/sitespeed.js --compare.id compare --compare.saveBaseline --compare.baselinePath test/ http://127.0.0.1:3001/simple/ --xvfb
- 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
run: node bin/sitespeed.js --compare.id compare --compare.saveBaseline --compare.baselinePath test/ http://127.0.0.1:3001/simple/ --xvfb
45 changes: 45 additions & 0 deletions .github/workflows/upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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: 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
17 changes: 17 additions & 0 deletions test/docker/Dockerfile.scp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ubuntu:20.04

# Install OpenSSH server
RUN apt-get update && apt-get install -y openssh-server && mkdir /var/run/sshd

# Create a user for SSH with password
RUN useradd -m -s /bin/bash scpuser && echo "scpuser:password" | chpasswd

# Configure SSH server to allow password authentication
RUN sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config && \
sed -i 's/^#PermitRootLogin prohibit-password/PermitRootLogin no/' /etc/ssh/sshd_config

# Expose SSH port
EXPOSE 22

# Start the SSH server
CMD ["/usr/sbin/sshd", "-D"]
6 changes: 0 additions & 6 deletions test/docker-compose.yml → test/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ services:
ports:
- "2003:2003"
- "8080:80"
gcs:
image: fsouza/fake-gcs-server:1.50
ports:
- "8081:8081"
container_name: fake-gcs
command: ["-scheme", "http", "-port", "8081", "-external-url", "http://localhost:8081", "-backend", "memory"]
influxdb_v1.8:
image: influxdb:1.8
ports:
Expand Down

0 comments on commit 2b3fff4

Please sign in to comment.