Skip to content

Commit

Permalink
Merge pull request #427 from PyAr/test-docker
Browse files Browse the repository at this point in the history
Added integration tests in a lot of different platforms.
  • Loading branch information
facundobatista authored May 12, 2024
2 parents b75441d + 03a6eb3 commit 08c1ee3
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 0 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/integtests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Integration Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:

archlinux:
runs-on: ubuntu-latest
container:
image: archlinux:latest
volumes:
- ${{ github.workspace }}:/fades
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
pacman -Sy --noconfirm python3 python-setuptools
- name: Simple fades run
run: |
cd /fades
bin/fades -v -d pytest -x pytest --version
# XXX Facundo 2024-03-01: "using a different Python" is missing here because Arch is hard

fedora:
runs-on: ubuntu-latest
container:
image: fedora:latest
volumes:
- ${{ github.workspace }}:/fades
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
yum install --assumeyes python3.12 python3-setuptools
- name: Simple fades run
run: |
cd /fades
bin/fades -v -d pytest -x pytest --version
- name: Using a different Python
run: |
# XXX Facundo 2024-02-29 - remove virtualenv in this install as part of issue #411 work
yum install --assumeyes python3.9 python3-virtualenv
cd /fades
export TEST_PYTHON_VERSION=3.9
python3.12 bin/fades -v --python=python3.9 -d pytest -x pytest -v tests/integtest.py
native:
strategy:
matrix:
# just a selection otherwise it's too much
# - latest OSes
# - oldest and newest Python
os: [ubuntu-22.04, macos-12, windows-2022]
python-version: [3.8, "3.12"]

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

- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v5
id: matrixpy
with:
python-version: ${{ matrix.python-version }}

# XXX Facundo 2024-03-02 - disabled until we enable the cross test below
# - name: Also set up Python 3.10 for cross-Python test
# uses: actions/setup-python@v4
# with:
# python-version: "3.10"

- name: Install dependencies
run: |
${{ steps.matrixpy.outputs.python-path }} -m pip install -U setuptools
- name: Simple fades run
run: |
${{ steps.matrixpy.outputs.python-path }} bin/fades -v -d pytest -x pytest --version
# XXX Facundo 2024-03-02 - commented out as until we finish issue #411 work we need 'virtualenv' and it's a
# hassle to install it in a multiplatform way -- this should be enabled while working on that issue
# - name: Using a different Python
# run: |
# export TEST_PYTHON_VERSION=3.10
# ${{ steps.matrixpy.outputs.python-path }} bin/fades -v --python=python3.10 -d pytest -x pytest -v tests/integtest.py
31 changes: 31 additions & 0 deletions tests/integtest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2024 Facundo Batista, Nicolás Demarchi
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# For further info, check https://github.com/PyAr/fades

"""Helper to run integration tests.
This is not part of the regular test suite, but a test that is used in a very specific
way from the integration tests defined in the Github CI infrastructure.
"""

import os
import sys


def test_assert_python_version():
expected = os.environ["TEST_PYTHON_VERSION"]
vi = sys.version_info
current = f"{vi.major}.{vi.minor}"
assert current == expected

0 comments on commit 08c1ee3

Please sign in to comment.