-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef209c0
commit efc2a51
Showing
3 changed files
with
131 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,143 @@ | ||
name: Run Unit Tests on Multiple Python Versions | ||
|
||
name: Run Unit Tests on Multiple Python Versions and Distributions | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
pytest_legacy_python: | ||
name: python:${{ matrix.python-version }} | ||
runs-on: ubuntu-20.04 | ||
container: | ||
image: python:${{ matrix.python-version }}-buster | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
python-version: ["2.7", "3.6"] | ||
build_and_push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Display Python version | ||
run: python -c "import sys; print(sys.version)" | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Test with pytest | ||
run: | | ||
pip install pytest pytest-cov | ||
pytest tests/ | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Build and push Docker images | ||
run: | | ||
docker-compose -f docker-compose.yml build | ||
docker-compose -f docker-compose.yml config --services | while read service; do | ||
docker tag "${service}:latest" "lukeshirnia/out-of-memory:${service}-latest" | ||
docker push "lukeshirnia/out-of-memory:${service}-latest" | ||
done | ||
pytest_latest_python: | ||
name: ${{ matrix.os }} ${{ matrix.python-version }} | ||
runs-on: ${{ matrix.os }} | ||
test-python-versions: | ||
needs: build_and_push | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: ["3.11"] | ||
python-version: ["python27", "python36", "python310"] | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Run pytest | ||
run: docker compose run --rm ${{ matrix.python-version }}-pytest pytest -v --ignore=tests/test_system.py | ||
|
||
- name: Display Python version | ||
run: python -c "import sys; print(sys.version)" | ||
test-systems: | ||
needs: build_and_push | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
distro: ["amazonlinux", "centos7", "osx"] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Test with pytest | ||
- name: Setup test command | ||
id: setup | ||
run: | | ||
pip install pytest pytest-cov | ||
pytest tests/ | ||
if [ "${{ matrix.distro }}" == "osx-pytest" ]; then | ||
echo "::set-output name=command::python -m pytest" | ||
else | ||
echo "::set-output name=command::pytest" | ||
fi | ||
- name: Run system tests | ||
run: docker compose run --rm ${{ matrix.distro }}-pytest ${{ steps.setup.outputs.command }} -v tests/test_system.py -p no:cacheprovider | ||
|
||
|
||
# name: Run Unit Tests on Multiple Python Versions | ||
|
||
# on: | ||
# workflow_call: | ||
|
||
# jobs: | ||
# pytest_legacy_python_version: | ||
# name: python:${{ matrix.python-version }} | ||
# runs-on: ubuntu-20.04 | ||
# container: | ||
# image: python:${{ matrix.python-version }}-buster | ||
# strategy: | ||
# fail-fast: true | ||
# matrix: | ||
# python-version: ["2.7", "3.6"] | ||
# steps: | ||
# - name: Checkout Code | ||
# uses: actions/checkout@v4 | ||
|
||
# - name: Display Python version | ||
# run: python -c "import sys; print(sys.version)" | ||
|
||
# - name: Test with pytest | ||
# run: | | ||
# pip install pytest pytest-cov | ||
# pytest tests/ | ||
|
||
# pytest_latest_python_version: | ||
# name: ${{ matrix.os }} ${{ matrix.python-version }} | ||
# runs-on: ${{ matrix.os }} | ||
# strategy: | ||
# fail-fast: true | ||
# matrix: | ||
# os: [ubuntu-latest] | ||
# python-version: ["3.11"] | ||
# steps: | ||
# - name: Checkout Code | ||
# uses: actions/checkout@v4 | ||
|
||
# - name: Set up Python | ||
# uses: actions/setup-python@v4 | ||
# with: | ||
# python-version: ${{ matrix.python-version }} | ||
|
||
# - name: Display Python version | ||
# run: python -c "import sys; print(sys.version)" | ||
|
||
# - name: Test with pytest | ||
# run: | | ||
# pip install pytest pytest-cov | ||
# pytest tests/ | ||
|
||
# pytest_distribution_tests: | ||
# name: ${{ matrix.os }} ${{ matrix.python-version }} | ||
# runs-on: ${{ matrix.os }} | ||
# strategy: | ||
# fail-fast: true | ||
# matrix: | ||
# os: [ubuntu-latest] | ||
# python-version: ["3.11"] | ||
# steps: | ||
# - name: Checkout Code | ||
# uses: actions/checkout@v4 | ||
|
||
# - name: Set up Python | ||
# uses: actions/setup-python@v4 | ||
# with: | ||
# python-version: ${{ matrix.python-version }} | ||
|
||
# - name: Display Python version | ||
# run: python -c "import sys; print(sys.version)" | ||
|
||
# - name: Test with pytest | ||
# run: | | ||
# pip install pytest pytest-cov | ||
# pytest tests/distribution_tests/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters