Skip to content

Commit abd6153

Browse files
authored
Merge pull request #482 from UnitedIncome/feature/github-actions
Set up github actions
2 parents f57475d + d36a29f commit abd6153

File tree

15 files changed

+1655
-1295
lines changed

15 files changed

+1655
-1295
lines changed

.circleci/config.yml

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

.github/workflows/lint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Lint
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os: [ubuntu-latest]
12+
node-version: [12]
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Set up Node ${{ matrix.node-version }}
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
21+
- name: Install deps
22+
run: npm install
23+
24+
- name: Lint
25+
run: npm run ci:lint

.github/workflows/publish.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Publish
2+
3+
on: [release]
4+
5+
jobs:
6+
publish-npm:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v1
10+
- uses: actions/setup-node@v1
11+
with:
12+
version: 12
13+
registry-url: https://registry.npmjs.org/
14+
- run: npm publish
15+
env:
16+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.github/workflows/test.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Test
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os: [ubuntu-latest, windows-latest, macOS-latest]
12+
python-version: [3.6, 2.7]
13+
node-version: [12]
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
22+
- name: Set up Node ${{ matrix.node-version }}
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
27+
- name: Check python version
28+
run: |
29+
python --version
30+
31+
- name: Install setuptools
32+
run: python -m pip install --force setuptools wheel
33+
34+
- name: Install pipenv / poetry
35+
run: python -m pip install pipenv poetry
36+
37+
- name: Install serverless
38+
run: npm install -g serverless
39+
40+
- name: Install deps
41+
run: npm install
42+
43+
- name: Test
44+
run: npm run test
45+
env:
46+
LC_ALL: C.UTF-8
47+
LANG: C.UTF-8
48+
if: matrix.os != 'macOS-latest'
49+
50+
- name: Test (Mac)
51+
run: npm run test
52+
env:
53+
LC_ALL: en_US.UTF-8
54+
LANG: en_US.UTF-8
55+
if: matrix.os == 'macOS-latest'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Serverless Python Requirements
22

33
[![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com)
4-
[![CircleCI](https://circleci.com/gh/UnitedIncome/serverless-python-requirements.svg?style=shield)](https://circleci.com/gh/UnitedIncome/serverless-python-requirements)
4+
![Github Actions](https://github.com/UnitedIncome/serverless-python-requirements/workflows/Test/badge.svg)
55
[![npm](https://img.shields.io/npm/v/serverless-python-requirements.svg)](https://www.npmjs.com/package/serverless-python-requirements)
66
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
77

lib/docker.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ function findTestFile(servicePath) {
7373
* @return {boolean}
7474
*/
7575
function tryBindPath(serverless, bindPath, testFile) {
76+
const debug = process.env.SLS_DEBUG;
7677
const options = [
7778
'run',
7879
'--rm',
@@ -83,13 +84,12 @@ function tryBindPath(serverless, bindPath, testFile) {
8384
`/test/${testFile}`
8485
];
8586
try {
87+
if (debug) serverless.cli.log(`Trying bindPath ${bindPath} (${options})`);
8688
const ps = dockerCommand(options);
87-
if (process.env.SLS_DEBUG) {
88-
serverless.cli.log(`Trying bindPath ${bindPath} (${options})`);
89-
serverless.cli.log(ps.stdout.trim());
90-
}
89+
if (debug) serverless.cli.log(ps.stdout.trim());
9190
return ps.stdout.trim() === `/test/${testFile}`;
9291
} catch (err) {
92+
if (debug) serverless.cli.log(`Finding bindPath failed with ${err}`);
9393
return false;
9494
}
9595
}

lib/pip.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,8 @@ function copyVendors(vendorFolder, targetFolder, serverless) {
444444
function requirementsFileExists(servicePath, options, fileName) {
445445
if (
446446
options.usePoetry &&
447-
fse.existsSync(
448-
path.join(servicePath, 'pyproject.toml') && isPoetryProject(servicePath)
449-
)
447+
fse.existsSync(path.join(servicePath, 'pyproject.toml')) &&
448+
isPoetryProject(servicePath)
450449
) {
451450
return true;
452451
}

lib/poetry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function pyprojectTomlToRequirements() {
6262
fse.moveSync(
6363
sourceRequirements,
6464
path.join(this.servicePath, '.serverless', 'requirements.txt'),
65-
{ "overwrite": true }
65+
{ overwrite: true }
6666
);
6767
}
6868

package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@
4444
"format": "prettier --write '{.,lib}/*.{js,md}'"
4545
},
4646
"devDependencies": {
47-
"eslint": "^6.8.0",
47+
"eslint": "^5.16.0",
4848
"prettier": "^1",
4949
"cross-spawn": "*",
50-
"deasync-promise": "*",
51-
"tape": "*"
50+
"tape": "*",
51+
"tape-promise": "*",
52+
"lodash": "^4.16.15"
5253
},
5354
"dependencies": {
5455
"@iarna/toml": "^2.2.3",
@@ -69,8 +70,15 @@
6970
"eslintConfig": {
7071
"extends": "eslint:recommended",
7172
"env": {
73+
"commonjs": true,
7274
"node": true,
7375
"es6": true
76+
},
77+
"parserOptions": {
78+
"ecmaVersion": 2018
79+
},
80+
"rules": {
81+
"no-console": "off"
7482
}
7583
},
7684
"prettier": {

0 commit comments

Comments
 (0)