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 Apr 28, 2020
1 parent f598ec4 commit 6cd2519
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 58 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/dockerfile_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Lint Dockerfiles

on: [pull_request]

jobs:
dockerfile-lint:
runs-on: ubuntu-latest

container:
image: hadolint/hadolint:latest-debian

steps:
- uses: actions/checkout@v1

- name: Lint Dockerfiles with hadolint
run: hadolint images/**/Dockerfile tests/files/**/Dockerfile
116 changes: 116 additions & 0 deletions .github/workflows/test_sh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
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:
- uses: actions/checkout@v1

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_test.txt
- 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
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

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@v1

- 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@v1

# - 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.

4 changes: 4 additions & 0 deletions requirements_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pytest
coverage
pytest-cov
coveralls
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="pytest --cov=atomic_reactor --cov-report=html --color=yes tests"
;;
"pylint")
setup_osbs
Expand Down

0 comments on commit 6cd2519

Please sign in to comment.