Skip to content

Update CI to Python 3.9-3.10 and Node 20-22 #422

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

Open
wants to merge 3 commits 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
66 changes: 23 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,37 @@
name: CI Django and Node

name: CI
on:
pull_request:

push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
include:
- node: 20
python: '3.9'
- node: 22
python: '3.10'
name: node:${{ matrix.node }} / python:${{ matrix.python }}
steps:
- uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '18'

- name: Cache node_modules
uses: actions/[email protected]
id: cached-node_modules
node-version: ${{ matrix.node }}
cache: yarn
- name: yarn> Install node modules
run: yarn --frozen-lockfile
- uses: actions/setup-python@v5
with:
path: |
node_modules
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}

- name: Install all yarn packages
if: steps.cached-node_modules.outputs.cache-hit != 'true'
run: |
yarn --frozen-lockfile

- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Cache pip
uses: actions/[email protected]
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install Dependencies
run: |
pip install -U pip wheel --progress-bar off
pip install -r requirements.txt --progress-bar off

- name: Run lints
python-version: ${{ matrix.python }}
cache: pip
- name: pip> Install dependencies
run: pip install -r requirements.txt
- name: Lint app & client
run: |
black --check app.py
flake8 app.py
yarn prettier:check

- name: Build client
run: |
yarn run build
run: yarn run build
19 changes: 9 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.6-slim
FROM python:3.9-slim

WORKDIR /app/
RUN groupadd --gid 10001 app && useradd -g app --uid 10001 --shell /usr/sbin/nologin app
Expand All @@ -8,33 +8,32 @@ RUN apt-get update && \

# Install Node and Yarn
RUN curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
echo 'deb https://deb.nodesource.com/node_10.x stretch main' > /etc/apt/sources.list.d/nodesource.list && \
echo 'deb-src https://deb.nodesource.com/node_10.x stretch main' >> /etc/apt/sources.list.d/nodesource.list && \
echo 'deb https://deb.nodesource.com/node_20.x bookworm main' > /etc/apt/sources.list.d/nodesource.list && \
echo 'deb-src https://deb.nodesource.com/node_20.x bookworm main' >> /etc/apt/sources.list.d/nodesource.list && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo 'deb https://dl.yarnpkg.com/debian/ stable main' > /etc/apt/sources.list.d/yarn.list && \
apt-get update && \
apt-get install -y nodejs yarn

COPY ./requirements.txt /app/requirements.txt
COPY ./requirements-constraints.txt /app/requirements-constraints.txt
COPY ./package.json /app/package.json
COPY ./yarn.lock /app/yarn.lock

RUN pip install -U 'pip>=8' && \
pip install --no-cache-dir -r requirements.txt --progress-bar off && \
yarn install --non-interactive --prod
yarn install --non-interactive

# Install the app
COPY . /app/
RUN yarn build --prod
RUN yarn build

# Set Python-related environment variables to reduce annoying-ness
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV PORT 5000
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PORT=5000

USER app

EXPOSE $PORT

CMD python app.py
CMD ["python", "app.py"]
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ references which git sha has been deployed.

## License

[MPL 2.0](http://www.mozilla.org/MPL/2.0/)
[MPL 2.0](https://www.mozilla.org/MPL/2.0/)

## Credits

Expand All @@ -33,7 +33,6 @@ To install dependencies:

```
pip install -r requirements.txt
pip install -r dev-requirements.txt
yarn install
```

Expand Down