SLEDO v0.1.1 #14
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
# This section controls when the workflow will run | |
on: | |
# Run the workflow on push to "main" branch | |
push: | |
branches: [ "main" ] | |
# Run the workflow on pull request to "main" branch | |
pull_request: | |
branches: [ "main"] | |
# Run the workflow manually | |
workflow_dispatch: | |
# This section controls which jobs the workflow will run | |
jobs: | |
run-linter: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create venv and install requirements | |
run: | | |
python3 -m venv venv | |
. venv/bin/activate | |
pip3 install build --upgrade | |
python3 -m build | |
pip3 install ./dist/*.whl | |
- name: Run linter | |
run: | | |
. venv/bin/activate | |
pip3 install flake8 | |
flake8 . --exclude=venv* --count --max-complexity=10 --max-line-length=79 --statistics | |
build-and-test: | |
runs-on: ubuntu-latest | |
env: | |
PRCOMMITSHA : ${{ github.event.pull_request.head.sha }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Print github context | |
run: echo $PRCOMMITSHA | |
- name: Docker build (pull request) | |
if: ${{ github.event.pull_request.head.sha != '' }} | |
run: docker build -t ci-sledo-ubuntu --build-arg build_git_sha=$PRCOMMITSHA docker/sledo-ubuntu/ | |
- name: Docker build (push) | |
if: ${{ github.event.pull_request.head.sha == '' }} | |
run: docker build -t ci-sledo-ubuntu --build-arg build_git_sha=$GITHUB_SHA docker/sledo-ubuntu/ | |
- name: Run tests | |
run: | | |
pip3 install pytest | |
pytest tests | |