From 2836fc7d99ae7e2b50e13335e03ffb7f6d8bdba5 Mon Sep 17 00:00:00 2001 From: Stephanos Kuma Date: Mon, 5 Jul 2021 17:54:27 +0300 Subject: [PATCH] User github workflows instead of travis --- .github/workflows/python-package.yml | 39 ++++++++++++++++++++++++++++ .travis.yml | 16 ------------ make.toml | 20 +++++++++----- 3 files changed, 52 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/python-package.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..e67e6b0 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,39 @@ +name: Test default branch + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - uses: Gr1N/setup-poetry@v4 + - uses: actions/cache@v2 + with: + path: ~/.cache/pypoetry/virtualenvs + key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip wheel setuptools + pip install yamk + yam + - name: Lint with flake8 + run: | + yam lint + - name: Test with pytest + run: | + yam tests diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2ee9d57..0000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: python - -python: - - "3.6" - - "3.7" - - "3.8" - - "3.9" - -install: - - "pip install poetry" - - "pip install yamk" - - "yam" - -script: - - "yam lint" - - "yam tests" diff --git a/make.toml b/make.toml index dc848eb..3ce511b 100644 --- a/make.toml +++ b/make.toml @@ -1,3 +1,8 @@ +["$globals"] +vars = [ + {runner = "poetry run"}, +] + [all] alias = "install" @@ -13,28 +18,29 @@ commands = [ phony = true requires = ["install"] commands = [ - "isort .", - "black .", + "${runner} isort .", + "${runner} black .", ] [lint] phony = true requires = ["install"] commands = [ - "flake8 .", - "isort --check .", - "black --check .", + "${runner} isort --check .", + "${runner} black --check .", + "${runner} flake8 .", + "${runner} mypy .", ] [tests] phony = true requires = ["install"] commands = [ - "pytest ${pytest_args} ${pytest_path}", + "${runner} pytest ${pytest_args} ${pytest_path}", ] ["poetry.lock"] requires = ["pyproject.toml"] commands = [ - "poetry lock && touch ${.target}", + "${runner} poetry lock && touch ${.target}", ]