2020-01-02 09:22:03 +00:00
|
|
|
name: passbook-ci
|
2019-12-30 09:25:35 +00:00
|
|
|
on:
|
|
|
|
- push
|
|
|
|
env:
|
|
|
|
POSTGRES_DB: passbook
|
|
|
|
POSTGRES_USER: passbook
|
|
|
|
POSTGRES_PASSWORD: "EK-5jnKfjrGRm<77"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
# Linting
|
|
|
|
pylint:
|
2020-01-02 12:49:24 +00:00
|
|
|
runs-on: ubuntu-latest
|
2019-12-30 09:25:35 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2020-03-04 20:15:44 +00:00
|
|
|
- uses: actions/setup-python@v1
|
2019-12-30 09:25:35 +00:00
|
|
|
with:
|
2020-03-04 20:15:44 +00:00
|
|
|
python-version: '3.8'
|
2019-12-30 09:25:35 +00:00
|
|
|
- name: Install dependencies
|
2020-03-04 20:13:40 +00:00
|
|
|
run: sudo pip install -U wheel pipenv && pipenv install --dev
|
2019-12-30 09:25:35 +00:00
|
|
|
- name: Lint with pylint
|
|
|
|
run: pipenv run pylint passbook
|
2019-12-31 11:51:16 +00:00
|
|
|
black:
|
2020-01-02 12:49:24 +00:00
|
|
|
runs-on: ubuntu-latest
|
2019-12-30 09:25:35 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2020-03-04 20:15:44 +00:00
|
|
|
- uses: actions/setup-python@v1
|
2019-12-30 09:25:35 +00:00
|
|
|
with:
|
2020-03-04 20:15:44 +00:00
|
|
|
python-version: '3.8'
|
2019-12-30 09:25:35 +00:00
|
|
|
- name: Install dependencies
|
2020-03-04 20:13:40 +00:00
|
|
|
run: sudo pip install -U wheel pipenv && pipenv install --dev
|
2019-12-31 11:51:16 +00:00
|
|
|
- name: Lint with black
|
|
|
|
run: pipenv run black --check passbook
|
2019-12-30 09:25:35 +00:00
|
|
|
prospector:
|
2020-01-02 12:49:24 +00:00
|
|
|
runs-on: ubuntu-latest
|
2019-12-30 09:25:35 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2020-03-04 20:15:44 +00:00
|
|
|
- uses: actions/setup-python@v1
|
2019-12-30 09:25:35 +00:00
|
|
|
with:
|
2020-03-04 20:15:44 +00:00
|
|
|
python-version: '3.8'
|
2019-12-30 09:25:35 +00:00
|
|
|
- name: Install dependencies
|
2020-03-04 20:13:40 +00:00
|
|
|
run: sudo pip install -U wheel pipenv && pipenv install --dev && pipenv install --dev prospector --skip-lock
|
2019-12-30 09:25:35 +00:00
|
|
|
- name: Lint with prospector
|
|
|
|
run: pipenv run prospector
|
2020-01-02 12:41:49 +00:00
|
|
|
bandit:
|
2020-01-02 12:49:24 +00:00
|
|
|
runs-on: ubuntu-latest
|
2020-01-02 12:41:49 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2020-03-04 20:15:44 +00:00
|
|
|
- uses: actions/setup-python@v1
|
2020-01-02 12:41:49 +00:00
|
|
|
with:
|
2020-03-04 20:15:44 +00:00
|
|
|
python-version: '3.8'
|
2020-01-02 12:41:49 +00:00
|
|
|
- name: Install dependencies
|
2020-03-04 20:13:40 +00:00
|
|
|
run: sudo pip install -U wheel pipenv && pipenv install --dev
|
2020-01-02 12:41:49 +00:00
|
|
|
- name: Lint with bandit
|
|
|
|
run: pipenv run bandit -r passbook
|
2020-05-06 22:32:03 +00:00
|
|
|
pyright:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- uses: actions/setup-node@v1
|
2020-05-06 22:38:41 +00:00
|
|
|
- uses: actions/setup-python@v1
|
|
|
|
with:
|
|
|
|
python-version: '3.8'
|
2020-05-06 22:33:42 +00:00
|
|
|
- name: Install pyright
|
2020-05-06 22:36:13 +00:00
|
|
|
run: npm install -g pyright
|
2020-05-23 18:33:23 +00:00
|
|
|
- name: Show pyright version
|
|
|
|
run: pyright --version
|
2020-05-06 22:38:41 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
run: sudo pip install -U wheel pipenv && pipenv install --dev
|
|
|
|
- name: Lint with pyright
|
|
|
|
run: pipenv run pyright
|
2019-12-30 09:25:35 +00:00
|
|
|
# Actual CI tests
|
|
|
|
migrations:
|
|
|
|
needs:
|
|
|
|
- pylint
|
2019-12-31 11:52:15 +00:00
|
|
|
- black
|
2019-12-30 09:25:35 +00:00
|
|
|
- prospector
|
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres:latest
|
|
|
|
env:
|
|
|
|
POSTGRES_DB: passbook
|
|
|
|
POSTGRES_USER: passbook
|
|
|
|
POSTGRES_PASSWORD: "EK-5jnKfjrGRm<77"
|
|
|
|
ports:
|
|
|
|
- 5432:5432
|
|
|
|
redis:
|
|
|
|
image: redis:latest
|
|
|
|
ports:
|
|
|
|
- 6379:6379
|
2020-01-02 12:49:24 +00:00
|
|
|
runs-on: ubuntu-latest
|
2019-12-30 09:25:35 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2020-03-04 20:15:44 +00:00
|
|
|
- uses: actions/setup-python@v1
|
2019-12-30 09:25:35 +00:00
|
|
|
with:
|
2020-03-04 20:15:44 +00:00
|
|
|
python-version: '3.8'
|
2019-12-30 09:25:35 +00:00
|
|
|
- name: Install dependencies
|
2020-03-04 20:13:40 +00:00
|
|
|
run: sudo pip install -U wheel pipenv && pipenv install --dev
|
2019-12-30 09:25:35 +00:00
|
|
|
- name: Run migrations
|
|
|
|
run: pipenv run ./manage.py migrate
|
|
|
|
coverage:
|
|
|
|
needs:
|
|
|
|
- pylint
|
2019-12-31 11:52:15 +00:00
|
|
|
- black
|
2019-12-30 09:25:35 +00:00
|
|
|
- prospector
|
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres:latest
|
|
|
|
env:
|
|
|
|
POSTGRES_DB: passbook
|
|
|
|
POSTGRES_USER: passbook
|
|
|
|
POSTGRES_PASSWORD: "EK-5jnKfjrGRm<77"
|
|
|
|
ports:
|
|
|
|
- 5432:5432
|
|
|
|
redis:
|
|
|
|
image: redis:latest
|
|
|
|
ports:
|
|
|
|
- 6379:6379
|
2020-01-02 12:49:24 +00:00
|
|
|
runs-on: ubuntu-latest
|
2019-12-30 09:25:35 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2020-03-04 20:15:44 +00:00
|
|
|
- uses: actions/setup-python@v1
|
2019-12-30 09:25:35 +00:00
|
|
|
with:
|
2020-03-04 20:15:44 +00:00
|
|
|
python-version: '3.8'
|
2020-06-21 11:18:06 +00:00
|
|
|
- uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: '12'
|
2019-12-30 09:25:35 +00:00
|
|
|
- name: Install dependencies
|
2020-06-19 17:45:46 +00:00
|
|
|
run: |
|
|
|
|
sudo pip install -U wheel pipenv
|
|
|
|
pipenv install --dev
|
|
|
|
- name: Prepare Chrome node
|
|
|
|
run: |
|
|
|
|
cd e2e
|
|
|
|
docker-compose pull -q chrome
|
|
|
|
docker-compose up -d chrome
|
2020-06-21 11:18:06 +00:00
|
|
|
- name: Build static files for e2e test
|
|
|
|
run: |
|
|
|
|
cd passbook/static/static
|
|
|
|
yarn
|
2019-12-30 09:25:35 +00:00
|
|
|
- name: Run coverage
|
2020-06-19 18:57:42 +00:00
|
|
|
run: pipenv run coverage run ./manage.py test --failfast
|
2020-05-13 20:40:09 +00:00
|
|
|
- name: Create XML Report
|
|
|
|
run: pipenv run coverage xml
|
2020-05-13 16:52:37 +00:00
|
|
|
- uses: codecov/codecov-action@v1
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
2020-02-23 12:54:19 +00:00
|
|
|
# Build
|
|
|
|
build-server:
|
|
|
|
needs:
|
|
|
|
- migrations
|
|
|
|
- coverage
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: Docker Login Registry
|
|
|
|
env:
|
|
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
|
|
|
- name: Building Docker Image
|
|
|
|
run: docker build
|
|
|
|
--no-cache
|
2020-06-15 17:27:44 +00:00
|
|
|
-t beryju/passbook:gh-${GITHUB_REF##*/}
|
2020-02-23 12:54:19 +00:00
|
|
|
-f Dockerfile .
|
|
|
|
- name: Push Docker Container to Registry
|
2020-06-15 17:27:44 +00:00
|
|
|
run: docker push beryju/passbook:gh-${GITHUB_REF##*/}
|
2020-02-23 12:54:19 +00:00
|
|
|
build-gatekeeper:
|
|
|
|
needs:
|
|
|
|
- migrations
|
|
|
|
- coverage
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: Docker Login Registry
|
|
|
|
env:
|
|
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
|
|
|
- name: Building Docker Image
|
|
|
|
run: |
|
|
|
|
cd gatekeeper
|
|
|
|
docker build \
|
|
|
|
--no-cache \
|
2020-06-15 17:27:44 +00:00
|
|
|
-t beryju/passbook-gatekeeper:gh-${GITHUB_REF##*/} \
|
2020-02-23 12:54:19 +00:00
|
|
|
-f Dockerfile .
|
|
|
|
- name: Push Docker Container to Registry
|
2020-06-15 17:27:44 +00:00
|
|
|
run: docker push beryju/passbook-gatekeeper:gh-${GITHUB_REF##*/}
|
2020-02-23 12:54:19 +00:00
|
|
|
build-static:
|
|
|
|
needs:
|
|
|
|
- migrations
|
|
|
|
- coverage
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres:latest
|
|
|
|
env:
|
|
|
|
POSTGRES_DB: passbook
|
|
|
|
POSTGRES_USER: passbook
|
|
|
|
POSTGRES_PASSWORD: "EK-5jnKfjrGRm<77"
|
|
|
|
redis:
|
|
|
|
image: redis:latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: Docker Login Registry
|
|
|
|
env:
|
|
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
|
|
|
- name: Building Docker Image
|
|
|
|
run: docker build
|
|
|
|
--no-cache
|
|
|
|
--network=$(docker network ls | grep github | awk '{print $1}')
|
2020-06-15 17:27:44 +00:00
|
|
|
-t beryju/passbook-static:gh-${GITHUB_REF##*/}
|
2020-02-23 12:54:19 +00:00
|
|
|
-f static.Dockerfile .
|
|
|
|
- name: Push Docker Container to Registry
|
2020-06-15 17:27:44 +00:00
|
|
|
run: docker push beryju/passbook-static:gh-${GITHUB_REF##*/}
|