Skip to content

Commit 29c8db5

Browse files
Switching from Travis CI to GitHub Actions
1 parent 352b9b9 commit 29c8db5

File tree

5 files changed

+106
-384
lines changed

5 files changed

+106
-384
lines changed

.github/workflows/CI-CD.yaml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# GitHub Actions workflow
2+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions
3+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
4+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions
5+
6+
name: CI-CD
7+
8+
on:
9+
push:
10+
branches:
11+
- "*"
12+
tags-ignore:
13+
- "*"
14+
15+
schedule:
16+
- cron: "0 0 1 * *"
17+
18+
jobs:
19+
test:
20+
name: Node ${{ matrix.node }} on ${{ matrix.os }}
21+
runs-on: ${{ matrix.os }}
22+
timeout-minutes: 10
23+
strategy:
24+
fail-fast: true
25+
matrix:
26+
os:
27+
- ubuntu-latest
28+
- macos-latest
29+
- windows-latest
30+
node:
31+
- 10
32+
- 12
33+
34+
steps:
35+
- name: Checkout source
36+
uses: actions/checkout@v2
37+
38+
- name: Install Node ${{ matrix.node }}
39+
uses: actions/setup-node@v1
40+
with:
41+
node-version: ${{ matrix.node }}
42+
43+
- name: Install dependencies
44+
run: npm ci
45+
46+
- name: Run linter
47+
run: npm run lint
48+
49+
- name: Build the code
50+
run: npm run build
51+
52+
- name: Run Node.js tests
53+
run: npm run coverage:node
54+
55+
- name: Run browser tests
56+
run: npm run coverage:brwoser
57+
58+
- name: Combine code coverage data into a single file
59+
run: |
60+
ls -Rlh coverage/*/lcov.info
61+
cat coverage/*/lcov.info > ./coverage/lcov.info
62+
63+
- name: Send code coverage results to Coveralls
64+
uses: coverallsapp/github-action@v1.0.1
65+
with:
66+
github-token: ${{ secrets.GITHUB_TOKEN }}
67+
parallel: true
68+
69+
coverage:
70+
name: Code Coverage
71+
runs-on: ubuntu-latest
72+
timeout-minutes: 10
73+
needs: test
74+
steps:
75+
- name: Let Coveralls know that all tests have finished
76+
uses: coverallsapp/github-action@v1.0.1
77+
with:
78+
github-token: ${{ secrets.GITHUB_TOKEN }}
79+
parallel-finished: true
80+
81+
deploy:
82+
name: Publish to NPM
83+
if: github.ref == 'refs/heads/master'
84+
runs-on: ubuntu-latest
85+
timeout-minutes: 10
86+
needs: test
87+
88+
steps:
89+
- name: Checkout source
90+
uses: actions/checkout@v2
91+
92+
- name: Install Node
93+
uses: actions/setup-node@v1
94+
95+
- name: Install dependencies
96+
run: npm ci
97+
98+
- name: Build the code
99+
run: npm run build
100+
101+
- name: Publish to NPM
102+
uses: JS-DevTools/npm-publish@v1
103+
with:
104+
token: ${{ secrets.NPM_TOKEN }}

.travis.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ Host Environment
33

44
### Easily detect what host environment your code is running in
55

6-
[![Build Status](https://api.travis-ci.com/JS-DevTools/host-environment.svg?branch=master)](https://travis-ci.com/JS-DevTools/host-environment)
6+
[![Build Status](https://github.com/JS-DevTools/host-environment/workflows/CI-CD/badge.svg)](https://github.com/JS-DevTools/host-environment/blob/master/.github/workflows/CI-CD.yaml)
77
[![Coverage Status](https://coveralls.io/repos/github/JS-DevTools/host-environment/badge.svg?branch=master)](https://coveralls.io/github/JS-DevTools/host-environment)
88

99
[![npm](https://img.shields.io/npm/v/host-environment.svg)](https://www.npmjs.com/package/host-environment)
1010
[![Dependencies](https://david-dm.org/JS-DevTools/host-environment.svg)](https://david-dm.org/JS-DevTools/host-environment)
1111
[![License](https://img.shields.io/npm/l/host-environment.svg)](LICENSE)
1212

13-
[![OS and Browser Compatibility](https://jstools.dev/img/badges/ci-badges-with-ie.svg)](https://travis-ci.com/JS-DevTools/host-environment)
13+
[![OS and Browser Compatibility](https://jstools.dev/img/badges/ci-badges-with-ie.svg)](https://github.com/JS-DevTools/host-environment/blob/master/.github/workflows/CI-CD.yaml)
1414

1515

1616
Host Environment is a [universal JavaScript](https://medium.com/@mjackson/universal-javascript-4761051b7ae9) library that makes it easy to detect what host environment your code is running in. It lets you answer questions like:

0 commit comments

Comments
 (0)