-
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 9f82f54
Showing
4 changed files
with
72 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,84 @@ | ||
name: Run Unit Tests on Multiple Python Versions | ||
|
||
name: Run Unit Tests on Multiple Python Versions and Distributions | ||
|
||
on: | ||
workflow_call: | ||
|
||
|
||
env: | ||
REPOSITORY: lukeshirnia/out-of-memory | ||
|
||
jobs: | ||
pytest_legacy_python: | ||
name: python:${{ matrix.python-version }} | ||
runs-on: ubuntu-20.04 | ||
container: | ||
image: python:${{ matrix.python-version }}-buster | ||
|
||
build_and_push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Build Docker images | ||
run: | | ||
docker-compose build | ||
- name: Push Docker images | ||
run: | | ||
docker-compose config | grep 'image:' | awk '{print $2}' | while read image; do | ||
echo "Processing image: $image" | ||
base_image_name=$(echo $image | awk -F: '{print $1}') | ||
version_tag=$(echo $image | awk -F: '{print $2}') | ||
new_tag="${{ env.REPOSITORY }}:${base_image_name#*/}" | ||
echo "Tagging image $image as $new_tag" | ||
docker tag $image $new_tag | ||
docker push $new_tag | ||
done | ||
test-python-versions: | ||
needs: build_and_push | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
python-version: ["2.7", "3.6"] | ||
python-version: ["python27", "python36", "python310"] | ||
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: Test with pytest | ||
- name: Run pytest | ||
run: | | ||
pip install pytest pytest-cov | ||
pytest tests/ | ||
docker run --rm \ | ||
-v ${{ github.workspace }}:/app \ | ||
${{ env.REPOSITORY }}:${{ matrix.python-version }}-pytest \ | ||
pytest -v --ignore=tests/test_system.py | ||
pytest_latest_python: | ||
name: ${{ matrix.os }} ${{ matrix.python-version }} | ||
runs-on: ${{ matrix.os }} | ||
test-systems: | ||
needs: build_and_push | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: ["3.11"] | ||
distro: ["amazonlinux", "centos7", "osx"] | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Display Python version | ||
run: python -c "import sys; print(sys.version)" | ||
- name: Setup test command | ||
id: setup | ||
run: | | ||
if [ "${{ matrix.distro }}" == "osx-pytest" ]; then | ||
echo "::set-output name=command::python -m pytest" | ||
else | ||
echo "::set-output name=command::pytest" | ||
fi | ||
- name: Test with pytest | ||
- name: Run system tests | ||
run: | | ||
pip install pytest pytest-cov | ||
pytest tests/ | ||
docker run --rm -v ${{ github.workspace }}:/app \ | ||
${{ env.REPOSITORY }}:${{ matrix.distro }}-pytest \ | ||
${{ steps.setup.outputs.command }} -v tests/test_system.py -p no:cacheprovider |
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