Skip to content
This repository was archived by the owner on Sep 13, 2024. It is now read-only.

Commit ecedbe5

Browse files
authored
Merge pull request #6 from happo/github-actions
Add GitHub actions build
2 parents 5bedd19 + 95b9e0e commit ecedbe5

7 files changed

Lines changed: 466 additions & 11 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
steps:
1414
- checkout
1515
- run: yarn install
16-
- run: yarn happo-ci
16+
- run: yarn happo-ci-circleci
1717

1818

.github/workflows/happo.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Happo CI
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-node@v1
18+
- name: install modules
19+
run: yarn install
20+
- name: happo
21+
run: yarn happo-ci-github-actions
22+
env:
23+
HAPPO_API_KEY: ${{ secrets.HAPPO_API_KEY }}
24+
HAPPO_API_SECRET: ${{ secrets.HAPPO_API_SECRET }}

.happo.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ module.exports = {
2626
}),
2727
},
2828

29+
project: process.env.HAPPO_PROJECT,
30+
2931
plugins: [
3032
happoPluginStorybook(),
3133
],

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ language: node_js
22
node_js:
33
- "10"
44
before_script: env
5-
script: yarn happo-ci-travis
5+
script: echo 'disabled'

happo-ci-github-actions

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
# Make the whole script fail on errors
4+
set -euo pipefail
5+
6+
# Prepare environment variables found in the github event json file.
7+
ENV_VARS=$(echo "
8+
const json = require('$GITHUB_EVENT_PATH');
9+
if (!process.env.PREVIOUS_SHA) {
10+
console.log(\`export PREVIOUS_SHA=\${json.pull_request.base.sha}\`);
11+
}
12+
if (!process.env.CURRENT_SHA) {
13+
console.log(\`export CURRENT_SHA=\${json.pull_request.head.sha}\`);
14+
}
15+
if (!process.env.CHANGE_URL) {
16+
console.log(\`export CHANGE_URL=\${json.pull_request.html_url}\`);
17+
}
18+
" | node)
19+
eval $ENV_VARS
20+
21+
export HAPPO_IS_ASYNC=true
22+
23+
# Delegate to the canonical script. It will use the env variables we have
24+
# prepared.
25+
#
26+
yarn happo-ci

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
},
1010
"scripts": {
1111
"happo": "happo",
12-
"happo-ci": "happo-ci-circleci",
12+
"happo-ci": "happo-ci",
13+
"happo-ci-circleci": "happo-ci-circleci",
1314
"happo-ci-travis": "happo-ci-travis",
15+
"happo-ci-github-actions": "./happo-ci-github-actions",
1416
"start": "react-scripts start",
1517
"build": "react-scripts build",
1618
"test": "react-scripts test",
@@ -35,6 +37,6 @@
3537
"@storybook/react": "^4.1.4",
3638
"babel-loader": "^8.0.4",
3739
"happo-plugin-storybook": "^1.1.4",
38-
"happo.io": "^3.5.1-rc.10"
40+
"happo.io": "^5.5.0-rc.1"
3941
}
4042
}

0 commit comments

Comments
 (0)