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

test: publish dummy add on as part of e2e #119

Closed
wants to merge 3 commits into from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion .circleci/config.yml
Expand Up @@ -55,12 +55,17 @@ jobs:
steps:
- prep
- run: yarn test-coverage
- run: cd e2e && yarn test-e2e
- persist_to_workspace:
root: ~/repo
paths:
- ./artifacts

e2e:
<<: *defaults
steps:
- prep
- run: make -k test-e2e-listed

report:
<<: *defaults
steps:
Expand Down Expand Up @@ -102,6 +107,9 @@ workflows:
- test:
requires:
- setup
- e2e:
requires:
- setup
- report:
requires:
- test
Expand All @@ -112,6 +120,7 @@ workflows:
requires:
- lint
- test
- e2e
- build
# *
# The deploy job uses semantic-release which filters by branch
Expand Down
22 changes: 22 additions & 0 deletions Makefile
@@ -0,0 +1,22 @@
setup-e2e:
git config --global user.email "test@example.com"
git config --global user.name "Test Example"

cleanup-e2e:
-git push --delete origin e2e-v1.0.0
-git tag --delete e2e-v1.0.0

test-e2e:
cd e2e && \
git commit -m 'feat: test release' --allow-empty && \
CI_PULL_REQUEST='' CIRCLE_PULL_REQUEST='' \
FIREFOX_API_KEY=$(TEST_FIREFOX_API_KEY) \
FIREFOX_SECRET_KEY=$(TEST_FIREFOX_SECRET_KEY) \
../node_modules/.bin/semantic-release --branches $(CIRCLE_BRANCH)

test-e2e-unlisted: setup-e2e test-e2e cleanup-e2e

prep-e2e-listed:
sed -i 's/channel: "unlisted"/channel: "listed"/g' 'e2e/.releaserc.js'

test-e2e-listed: setup-e2e prep-e2e-listed test-e2e cleanup-e2e
19 changes: 19 additions & 0 deletions e2e/.releaserc.js
@@ -0,0 +1,19 @@
module.exports = {
ci: false,
debug: true,
dryRun: false,
tagFormat: "e2e-v${version}",
plugins: [
[
"../src/index.js",
{
apiUrlPrefix: "https://addons-dev.allizom.org/api/v3",
artifactsDir: "./",
channel: "unlisted",
sourceDir: "./",
extensionId: "{01234567-abcd-6789-cdef-0123456789ef}",
targetXpi: "extension.xpi",
},
],
],
};
17 changes: 0 additions & 17 deletions e2e/package.json
Expand Up @@ -2,22 +2,5 @@
"dependencies": {
"web-ext": "^4.0.0",
"semantic-release": "^16.0.0"
},
"scripts": {
"test-e2e": "FIREFOX_API_KEY='dummy' FIREFOX_SECRET_KEY='dummy' ../node_modules/.bin/semantic-release"
},
"release": {
"dryRun": true,
"plugins": [
[
"../src/index.js",
{
"artifactsDir": "./",
"sourceDir": "./",
"extensionId": "{01234567-abcd-6789-cdef-0123456789ef}",
"targetXpi": "extension.xpi"
}
]
]
}
}
3 changes: 2 additions & 1 deletion src/publish.js
Expand Up @@ -21,6 +21,7 @@ const publish = async options => {
channel,
sourceDir,
targetXpi,
...rest
} = verifyOptions(options, ['extensionId', 'targetXpi'])

const { FIREFOX_API_KEY, FIREFOX_SECRET_KEY } = process.env
Expand All @@ -39,9 +40,9 @@ const publish = async options => {
}
return result
}

const { downloadedFiles } = await webExt.cmd.sign(
{
...rest,
apiKey: FIREFOX_API_KEY,
apiSecret: FIREFOX_SECRET_KEY,
artifactsDir,
Expand Down