ci: migrate building
This commit is contained in:
parent
1ed7e900f2
commit
4037a444eb
200
.github/workflows/ci.yml
vendored
200
.github/workflows/ci.yml
vendored
|
@ -1,200 +0,0 @@
|
||||||
name: passbook-ci
|
|
||||||
on:
|
|
||||||
- push
|
|
||||||
env:
|
|
||||||
POSTGRES_DB: passbook
|
|
||||||
POSTGRES_USER: passbook
|
|
||||||
POSTGRES_PASSWORD: "EK-5jnKfjrGRm<77"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# Linting
|
|
||||||
pylint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- uses: actions/setup-python@v1
|
|
||||||
with:
|
|
||||||
python-version: '3.8'
|
|
||||||
- name: Install dependencies
|
|
||||||
run: sudo pip install -U wheel pipenv && pipenv install --dev
|
|
||||||
- name: Lint with pylint
|
|
||||||
run: pipenv run pylint passbook
|
|
||||||
black:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- uses: actions/setup-python@v1
|
|
||||||
with:
|
|
||||||
python-version: '3.8'
|
|
||||||
- name: Install dependencies
|
|
||||||
run: sudo pip install -U wheel pipenv && pipenv install --dev
|
|
||||||
- name: Lint with black
|
|
||||||
run: pipenv run black --check passbook
|
|
||||||
prospector:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- uses: actions/setup-python@v1
|
|
||||||
with:
|
|
||||||
python-version: '3.8'
|
|
||||||
- name: Install dependencies
|
|
||||||
run: sudo pip install -U wheel pipenv && pipenv install --dev && pipenv install --dev prospector --skip-lock
|
|
||||||
- name: Lint with prospector
|
|
||||||
run: pipenv run prospector
|
|
||||||
bandit:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- uses: actions/setup-python@v1
|
|
||||||
with:
|
|
||||||
python-version: '3.8'
|
|
||||||
- name: Install dependencies
|
|
||||||
run: sudo pip install -U wheel pipenv && pipenv install --dev
|
|
||||||
- name: Lint with bandit
|
|
||||||
run: pipenv run bandit -r passbook
|
|
||||||
pyright:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- uses: actions/setup-node@v1
|
|
||||||
- uses: actions/setup-python@v1
|
|
||||||
with:
|
|
||||||
python-version: '3.8'
|
|
||||||
- name: Install pyright
|
|
||||||
run: npm install -g pyright
|
|
||||||
- name: Install dependencies
|
|
||||||
run: sudo pip install -U wheel pipenv && pipenv install --dev
|
|
||||||
- name: Lint with pyright
|
|
||||||
run: pipenv run pyright
|
|
||||||
# Actual CI tests
|
|
||||||
migrations:
|
|
||||||
needs:
|
|
||||||
- pylint
|
|
||||||
- black
|
|
||||||
- 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
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- uses: actions/setup-python@v1
|
|
||||||
with:
|
|
||||||
python-version: '3.8'
|
|
||||||
- name: Install dependencies
|
|
||||||
run: sudo pip install -U wheel pipenv && pipenv install --dev
|
|
||||||
- name: Run migrations
|
|
||||||
run: pipenv run ./manage.py migrate
|
|
||||||
coverage:
|
|
||||||
needs:
|
|
||||||
- pylint
|
|
||||||
- black
|
|
||||||
- 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
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- uses: actions/setup-python@v1
|
|
||||||
with:
|
|
||||||
python-version: '3.8'
|
|
||||||
- name: Install dependencies
|
|
||||||
run: sudo pip install -U wheel pipenv && pipenv install --dev
|
|
||||||
- name: Run coverage
|
|
||||||
run: pipenv run ./scripts/coverage.sh
|
|
||||||
- name: Create XML Report
|
|
||||||
run: pipenv run coverage xml
|
|
||||||
- uses: codecov/codecov-action@v1
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
# 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
|
|
||||||
-t beryju/passbook:${GITHUB_REF##*/}
|
|
||||||
-f Dockerfile .
|
|
||||||
- name: Push Docker Container to Registry
|
|
||||||
run: docker push beryju/passbook:${GITHUB_REF##*/}
|
|
||||||
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 \
|
|
||||||
-t beryju/passbook-gatekeeper:${GITHUB_REF##*/} \
|
|
||||||
-f Dockerfile .
|
|
||||||
- name: Push Docker Container to Registry
|
|
||||||
run: docker push beryju/passbook-gatekeeper:${GITHUB_REF##*/}
|
|
||||||
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}')
|
|
||||||
-t beryju/passbook-static:${GITHUB_REF##*/}
|
|
||||||
-f static.Dockerfile .
|
|
||||||
- name: Push Docker Container to Registry
|
|
||||||
run: docker push beryju/passbook-static:${GITHUB_REF##*/}
|
|
|
@ -142,3 +142,47 @@ stages:
|
||||||
- task: CmdLine@2
|
- task: CmdLine@2
|
||||||
inputs:
|
inputs:
|
||||||
script: bash <(curl -s https://codecov.io/bash)
|
script: bash <(curl -s https://codecov.io/bash)
|
||||||
|
- stage: Build
|
||||||
|
jobs:
|
||||||
|
- job: build-server
|
||||||
|
pool:
|
||||||
|
vmImage: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- task: Docker@2
|
||||||
|
inputs:
|
||||||
|
containerRegistry: 'dockerhub'
|
||||||
|
repository: 'beryju/passbook'
|
||||||
|
command: 'buildAndPush'
|
||||||
|
Dockerfile: 'Dockerfile'
|
||||||
|
tags: '$(Build.SourceBranchName)'
|
||||||
|
- job: build-gatekeeper
|
||||||
|
pool:
|
||||||
|
vmImage: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- task: CmdLine@2
|
||||||
|
inputs:
|
||||||
|
script: cd gatekeeper
|
||||||
|
- task: Docker@2
|
||||||
|
inputs:
|
||||||
|
containerRegistry: 'dockerhub'
|
||||||
|
repository: 'beryju/passbook-gatekeeper'
|
||||||
|
command: 'buildAndPush'
|
||||||
|
Dockerfile: 'Dockerfile'
|
||||||
|
tags: '$(Build.SourceBranchName)'
|
||||||
|
- job: build-gatekeeper
|
||||||
|
pool:
|
||||||
|
vmImage: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- task: DockerCompose@0
|
||||||
|
displayName: Run services
|
||||||
|
inputs:
|
||||||
|
dockerComposeFile: 'scripts/docker-compose.yml'
|
||||||
|
action: 'Run services'
|
||||||
|
buildImages: false
|
||||||
|
- task: Docker@2
|
||||||
|
inputs:
|
||||||
|
containerRegistry: 'dockerhub'
|
||||||
|
repository: 'beryju/passbook-static'
|
||||||
|
command: 'buildAndPush'
|
||||||
|
Dockerfile: 'Dockerfile'
|
||||||
|
tags: '$(Build.SourceBranchName)'
|
||||||
|
|
Reference in a new issue