Skip to content

Commit

Permalink
Improve CI pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
tedmiston committed Apr 27, 2020
1 parent c1407eb commit 389a81c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

Expand All @@ -11,12 +10,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install
run: pip install poetry && poetry install
run: |
pip install --upgrade pip
pip install poetry
poetry install
- name: Lint
run: make format-check mypy
- name: Unit Tests
run: make test coverage
- name: Build
run: make build
- name: Test
run: make format-check mypy test coverage
- name: Docker Test
run: make test-docker
- name: Run
run: make run
- name: Push
Expand Down
32 changes: 18 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,55 @@ IMAGE=$(NAME):$(TAG)

.PHONY: build
build:
@DOCKER_BUILDKIT=1 docker build --target=prod --tag=$(IMAGE) .
DOCKER_BUILDKIT=1 docker build --target=prod --tag=$(IMAGE) .

.PHONY: build-test
build-test:
@DOCKER_BUILDKIT=1 docker build --target=test --tag=$(IMAGE)-test .
DOCKER_BUILDKIT=1 docker build --target=test --tag=$(IMAGE)-test .

.PHONY: run
run:
@docker run --rm $(IMAGE)
docker run --rm $(IMAGE)

.PHONY: test
test: build-test
@docker run --rm $(IMAGE)-test
test:
poetry run coverage run --source=. --omit=tests/*.py -m pytest

.PHONY: test-docker
test-docker: build-test
docker run --rm $(IMAGE)-test

.PHONY: mypy
mypy:
@poetry run mypy --strict --ignore-missing-imports . tests/
poetry run mypy --strict --ignore-missing-imports . tests/

.PHONY: coverage
coverage:
@poetry run coverage report
poetry run coverage report

.PHONY: coverage-html
coverage-html:
@poetry run coverage html
poetry run coverage html

.PHONY: coverage-html-show
coverage-html-show: coverage-html
@cd htmlcov/ && open http://localhost:8000 && poetry run python -m http.server
cd htmlcov/ && open http://localhost:8000 && poetry run python -m http.server

.PHONY: format-check
format-check:
@poetry run black --check .
poetry run black --check .

.PHONY: format-dry-run
format-dry-run:
@poetry run black --diff .
poetry run black --diff .

.PHONY: format
format:
@poetry run black .
poetry run black .

.PHONY: push
push:
@./ci/push.sh $(IMAGE)
./ci/push.sh $(IMAGE)

cache-clear:
@rm "${HOME}/.wtf-covid-19-ohio/cache.sqlite"
rm "${HOME}/.wtf-covid-19-ohio/cache.sqlite"

0 comments on commit 389a81c

Please sign in to comment.