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

chore(deps): fix machine learning and backend builds #148

Merged
merged 7 commits into from
Aug 3, 2024
Merged
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
43 changes: 21 additions & 22 deletions .github/workflows/admin-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: Install Machine Learning Dependencies
run: pip install -r requirements.txt

- name: Generate Machine Learning Model
run: python model.py

- name: Delete Old Artifacts
uses: actions/github-script@v6
uses: actions/github-script@v7
id: artifact
with:
script: |
Expand All @@ -61,13 +61,13 @@ jobs:
})

- name: Save Machine Learning Model
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ml-model
path: machine-learning/model.pth
retention-days: 1


build-test:
runs-on: ${{ matrix.os }}
needs: ml-model
Expand All @@ -81,14 +81,13 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pipenv'


- name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python

Expand All @@ -98,7 +97,7 @@ jobs:
pipenv sync --dev

- name: Download Machine Learning Model
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ml-model
path: admin-system/backend/instance/
Expand All @@ -119,36 +118,36 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Download Machine Learning Model
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ml-model
path: admin-system/backend/instance/

- name: Log in to the Container registry
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest

- name: Build Image
id: build
uses: docker/build-push-action@v4
uses: docker/build-push-action@v6
with:
context: ./admin-system/backend
platforms: linux/amd64
Expand All @@ -162,7 +161,7 @@ jobs:
run: docker run --rm ${{ fromJSON(steps.build.outputs.metadata)['image.name'] }} /usr/src/.venv/bin/python -m pytest --cov=api --cov-branch

- name: Build & Push Image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v6
with:
context: ./admin-system/backend
platforms: linux/amd64
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/admin-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [18.x, 19.x]
node-version: [18.x, 20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/cache-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Cleanup Cache
run: |
gh extension install actions/gh-actions-cache

REPO=${{ github.repository }}
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"

echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )

## Setting this to not fail the workflow while deleting cache keys.
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/client-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@master
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 19
node-version: 20
check-latest: true
- name: Install Dependencies
run: npm ci
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [18.x, 19.x]
node-version: [18.x, 20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
Expand Down
1 change: 0 additions & 1 deletion admin-system/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ ADD Pipfile.lock Pipfile /usr/src/
WORKDIR /usr/src

# Install pipenv packages
RUN /root/.local/bin/pipenv lock --dev
RUN /root/.local/bin/pipenv sync --dev

FROM python:3.11 AS runtime
Expand Down
29 changes: 15 additions & 14 deletions admin-system/backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,23 @@ verify_ssl = true
name = "pytorch"

[packages]
flask = "*"
flask-bcrypt = "*"
flask-sqlalchemy = "*"
python-dotenv = "*"
sqlalchemy = "*"
flask-cors = "*"
pyopenssl = "*"
gunicorn = "*"
pillow = "*"
werkzeug = "*"
torch = {version = "*", index = "pytorch"}
torchvision = {version = "*", index = "pytorch"}
flask = ">=3.0.3,<4"
flask-bcrypt = ">=1.0.1,<2"
flask-sqlalchemy = ">=3.1.1,<4"
python-dotenv = ">=1.0.1,<2"
sqlalchemy = ">=2.0.30,<3"
flask-cors = ">=4.0.1,<5"
pyopenssl = ">=24.1.0,<25"
gunicorn = ">=22.0.0,<23"
pillow = ">=10.3.0,<11"
werkzeug = ">=3.0.3,<4"
numpy = ">=1.21.4,<2"
torch = {version = ">=2.0.1,<3", index = "pytorch"}
torchvision = {version = ">=0.15.2,<1", index = "pytorch"}

[dev-packages]
pytest = "*"
pytest-cov = "*"
pytest = ">=8.2.1,<9"
pytest-cov = ">=5.0.0,<6"

[requires]
python_version = "3.11"
Loading