Skip to content

Commit ff9019b

Browse files
authored
Merge pull request #18 from CSCfi/feature/github-actions
Move to GitHub actions
2 parents 09370b9 + 412e74e commit ff9019b

File tree

6 files changed

+120
-56
lines changed

6 files changed

+120
-56
lines changed

.github/workflows/eslint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Javascript ESLint check
2+
3+
on: [push]
4+
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
node: [ '12', '14' ]
12+
name: Node ${{ matrix.node }} eslint check
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Setup node
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: ${{ matrix.node }}
19+
- name: Install dependencies
20+
run: npm i -g eslint
21+
- name: Run eslint
22+
run: |
23+
pushd bindings/js
24+
eslint --no-eslintrc --ext js --env es6,node --parser-options=ecmaVersion:8 --parser-options=sourceType:module swift_sharing_request_bind.js
25+

.github/workflows/publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish Docker image
2+
3+
on:
4+
release:
5+
types: [published]
6+
push:
7+
branches: [master, devel]
8+
9+
jobs:
10+
push_to_registry:
11+
name: Push swift-sharing-request Docker image to Docker Hub
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Login to DockerHub Registry
16+
run: echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u '${{ secrets.DOCKER_USERNAME }}' --password-stdin
17+
- name: Get the version
18+
id: vars
19+
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
20+
- name: Build the tagged Docker image
21+
if: ${{ steps.vars.outputs.tag != '/master' && steps.vars.outputs.tag != '/devel' }}
22+
run: docker build . --file Dockerfile --tag cscfi/swift-sharing-request:${{steps.vars.outputs.tag}}
23+
- name: Push the tagged Docker image
24+
if: ${{ steps.vars.outputs.tag != '/master' && steps.vars.outputs.tag != '/devel' }}
25+
run: docker push cscfi/swift-sharing-request:${{steps.vars.outputs.tag}}
26+
- name: Build the latest Docker image
27+
if: ${{ steps.vars.outputs.tag == '/master' }}
28+
run: docker build . --file Dockerfile --tag cscfi/swift-sharing-request:latest
29+
- name: Push the latest Docker image
30+
if: ${{ steps.vars.outputs.tag == '/master' }}
31+
run: docker push cscfi/swift-sharing-request:latest
32+
- name: Build the stage Docker image
33+
if: ${{ steps.vars.outputs.tag == '/devel' }}
34+
run: docker build . --file Dockerfile --tag cscfi/swift-sharing-request:stage
35+
- name: Push the stage Docker image
36+
if: ${{ steps.vars.outputs.tag == '/devel' }}
37+
run: docker push cscfi/swift-sharing-request:stage

.github/workflows/style.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Python style check
2+
3+
on: [push]
4+
5+
jobs:
6+
style_check:
7+
strategy:
8+
max-parallel: 4
9+
matrix:
10+
os: [ubuntu-latest]
11+
python-version: [3.7]
12+
13+
runs-on: ${{ matrix.os }}
14+
15+
steps:
16+
- uses: actions/checkout@v1
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install tox tox-gh-actions
25+
- name: Test flake8 syntax with tox
26+
run: tox -e flake8
27+
- name: bandit static check
28+
run: tox -e bandit

.github/workflows/unit.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Python Unit Tests
2+
3+
on: [push]
4+
5+
jobs:
6+
unit_test:
7+
strategy:
8+
max-parallel: 4
9+
matrix:
10+
os: [ubuntu-latest]
11+
python-version: [3.6, 3.7]
12+
13+
runs-on: ${{ matrix.os }}
14+
15+
steps:
16+
- uses: actions/checkout@v1
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install tox tox-gh-actions
25+
- name: Run unit tests
26+
run: tox -e pytest

.travis.yml

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

tox.ini

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py{36,37}, flake8, bandit, pytest
2+
envlist = flake8, bandit, pytest
33
skipdist = True
44

55
[testenv:bandit]
@@ -29,8 +29,7 @@ commands = py.test -x --cov=swift_sharing_request tests
2929
deps =
3030
-rrequirements.txt
3131

32-
[travis]
33-
unignore_outcomes = True
32+
[gh-actions]
3433
python =
35-
3.6: py36
36-
3.7: py37
34+
3.6: pytest
35+
3.7: flake8, pytest, bandit

0 commit comments

Comments
 (0)