Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pr workflow #84

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: "Check Pull Request"

on:
pull_request:
branches:
- main
- master

jobs:
lint:
name: "Checking format"
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install pipenv
run: |
python -m pip install --upgrade pipenv wheel
- id: cache-pipenv
uses: actions/cache@v1
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
pipenv install --dev
- name: Run lint
run: |
pipenv run format || (echo "::error file={name},line={line},endLine={endLine},title={title}::{message}" && exit 1)

test:
name: "Running tests"
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install pipenv
run: |
python -m pip install --upgrade pipenv wheel
- id: cache-pipenv
uses: actions/cache@v1
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
pipenv install --dev
- name: Run test suite
run: |
pipenv run coverage
- name: Get Cover
uses: orgoro/coverage@v3.1
with:
coverageFile: coverage.xml
token: ${{ secrets.PR_GITHUB_TOKEN }}

install-test:
name: "Install"
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install project
run: |
python -m pip install ./
4 changes: 3 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ ntplib = "*"

[dev-packages]
autopep8 = "*"
coverage = "*"

[requires]
python_version = "3.10"

[scripts]
test = "python -m unittest discover -s test_ensta/ -t ."
format = "autopep8 --in-place --recursive ."
format = "autopep8 --exit-code ."
coverage = "sh -c 'coverage run -m unittest discover -s test_ensta/ -t . && coverage xml'"
Loading
Loading