Skip to content

Commit

Permalink
Set up all CI to use GH actions
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Alkov <ben.alkov@redhat.com>
  • Loading branch information
ben-alkov committed Jun 5, 2020
1 parent f598ec4 commit d98b639
Show file tree
Hide file tree
Showing 7 changed files with 183 additions and 58 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[run]
omit = /tmp/*
relative_files = True
41 changes: 41 additions & 0 deletions .github/workflows/flake8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Lint with flake8

on: [pull_request]

jobs:
flake8:
name: Flake8 for Python ${{ matrix.os.python }} on ${{ matrix.os.name }}-${{ matrix.os.version }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
os:
- name: centos
version: 7
python: 2
engine: docker

- name: fedora
version: 31
python: 3
engine: docker

steps:
- name: Check out repo
uses: actions/checkout@master

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

- name: Install Python dependencies
run: pip install flake8

- name: Run flake8
uses: samuelmeuli/lint-action@master
with:
github_token: ${{ secrets.github_token }}
flake8: true
flake8_args: "--max-line-length=100"
17 changes: 17 additions & 0 deletions .github/workflows/shellcheck.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Shellcheck

on: [pull_request]

jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest

steps:
- name: Check out repo
uses: actions/checkout@master

- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -Calways
121 changes: 121 additions & 0 deletions .github/workflows/test_sh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Run tests using test.sh

on: [pull_request]

jobs:
test:
name: Python ${{ matrix.os.python }} tests on ${{ matrix.os.name }}-${{ matrix.os.version }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
os:
- name: centos
version: 7
python: 2
engine: docker

- name: fedora
version: 30
python: 3
engine: docker

- name: fedora
version: 31
python: 3
engine: docker

steps:
- name: Check out repo
uses: actions/checkout@master

- name: test.sh
env:
OS: ${{ matrix.os.name }}
OS_VERSION: ${{ matrix.os.version }}
PYTHON_VERSION: ${{ matrix.os.python }}
ENGINE: ${{ matrix.os.engine }}
run: ./test.sh

- name: Coveralls Python parallel
uses: AndreMiras/coveralls-python-action@master
with:
parallel: true

coveralls_finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Python finish
uses: AndreMiras/coveralls-python-action@master
with:
parallel-finished: true

pylint:
name: Pylint analyzer for Python ${{ matrix.os.python }}
runs-on: ubuntu-latest

strategy:
matrix:
os:
- name: fedora
version: 29
python: 2
engine: docker

- name: fedora
version: 31
python: 3
engine: docker

steps:
- uses: actions/checkout@master

- run: ./test.sh
env:
OS: ${{ matrix.os.name }}
OS_VERSION: ${{ matrix.os.version }}
PYTHON_VERSION: ${{ matrix.os.python }}
ENGINE: ${{ matrix.os.engine }}
ACTION: pylint

bandit:
name: Bandit analyzer for Python ${{ matrix.os.python }}
runs-on: ubuntu-latest

strategy:
matrix:
os:
- name: centos
version: 7
python: 2
engine: docker

- name: fedora
version: 31
python: 3
engine: docker

steps:
- uses: actions/checkout@v1

- run: ./test.sh
env:
OS: ${{ matrix.os.name }}
OS_VERSION: ${{ matrix.os.version }}
PYTHON_VERSION: ${{ matrix.os.python }}
ENGINE: ${{ matrix.os.engine }}
ACTION: bandit

markdownlint:
name: markdownlint analyzer
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master

- run: ./test.sh
env:
ENGINE: docker
ACTION: markdownlint
5 changes: 0 additions & 5 deletions .stickler.yml

This file was deleted.

50 changes: 0 additions & 50 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CONTAINER_NAME="atomic-reactor-$OS-$OS_VERSION-py$PYTHON_VERSION"
if [[ $ACTION == "markdownlint" ]]; then
IMAGE="ruby"
CONTAINER_NAME="atomic-reactor-$ACTION-$IMAGE"
RUN="$ENGINE exec -ti $CONTAINER_NAME"
RUN="$ENGINE exec -i $CONTAINER_NAME"
fi

# Use arrays to prevent globbing and word splitting
Expand Down Expand Up @@ -43,7 +43,7 @@ function setup_osbs() {

# PIP_PREFIX: osbs-client provides input templates that must be copied into /usr/share/...
ENVS='-e PIP_PREFIX=/usr'
RUN="$ENGINE exec -ti ${ENVS} $CONTAINER_NAME"
RUN="$ENGINE exec -i ${ENVS} $CONTAINER_NAME"
PYTHON="python$PYTHON_VERSION"
PIP="pip$PYTHON_VERSION"
if [[ $OS == "fedora" ]]; then
Expand Down Expand Up @@ -142,7 +142,7 @@ function setup_osbs() {
case ${ACTION} in
"test")
setup_osbs
TEST_CMD="pytest tests --cov atomic_reactor --cov-report html"
TEST_CMD="coverage run --source=atomic_reactor -m pytest --color=yes tests"
;;
"pylint")
setup_osbs
Expand Down

0 comments on commit d98b639

Please sign in to comment.