Skip to content

Commit

Permalink
wip: test e2e release on branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Ogbizi committed Apr 23, 2020
1 parent c6e5e59 commit f70c588
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 19 deletions.
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

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

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

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

test-e2e-listed: prep-e2e-listed test-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

0 comments on commit f70c588

Please sign in to comment.