Skip to content

Commit

Permalink
ci: implement ci workflow and basic tests (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored Oct 6, 2023
1 parent b0105b2 commit c179eea
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 0 deletions.
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)

0 comments on commit c179eea

Please sign in to comment.