10000 build: use GitHub Actions instead of Travis CI · mysqljs/sqlstring@8fb10de · GitHub
[go: up one dir, main page]

Skip to content

Commit 8fb10de

Browse files
committed
build: use GitHub Actions instead of Travis CI
1 parent 379e02f commit 8fb10de

File tree

4 files changed

+180
-51
lines changed

4 files changed

+180
-51
lines changed

.github/workflows/ci.yml

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
name: ci
2+
3+
on:
4+
- pull_request
5+
- push
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-18.04
10+
strategy:
11+
matrix:
12+
name:
13+
- Node.js 0.6
14+
- Node.js 0.8
15+
- Node.js 0.10
16+
- Node.js 0.12
17+
- io.js 1.x
18+
- io.js 2.x
19+
- io.js 3.x
20+
- Node.js 4.x
21+
- Node.js 5.x
22+
- Node.js 6.x
23+
- Node.js 7.x
24+
- Node.js 8.x
25+
- Node.js 9.x
26+
- Node.js 10.x
27+
- Node.js 11.x
28+
- Node.js 12.x
29+
- Node.js 13.x
30+
- Node.js 14.x
31+
32+
include:
33+
- name: Node.js 0.6
34+
node-version: "0.6"
35+
36+
- name: Node.js 0.8
37+
node-version: "0.8"
38+
39+
- name: Node.js 0.10
40+
node-version: "0.10"
41+
42+
- name: Node.js 0.12
43+
node-version: "0.12"
44+
45+
- name: io.js 1.x
46+
node-version: "1.8"
47+
48+
- name: io.js 2.x
49+
node-version: "2.5"
50+
51+
- name: io.js 3.x
52+
node-version: "3.3"
53+
54+
- name: Node.js 4.x
55+
node-version: "4.9"
56+
57+
- name: Node.js 5.x
58+
node-version: "5.12"
59+
60+
- name: Node.js 6.x
61+
node-version: "6.17"
62+
63+
- name: Node.js 7.x
64+
node-version: "7.10"
65+
66+
- name: Node.js 8.x
67+
node-version: "8.17"
68+
69+
- name: Node.js 9.x
70+
node-version: "9.11"
71+
72+
- name: Node.js 10.x
73+
node-version: "10.22"
74+
75+
- name: Node.js 11.x
76+
node-version: "11.15"
77+
78+
- name: Node.js 12.x
79+
node-version: "12.18"
80+
81+
- name: Node.js 13.x
82+
node-version: "13.14"
83+
84+
- name: Node.js 14.x
85+
node-version: "14.4"
86+
87+
steps:
88+
- uses: actions/checkout@v2
89+
90+
- name: Install Node.js ${{ matrix.node-version }}
91+
shell: bash -eo pipefail -l {0}
92+
run: |
93+
if [[ "${{ matrix.node-version }}" == 0.6* ]]; then
94+
sudo apt-get install g++-4.8 gcc-4.8 libssl1.0-dev
95+
export CC=/usr/bin/gcc-4.8
96+
export CXX=/usr/bin/g++-4.8
97+
fi
98+
nvm install --default ${{ matrix.node-version }}
99+
if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
100+
nvm install --alias=npm 0.10
101+
nvm use ${{ matrix.node-version }}
102+
if [[ "$(npm -v)" == 1.1.* ]]; then
103+
nvm exec npm npm install -g npm@1.1
104+
ln -fs "$(which npm)" "$(dirname "$(nvm which npm)")/npm"
105+
else
106+
sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
107+
fi
108+
npm config set strict-ssl false
109+
fi
110+
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
111+
112+
- name: Configure npm
113+
run: npm config set shrinkwrap false
114+
115+
- name: Remove non-test npm modules
116+
run: npm rm --silent --save-dev benchmark beautify-benchmark
117+
118+
- name: Setup Node.js version- F438 specific dependencies
119+
shell: bash
120+
run: |
121+
# eslint for linting
122+
# - remove on Node.js < 6
123+
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 6 ]]; then
124+
node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
125+
grep -E '^eslint(-|$)' | \
126+
sort -r | \
127+
xargs -n1 npm rm --silent --save-dev
128+
fi
129+
# nyc for coverage
130+
# - remove on Node.js < 8
131+
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 8 ]]; then
132+
npm rm --silent --save-dev nyc
133+
fi
134+
135+
- name: Install Node.js dependencies
136+
run: npm install
137+
138+
- name: List environment
139+
id: list_env
140+
shell: bash
141+
run: |
142+
echo "node@$(node -v)"
143+
echo "npm@$(npm -v)"
144+
npm -s ls ||:
145+
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 "::" $3 }'
146+
147+
- name: Run tests
148+
shell: bash
149+
run: |
150+
if npm -ps ls nyc | grep -q nyc; then
151+
npm run test-ci
152+
else
153+
npm test
154+
fi
155+
156+
- name: Lint code
157+
if: steps.list_env.outputs.eslint != ''
158+
run: npm run lint
159+
160+
- name: Collect code coverage
161+
uses: coverallsapp/github-action@master
162+
if: steps.list_env.outputs.nyc != ''
163+
with:
164+
github-token: ${{ secrets.GITHUB_TOKEN }}
165+
flag-name: run-${{ matrix.test_number }}
166+
parallel: true
167+
168+
coverage:
169+
needs: test
170+
runs-on: ubuntu-latest
171+
steps:
172+
- name: Upload code coverage
173+
uses: coverallsapp/github-action@master
174+
with:
175+
github-token: ${{ secrets.GITHUB_TOKEN }}
176+
parallel-finished: true

.travis.yml

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

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![NPM Version][npm-version-image]][npm-url]
44
[![NPM Downloads][npm-downloads-image]][npm-url]
55
[![Node.js Version][node-image]][node-url]
6-
[![Build Status][travis-image]][travis-url]
6+
[![Build Status][github-actions-ci-image]][github-actions-ci-url]
77
[![Coverage Status][coveralls-image]][coveralls-url]
88

99
Simple SQL escape and format for MySQL
@@ -224,9 +224,9 @@ console.log(sql); // UPDATE `users` SET `email` = 'foobar@example.com', `modifie
224224
[npm-version-image]: https://img.shields.io/npm/v/sqlstring.svg
225225
[npm-downloads-image]: https://img.shields.io/npm/dm/sqlstring.svg
226226
[npm-url]: https://npmjs.org/package/sqlstring
227-
[travis-image]: https://img.shields.io/travis/mysqljs/sqlstring/master.svg
228-
[travis-url]: https://travis-ci.org/mysqljs/sqlstring
229227
[coveralls-image]: https://img.shields.io/coveralls/mysqljs/sqlstring/master.svg
230228
[coveralls-url]: https://coveralls.io/r/mysqljs/sqlstring?branch=master
229+
[github-actions-ci-image]: https://img.shields.io/github/workflow/status/mysqljs/sqlstring/ci/master?label=build
230+
[github-actions-ci-url]: https://github.com/mysqljs/sqlstring/actions/workflows/ci.yml
231231
[node-image]: https://img.shields.io/node/v/sqlstring.svg
232232
[node-url]: https://nodejs.org/en/download

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"bench": "node benchmark/index.js",
4242
"lint": "eslint --plugin markdown --ext js,md .",
4343
"test": "node test/run.js",
44-
"test-ci": "nyc --reporter=text npm test",
44+
"test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
4545
"test-cov": "nyc --reporter=html --reporter=text npm test"
4646
}
4747
}

0 commit comments

Comments
 (0)
0