Skip to content

Commit

Permalink
Switch from CircleCI runners to Github actions.
Browse files Browse the repository at this point in the history
As part of this change, the dev (build) and end-user test images names
changed from `dangerzone.rocks/*` to `dangerzone/`, to allow using
another container registry. For the needs of our CI, we use ghcr.io.
  • Loading branch information
almet committed Sep 17, 2024
1 parent d7f8096 commit 1454b39
Show file tree
Hide file tree
Showing 3 changed files with 321 additions and 50 deletions.
116 changes: 116 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Build dev environments
on:
schedule:
- cron: "0 0 * * *" # Run every day at 00:00 UTC.
env:
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}

# Each day, build and publish to ghcr.io:
#
# - the dangerzone/dangerzone container image
# - the dangerzone/build/{debian,ubuntu,fedora}:version
# dev environments used to run the tests
#
# End-user environments are not published to the GHCR because
# they need .rpm or .deb files to be built, which is what we
# want to test.

jobs:
build-dev-environment:
name: "Build dev-env (${{ matrix.distro }}-${{ matrix.version }})"
runs-on: ubuntu-latest
strategy:
matrix:
include:
- distro: ubuntu
version: "20.04"
- distro: ubuntu
version: "22.04"
- distro: ubuntu
version: "23.10"
- distro: ubuntu
version: "24.04"
- distro: debian
version: bullseye
- distro: debian
version: bookworm
- distro: debian
version: trixie
- distro: fedora
version: "39"
- distro: fedora
version: "40"

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

- uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Build dev environment
run: |
./dev_scripts/env.py --distro ${{ matrix.distro }} \
--version ${{ matrix.version }} \
build-dev
- name: Login to GHCR
run: |
echo ${{ github.token }} | podman login ghcr.io -u USERNAME --password-stdin
- name: Set modified version variable
run: |
if [ "${{ matrix.version }}" = "bullseye" ]; then
echo "modified_version=${{ matrix.version }}-backports" >> $GITHUB_ENV
else
echo "modified_version=${{ matrix.version }}" >> $GITHUB_ENV
fi
- name: Push To GHCR
run: |
podman push \
dangerzone/build/${{ matrix.distro }}:${{ env.modified_version }} \
${{ env.IMAGE_REGISTRY }}/dangerzone/build/${{ matrix.distro }}:${{ env.modified_version }}
build-container-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"

- name: Restore container cache
uses: actions/cache@v4
with:
key: v2-${{ steps.date.outputs.date }}-${{ hashFiles('Dockerfile', 'dangerzone/conversion/common.py', 'dangerzone/conversion/doc_to_pixels.py', 'dangerzone/conversion/pixels_to_pdf.py') }}
path: |
share/container.tar.gz
share/image-id.txt
- name: Build Dangerzone image
run: |
if [ -f "share/container.tar.gz" ]; then
echo "Already cached, skipping"
else
sudo pip3 install poetry
python3 ./install/common/build-image.py
fi
- name: Load container image
run: |
gunzip -c share/container.tar.gz | podman load
- name: Login to GHCR
run: |
echo ${{ github.token }} | podman login ghcr.io -u USERNAME --password-stdin
- name: Push To GHCR
run: |
podman push \
dangerzone.rocks/dangerzone \
${{ env.IMAGE_REGISTRY }}/dangerzone/dangerzone
Loading

0 comments on commit 1454b39

Please sign in to comment.