Skip to content

Commit

Permalink
gcs: run github action test against GCS (#4362)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore authored Dec 27, 2024
1 parent c15ace1 commit 8c3730f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ jobs:
# 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
- name: Browser versions
run: |
google-chrome --version
Expand Down Expand Up @@ -77,4 +82,6 @@ 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
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
4 changes: 0 additions & 4 deletions lib/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -1698,10 +1698,6 @@ export async function parseCommandLine() {
describe: 'Name of the Google Cloud storage bucket',
group: 'GoogleCloudStorage'
})
.option('gcs.apiEndpoint', {
describe: 'The URL to the API endpoint, good for using fake-gcs-server',
group: 'GoogleCloudStorage'
})
.option('gcs.public', {
describe:
'Make uploaded results to Google Cloud storage publicly readable.',
Expand Down
16 changes: 7 additions & 9 deletions lib/plugins/gcs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ async function uploadLatestFiles(dir, gcsOptions, prefix) {
keyFilename: gcsOptions.key
};

if (gcsOptions.apiEndpoint) {
config.apiEndpoint = gcsOptions.apiEndpoint;
}

const storage = new Storage(config);
const bucket = storage.bucket(gcsOptions.bucketname);

Expand All @@ -41,10 +37,13 @@ async function upload(dir, gcsOptions, prefix) {
const promises = [];

const storage = new Storage({
projectId: gcsOptions.projectId,
keyFilename: gcsOptions.key
projectId: gcsOptions.projectId
});

if (gcsOptions.key) {
storage.keyFilename = gcsOptions.key;
}

const bucket = storage.bucket(gcsOptions.bucketname);

for (let file of files) {
Expand Down Expand Up @@ -77,9 +76,8 @@ async function uploadFile(
validation: 'crc32c',
gzip: !!gcsOptions.gzip,
metadata: {
metadata: {
cacheControl: 'public, max-age=' + noCacheTime ? 0 : 31_536_000
}
// eslint-disable-next-line unicorn/numeric-separators-style
cacheControl: 'public, max-age=' + (noCacheTime ? 0 : 31536000)
}
};

Expand Down
8 changes: 7 additions & 1 deletion test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ services:
image: sitespeedio/graphite:1.1.5-12
ports:
- "2003:2003"
- "8080:80"
- "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 8c3730f

Please sign in to comment.