Skip to content

Commit

Permalink
Merge pull request #26 from Typeform/ENG-179-migrate-to-gha
Browse files Browse the repository at this point in the history
[ENG-127] gha migration
  • Loading branch information
alfrejivi authored Jul 1, 2021
2 parents f0f8f7a + b785351 commit 406f929
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 49 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

on:
push:
branches:
- develop
pull_request:
branches:
- develop

env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1

jobs:
build:
strategy:
max-parallel: 1
matrix:
browser: ["mac-chrome-latest","mac-firefox-latest","mac-safari-latest","windows-chrome-latest","windows-firefox-latest","windows-edge-latest","ios-latest"]
name: Build assets
runs-on: [ubuntu-latest]
steps:

- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v2

- name: Set up node
uses: actions/setup-node@v1
with:
node-version: '12.x'

- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Node.js dependencies
run: npm ci

- name: Build
run: npm run build

- name: Lint & Karma
env:
BROWSER: ${{ matrix.browser }}
run: npm run lint-and-karma || npm run lint-and-karma
49 changes: 49 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy

on:
workflow_run:
workflows: ['CI']
branches: [develop]
types:
- completed

jobs:
build:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: [ubuntu-latest]
steps:

- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v2

- name: Set up node
uses: actions/setup-node@v1
with:
node-version: '12.x'

- name: Set GitHub packages registry
run: |
npm config set '//npm.pkg.github.com/:_authToken' ${{ secrets.GH_TOKEN }}
npm config set @typeform:registry https://npm.pkg.github.com/
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Node.js dependencies
run: npm ci

- name: Deploy
if: contains(github.ref, 'refs/heads/develop')
run: |
npm run build
npm run semantic-release
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion _develop/karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = config => {
});

/* eslint-disable no-param-reassign */
if (process.env.TRAVIS) {
if (process.env.CI) {
config.transports = ['polling'];
config.browsers = [process.env.BROWSER];
config.browserDisconnectTimeout = 10000;
Expand Down
6 changes: 3 additions & 3 deletions _develop/sauce.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const _ = require('lodash');
const os = require('os');

if (process.env.TRAVIS) {
if (process.env.CI) {
module.exports = {
build: process.env.TRAVIS_BUILD_ID,
tunnel: process.env.TRAVIS_JOB_NUMBER,
build: process.env.GITHUB_RUN_ID,
tunnel: process.env.GITHUB_RUN_NUMBER,
};
} else {
const id = _.random(16 * 16 * 16 * 16).toString(16);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
"test:functional": "./_develop/scripts/puppeteer.sh",
"test:unit": "npm run build; karma start _develop/karma.config.js",
"test:coverage": "webpack --env.coverage --config _develop/webpack.config.js; karma start _develop/karma.config.js --reporters coverage",
"travis": "npm run lint && karma start _develop/karma.config.js --reporters dots,saucelabs"
"lint-and-karma": "npm run lint && karma start _develop/karma.config.js --reporters dots,saucelabs"
},
"keywords": [
"editor",
Expand Down

0 comments on commit 406f929

Please sign in to comment.