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

ci: implement ci workflow and basic tests #1

Merged
merged 1 commit into from
Oct 6, 2023
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
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
name: CI

on:
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
push:
branches: [master]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pytest:
strategy:
fail-fast: false
matrix:
os:
- macos-11
- macos-12
- windows-2019
- windows-2022
- ubuntu-20.04
- ubuntu-22.04
python: ["2.7", "3.8", "3.9", "3.10", "3.11"]

runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Python
id: python
uses: ./
with:
python-version: ${{ matrix.python }}

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade -r requirements-dev.txt

- name: Test with pytest
id: test
env:
INPUT_PYTHON_VERSION: ${{ matrix.python }}
shell: bash
run: |
python -m pytest \
-rxXs \
--tb=native \
--verbose \
tests
4 changes: 4 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pytest==4.6.11;python_version<"3.5"
pytest==6.1.2;python_version>="3.5" and python_version<"3.6"
pytest==7.0.1;python_version>="3.6" and python_version<"3.7"
pytest==7.4.2;python_version>="3.7"
Empty file added tests/__init__.py
Empty file.
11 changes: 11 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
# standard imports
import os

# lib imports
import pytest


@pytest.fixture(scope='session')
def input_python_version():
return os.environ.get('INPUT_PYTHON_VERSION')
12 changes: 12 additions & 0 deletions tests/functional/test_python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# standard imports
import platform
import sys


def test_python_platform_version(input_python_version):
assert platform.python_version().startswith(input_python_version)


def test_python_system_version(input_python_version):
assert sys.version.startswith(input_python_version)