Skip to content

Set up github actions #482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions .circleci/config.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint

on: [push]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: [12]
steps:
- uses: actions/checkout@v2

- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install deps
run: npm install

- name: Lint
run: npm run ci:lint
16 changes: 16 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Publish

on: [release]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
version: 12
registry-url: https://registry.npmjs.org/
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
57 changes: 57 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Test

on: [push]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: [3.6, 2.7]
node-version: [12]
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Check python version
run: |
python --version

- name: Install setuptools
run: python -m pip install --force setuptools wheel

- name: Install pipenv / poetry
run: python -m pip install pipenv poetry

- name: Install serverless
run: npm install -g serverless

- name: Install deps
run: npm install

- name: Test
run: npm run test
env:
USE_PYTHON: python
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this environment variable control?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So... that's a bit complicated. I'd like to chat about that on slack.

LC_ALL: C.UTF-8
LANG: C.UTF-8
if: matrix.os != 'macOS-latest'

- name: Test (Mac)
run: npm run test
env:
USE_PYTHON: python
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
if: matrix.os == 'macOS-latest'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Serverless Python Requirements

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

Expand Down
8 changes: 4 additions & 4 deletions lib/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function findTestFile(servicePath) {
* @return {boolean}
*/
function tryBindPath(serverless, bindPath, testFile) {
const debug = process.env.SLS_DEBUG;
const options = [
'run',
'--rm',
Expand All @@ -83,13 +84,12 @@ function tryBindPath(serverless, bindPath, testFile) {
`/test/${testFile}`
];
try {
if (debug) serverless.cli.log(`Trying bindPath ${bindPath} (${options})`);
const ps = dockerCommand(options);
if (process.env.SLS_DEBUG) {
serverless.cli.log(`Trying bindPath ${bindPath} (${options})`);
serverless.cli.log(ps.stdout.trim());
}
if (debug) serverless.cli.log(ps.stdout.trim());
return ps.stdout.trim() === `/test/${testFile}`;
} catch (err) {
if (debug) serverless.cli.log(`Finding bindPath failed with ${err}`);
return false;
}
}
Expand Down
5 changes: 2 additions & 3 deletions lib/pip.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,8 @@ function copyVendors(vendorFolder, targetFolder, serverless) {
function requirementsFileExists(servicePath, options, fileName) {
if (
options.usePoetry &&
fse.existsSync(
path.join(servicePath, 'pyproject.toml') && isPoetryProject(servicePath)
)
fse.existsSync(path.join(servicePath, 'pyproject.toml')) &&
isPoetryProject(servicePath)
) {
return true;
}
Expand Down
14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@
"format": "prettier --write '{.,lib}/*.{js,md}'"
},
"devDependencies": {
"eslint": "^6.8.0",
"eslint": "^5.16.0",
"prettier": "^1",
"cross-spawn": "*",
"deasync-promise": "*",
"tape": "*"
"tape": "*",
"tape-promise": "*",
"lodash": "^4.16.15"
},
"dependencies": {
"@iarna/toml": "^2.2.3",
Expand All @@ -69,8 +70,15 @@
"eslintConfig": {
"extends": "eslint:recommended",
"env": {
"commonjs": true,
"node": true,
"es6": true
},
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"no-console": "off"
}
},
"prettier": {
Expand Down
Loading