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

git subrepo pull (merge) out-of-memory #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Empty file added out-of-memory/.gitattributes
Empty file.
14 changes: 14 additions & 0 deletions out-of-memory/.github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Black Formatting

on:
workflow_call:

jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: psf/black@stable
with:
options: "--check --verbose"
src: "."
version: "~= 22.0"
52 changes: 52 additions & 0 deletions out-of-memory/.github/workflows/build-pytest-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

name: Run Unit Tests on Multiple Python Versions and Distributions

on:
workflow_call:

env:
REPOSITORY: lukeshirnia/out-of-memory

jobs:

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 }}

# Don't pull for now
# - name: Pull Docker images (if exists)
# run: |
# docker-compose config | grep 'image:' | awk '{print $2}' | while read image; do
# base_image_name=$(echo $image | awk -F: '{print $1}')
# version_tag=$(echo $image | awk -F: '{print $2}')
# existing_tag="${{ env.REPOSITORY }}:${base_image_name#*/}"
# echo "Trying to pull existing image $existing_tag"
# docker pull $existing_tag || true # Continue even if pull fails
# done

- name: Build Docker images
run: |
docker-compose build --pull

- 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
11 changes: 11 additions & 0 deletions out-of-memory/.github/workflows/isort.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Run isort

on:
workflow_call:

jobs:
isort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: isort/isort-action@v1
53 changes: 53 additions & 0 deletions out-of-memory/.github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Main

on:
workflow_dispatch:
pull_request:
branches:
- master

jobs:
detect-file-changes:
runs-on: ubuntu-latest
outputs:
docker_changes: ${{ steps.changes.outputs.docker_changes }}
oom_investigate: ${{ steps.changes.outputs.oom_investigate }}

steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
docker_changes:
- "Dockerfile"
- "docker-compose.yml"
oom_investigate:
- ".github/workflows/*.yml"
- "tests/**/*"
- "oom_investigate.py"

build-pytest-images:
needs:
- detect-file-changes
uses: ./.github/workflows/build-pytest-images.yml
if: needs.detect-file-changes.outputs.docker_changes == 'true'
secrets: inherit

black:
needs:
- detect-file-changes
uses: ./.github/workflows/black.yml
if: needs.detect-file-changes.outputs.oom_investigate == 'true'

isort:
needs:
- detect-file-changes
uses: ./.github/workflows/isort.yml
if: needs.detect-file-changes.outputs.oom_investigate == 'true'

# pytest:
# needs:
# - detect-file-changes
# uses: ./.github/workflows/pytest.yml
# if: needs.detect-file-changes.outputs.oom_investigate == 'true'
67 changes: 67 additions & 0 deletions out-of-memory/.github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

name: Run Unit Tests on Multiple Python Versions and Distributions

on:
workflow_call:

env:
REPOSITORY: lukeshirnia/out-of-memory

jobs:
test-python-versions:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["python27", "python36", "python310"]
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Run pytest
run: |
docker run --rm \
-v ${{ github.workspace }}:/app \
${{ env.REPOSITORY }}:${{ matrix.python-version }}-pytest \
pytest -v --ignore=tests/test_system.py --ignore tests/test_large_log.py

test-systems:
runs-on: ubuntu-latest
strategy:
matrix:
distro: ["amazonlinux", "centos7", "osx"]
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup test command
id: setup
run: |
if [ "${{ matrix.distro }}" == "osx" ]; then
echo "::set-output name=command::python -m pytest"
else
echo "::set-output name=command::pytest"
fi

- name: Run system tests
run: |
docker run --rm -v ${{ github.workspace }}:/app \
${{ env.REPOSITORY }}:${{ matrix.distro }}-pytest \
${{ steps.setup.outputs.command }} -v tests/test_validate_options.py -p no:cacheprovider

test-systems-with-logs:
# We only want to pull large files once, so lets run this on a single runner
runs-on: ubuntu-latest
strategy:
matrix:
distro: ["amazonlinux"]
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
lfs: true

- name: Run system tests with logs
run: |
docker run --rm -v ${{ github.workspace }}:/app \
${{ env.REPOSITORY }}:${{ matrix.distro }}-pytest \
pytest -v tests/test_large_log.py -p no:cacheprovider -s
160 changes: 160 additions & 0 deletions out-of-memory/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
6 changes: 3 additions & 3 deletions out-of-memory/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/LukeShirnia/out-of-memory.git
branch = master
commit = 31336ad2322bb37d2bcd076a3400f5f8e279ddc1
parent = 5b12313530521ba78b3a53a1e64b7f41aa30f6da
commit = 105810570acb775fddab38baa479973ca2bbd679
parent = 1ea7dd1b9e068c47fbed3d1dc51de5a6e158fe00
method = merge
cmdver = 0.4.0
cmdver = 0.4.6
22 changes: 22 additions & 0 deletions out-of-memory/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ARG IMAGE
FROM ${IMAGE}
ARG IMAGE
ARG PIP
ARG PYTHON_VERSION

RUN if echo ${IMAGE} | grep -q "amazon"; then \
# Amazon Linux doesn't have rsyslog installed by default
yum update -y && yum install -y python3-pip rsyslog; \
elif echo ${IMAGE} | grep -q "centos"; then \
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py && \
python get-pip.py; \
elif echo ${IMAGE} | grep -q "osx"; then \
python -m ensurepip; \
fi

RUN ${PIP} install pytest

# Only install black on Python 3.x as it doesn't exist on 2.x
RUN if [ $PYTHON_VERSION -ge 3 ]; then ${PIP} install black isort; fi

WORKDIR /app
Loading