-
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.
Unit Test Workflow, Dockerfile, and Other Improvements
- Loading branch information
Showing
9 changed files
with
121 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Pytest | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: {} | ||
|
||
jobs: | ||
test: | ||
name: Unit Tests | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-22.04, windows-latest, macos-latest] | ||
python-version: ["3.8", "3.9", "3.10", "3.11"] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: pip | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest pytest-cov | ||
pip install -r requirements.txt | ||
- name: Test | ||
run: | | ||
pytest | ||
coverage: | ||
name: Coverage Summary | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
pull-requests: write | ||
contents: read | ||
|
||
if: github.event_name == 'pull_request' | ||
strategy: | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.11" | ||
cache: pip | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest pytest-cov | ||
pip install -r requirements.txt | ||
- name: Run Coverage | ||
run: | | ||
pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=semver | tee pytest-coverage.txt | ||
- name: Comment Result Summary | ||
uses: MishaKav/pytest-coverage-comment@main | ||
with: | ||
pytest-coverage-path: ./pytest-coverage.txt | ||
junitxml-path: ./pytest.xml |
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,29 +1,33 @@ | ||
FROM centos/python-36-centos7 | ||
|
||
USER root | ||
# ======= # | ||
# Builder # | ||
# ======= # | ||
FROM python:3.11-slim as builder | ||
COPY / /semver | ||
RUN pip wheel --no-cache-dir --wheel-dir /wheels /semver | ||
|
||
#Perform updates | ||
RUN pip install --upgrade pip | ||
RUN yum update -y | ||
RUN yum -y remove git | ||
RUN yum -y install https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-1.7-1.x86_64.rpm | ||
RUN yum -y install git | ||
# ======== # | ||
# Finalize # | ||
# ======== # | ||
FROM python:3.11-slim | ||
|
||
#Setup semver | ||
ADD / /semver | ||
WORKDIR /semver | ||
RUN python setup.py sdist | ||
RUN pip install dist/semver-*.tar.gz | ||
# Update and install git | ||
RUN apt-get update && apt-get install -y git | ||
|
||
# Create user | ||
RUN mkdir /semver && \ | ||
groupadd -g 10001 semver && \ | ||
useradd -u 10000 -g semver -d /semver semver \ | ||
&& chown -R semver:semver /semver | ||
|
||
# Prep workspace | ||
RUN mkdir /workspace | ||
WORKDIR /workspace | ||
RUN mkdir /workspace && \ | ||
chown -R semver:semver /workspace | ||
VOLUME /workspace | ||
|
||
#Permissions | ||
RUN useradd -d /semverUser semverUser | ||
RUN chown -R semverUser:semverUser /workspace | ||
# Setup semver | ||
COPY --from=builder /wheels /semver/wheels | ||
RUN pip install --no-cache /semver/wheels/* | ||
|
||
CMD [ "semver" ] | ||
|
||
USER semverUser | ||
USER semver:semver | ||
WORKDIR /workspace | ||
ENTRYPOINT [ "semver" ] |
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
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 was deleted.
Oops, something went wrong.
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
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