Skip to content

Commit

Permalink
Merge pull request #18 from worldemar/docker-ci
Browse files Browse the repository at this point in the history
Move CI to Docker for portability
  • Loading branch information
worldemar authored Jan 28, 2025
2 parents 85f3346 + c900d19 commit 2625f6a
Show file tree
Hide file tree
Showing 5 changed files with 267 additions and 262 deletions.
49 changes: 16 additions & 33 deletions .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,16 @@
name: test bundles

on:
pull_request:

jobs:
bundle:
runs-on: windows-2022

steps:
- uses: actions/checkout@v2

- name: set up python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: install python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: set up npm
run: |
npm install -g uglify-js
npm install -g html-minifier
npm install -g inline-scripts
- name: generate QR
run: |
python qrs.py --htmldirs=apps --builddir=bundles
name: Test Bundles

on:
pull_request:

jobs:
bundle:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: build ci environment
run: |
docker build --pull --rm -t qrapps:ci .
- name: generate QR
run: |
docker run --rm -v .:/src -w /src qrapps:ci qrs.py --htmldirs=apps --builddir=bundles
37 changes: 16 additions & 21 deletions .github/workflows/prospector.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
name: prospector

on:
pull_request:

jobs:
prospector:
runs-on: windows-2022
steps:
- uses: actions/checkout@v2
- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-contrib.txt
- name: lint with prospector
run: |
prospector
name: Prospector

on:
pull_request:

jobs:
prospector:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: build ci environment
run: |
docker build --pull --rm -t qrapps:ci .
- name: lint with prospector
run: |
docker run --rm -v .:/src -w /src --entrypoint=prospector qrapps:ci
81 changes: 32 additions & 49 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,32 @@
name: release bundles

on:
push:
branches: [ main ]

jobs:
bundle:
runs-on: windows-2022

steps:
- uses: actions/checkout@v2

- name: set up python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: install python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: set up npm
run: |
npm install -g uglify-js
npm install -g html-minifier
npm install -g inline-scripts
- name: generate QR
run: |
python qrs.py --htmldirs=apps --builddir=bundles
- name: generate README.md
run: |
Remove-Item -Path docs -Force -Recurse
mv bundles docs
git checkout -- docs/_config.yml
python release.py
tree /f docs
- name: release
run: |
git config --global user.email "woldemar@mimas.ru"
git config --global user.name "Vladimir Looze"
git add docs
git commit -m "release new bundles"
git push origin main
name: Release Bundles

on:
push:
branches: [ main ]

jobs:
bundle:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: build ci environment
run: |
docker build --pull --rm -t qrapps:ci .
- name: generate QR
run: |
docker run --rm -v .:/src -w /src qrapps:ci qrs.py --htmldirs=apps --builddir=bundles
- name: generate README.md
run: |
rm -rf docs
mv bundles docs
git checkout -- docs/_config.yml
docker run --rm -v .:/src -w /src qrapps:ci release.py
tree /f docs
- name: release
run: |
git config --global user.email "woldemar@mimas.ru"
git config --global user.name "Vladimir Looze"
git add docs
git commit -m "release new bundles"
git push origin main
44 changes: 44 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Self-contained environment
#
# Build environment:
# docker build --pull --rm -t qrapps:ci .
#
# Run interactive shell, useful for debugging:
# docker run --rm -it -v .:/src -w /src --entrypoint=bash qrapps:ci
#
# Check code quality:
# docker run --rm -it -v .:/src -w /src --entrypoint=prospector qrapps:ci
#
# Convert everything to QR codes:
# docker run --rm -it -v .:/src -w /src qrapps:ci qrs.py --htmldirs=apps --builddir=bundles
#
# Convert single app to QR code:
# docker run --rm -it -v .:/src -w /src qrapps:ci qr.py --htmldir=apps/demo-clock --builddir=bundles
#
# Then run commands from within the build environment, for example
# docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):/usr/src -w /usr/src curl/curl autoreconf -fi
# docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):/usr/src -w /usr/src curl/curl ./configure --without-ssl --without-libpsl
# docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):/usr/src -w /usr/src curl/curl make
# docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):/usr/src -w /usr/src curl/curl ./scripts/maketgz 8.7.1

from debian:12

RUN apt-get -y update && apt-get install -y --no-install-recommends \
python3-pip=23.0.1+dfsg-1 \
python3-venv=3.11.2-1+b1 \
npm=9.2.0~ds1-1 \
&& \
rm -rf /var/lib/apt/lists/*

RUN --mount=type=bind,source=requirements.txt,target=requirements.txt \
--mount=type=bind,source=requirements-contrib.txt,target=requirements-contrib.txt \
python3 -m venv /venv && \
/venv/bin/python3 -m pip install --upgrade pip && \
/venv/bin/python3 -m pip install -r requirements.txt && \
/venv/bin/python3 -m pip install -r requirements-contrib.txt

RUN npm install -g uglify-js html-minifier inline-scripts

ENV PATH="/venv/bin:${PATH}"

ENTRYPOINT ["/venv/bin/python3"]
Loading

0 comments on commit 2625f6a

Please sign in to comment.