Skip to content

Commit

Permalink
Add action to build FMS packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
neprune committed Feb 25, 2025
1 parent 1f76cf5 commit 3724b5c
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 18 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/fms-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: build-fms-base

on:
push:

jobs:
build:
strategy:
max-parallel: 1
matrix:
debian_release: ['bullseye', 'bookworm']
arch: ['amd64', 'arm64']

runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.9.1'

# See: https://docs.docker.com/build/ci/github-actions/multi-platform/#build-and-load-multi-platform-images
- name: Set up Docker
uses: docker/setup-docker-action@v4
with:
daemon-config: |
{
"features": {
"containerd-snapshotter": true,
"debug": true
}
}
- name: Repo setup
run: ./script/update

- name: Build base
run: |
cd images/base
make ${{ matrix.debian_release }}-${{ matrix.arch }}
- name: Build package
run: |
cd packages/fms-base
sudo chmod -R 777 ./deb
make ${{ matrix.debian_release }}-${{ matrix.arch }}
- name: Archive packages
uses: actions/upload-artifact@v4
with:
name: packages
path: packages/fms-base/deb/${{ matrix.debian_release }}/*.deb
2 changes: 1 addition & 1 deletion images/base/conf/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN apt-get update -qq \
lsb-release \
ruby-dev \
wget \
--no-install-recommends > /dev/null \
--no-install-recommends \
&& apt-get install -qq {% if codename == "bionic" %} -t {{ codename }}-backports {% endif %} debhelper \
&& rm -r /var/lib/apt/lists/*

Expand Down
8 changes: 5 additions & 3 deletions packages/fms-base/conf/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ USER builder

ARG TAG={{ version }}
RUN git clone --recursive https://github.com/mysociety/fixmystreet.git
RUN git checkout v{{ version }}

WORKDIR /home/builder/fixmystreet
RUN git checkout v{{ version }}

USER root
RUN cp conf/packages.docker /opt/
RUN xargs -a "/opt/packages.docker" apt-get -qq -y install >/dev/null

USER builder
RUN ./script/bootstrap
#RUN ./script/bootstrap
run mkdir local
RUN fpm -s dir -t deb \
--vendor "mySociety" \
--maintainer "mySociety <sysadmin@mysociety.org>" \
Expand All @@ -33,4 +34,5 @@ RUN fpm -s dir -t deb \
-n "fms-base" \
./local/=/data/fms_deps/perl_modules

CMD ["sh", "-c", "/bin/mv *.deb ../deb/{{ codename }}"]
#CMD ["/bin/mv *.deb ../deb/{{ codename }}"]
CMD ls -la . && ls -la ../deb && mv *.deb ../deb
28 changes: 14 additions & 14 deletions script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ set -e

cd "$(dirname "$0")/.."

WANTED_PYTHON=$(cat .python-version)
#WANTED_PYTHON=$(cat .python-version)

if command -v pyenv >/dev/null ; then
echo "==> Found pyenv..."
if [ -z "$(pyenv version-name 2>/dev/null)" ] ; then
echo "==> Installing Python ${WANTED_PYTHON} via pyenv..."
pyenv install --skip-existing
fi
else
echo "==> Not found pyenv, checking available python version..."
if [ "$(python3 --version | awk '{ $NF }')" != "$WANTED_PYTHON" ] ; then
echo "==> We require ${WANTED_PYTHON}. Fix that, and run me again."
exit 1
fi
fi
#if command -v pyenv >/dev/null ; then
#echo "==> Found pyenv..."
#if [ -z "$(pyenv version-name 2>/dev/null)" ] ; then
#echo "==> Installing Python ${WANTED_PYTHON} via pyenv..."
#pyenv install --skip-existing
#fi
#else
#echo "==> Not found pyenv, checking available python version..."
#if [ "$(python3 --version | awk '{ $NF }')" != "$WANTED_PYTHON" ] ; then
#echo "==> We require ${WANTED_PYTHON}. Fix that, and run me again."
#exit 1
#fi
#fi

VIRTUALENV=".venv/packaging"
if [ ! -f "${VIRTUALENV}/bin/activate" ] ; then
Expand Down
1 change: 1 addition & 0 deletions template/bin/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -xo

DIST=${1:-all}
ARCH=${2:-none}
Expand Down

0 comments on commit 3724b5c

Please sign in to comment.