Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sauce credentials (2) #3773

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: Continous Integration
name: Continuous Integration

on: [push, pull_request]
on:
pull_request_target:
types: [assigned, opened, synchronize, reopened]

jobs:
test-saucelabs:
name: Browser tests
runs-on: ubuntu-latest
steps:
- name: log environment
run: echo ${{secrets.SAUCE_KEY}}
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js
Expand All @@ -22,7 +26,7 @@ jobs:
run: npm run test-saucelabs
env:
SAUCE_USERNAME: jspdf
SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}}
SAUCE_ACCESS_KEY: ${{secrets.SAUCE_KEY}}

test-node:
runs-on: ubuntu-latest
Expand Down
4 changes: 0 additions & 4 deletions .sauce.yml

This file was deleted.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"jasmine": "3.5.0",
"jasmine-core": "3.5.0",
"jasmine-expect": "4.0.3",
"js-yaml": "3.13.1",
"jsdoc": "^3.6.3",
"karma": "5.1.0",
"karma-babel-preprocessor": "8.0.1",
Expand Down Expand Up @@ -94,7 +93,7 @@
"version": "yarpm run build && yarpm run generate-docs && git add -A dist docs",
"pretest": "yarpm run build",
"test": "yarpm run test-node && yarpm run test-saucelabs",
"test-saucelabs": "karma start test/saucelabs/karma.conf.js --single-run --verbose && for a in coverage/*; do codeclimate-test-reporter < \\\"$a/lcov.info\\\"; break; done",
"test-saucelabs": "karma start test/saucelabs/karma.conf.js --single-run --verbose",
"test-local": "yarpm run test-unit && yarpm run test-node && yarpm run test-amd && yarpm run test-esm && yarpm run test-globals && yarpm run test-typescript && yarpm run test-webworker",
"test-unit": "karma start test/unit/karma.conf.js --single-run",
"test-amd": "karma start test/deployment/amd/karma.conf.js --single-run",
Expand Down
21 changes: 10 additions & 11 deletions test/saucelabs/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Karma configuration
"use strict";
const yaml = require("js-yaml");
const fs = require("fs");
const karmaConfig = require("../karma.common.conf.js");

const browsers = {
Expand All @@ -25,24 +23,25 @@ const browsers = {
};

module.exports = config => {
// Use ENV vars or .sauce.yml to get credentials
console.log(process.env.SAUCE_USERNAME)
console.log(process.env.SAUCE_ACCESS_KEY)
console.log(process.env.SAUCE_ACCESS_KEY?.length)
console.log(process.env.SAUCE_KEY)
// re-defining the env variables seems to fix the auth issue
// eslint-disable-next-line no-self-assign
process.env.SAUCE_USERNAME = process.env.SAUCE_USERNAME
// eslint-disable-next-line no-self-assign
process.env.SAUCE_ACCESS_KEY = process.env.SAUCE_ACCESS_KEY
if (
!(
process.env.SAUCE_USERNAME &&
process.env.SAUCE_ACCESS_KEY &&
process.env.SAUCE_ACCESS_KEY.length > 5
)
) {
if (!fs.existsSync(".sauce.yml")) {
// eslint-disable-next-line no-console
console.log("Create a .sauce.yml with your credentials");
console.error("Saucelabs credentials are missing. Define the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables.");
process.exit(1);
} else {
let sauceConfig = yaml.safeLoad(fs.readFileSync(".sauce.yml", "utf8"));
process.env.SAUCE_USERNAME = sauceConfig.addons.sauce_connect.username;
process.env.SAUCE_ACCESS_KEY =
sauceConfig.addons.sauce_connect.access_key;
}
}
config.set({
...karmaConfig,
Expand Down