dangerzone/.circleci/config.yml

459 lines
13 KiB
YAML

version: 2.1
aliases:
- &install-dependencies-deb
name: Install dependencies (deb)
command: |
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
apt-get update
apt-get install -y git ssh podman python-all dh-python python3 python3-stdeb python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtwidgets python3-appdirs python3-click python3-xdg python3-requests python3-colorama
- &install-dependencies-rpm
name: Install dependencies (rpm)
command: |
dnf install -y podman git openssh make automake gcc gcc-c++ rpm-build python3-setuptools python3-pyside2 python3-appdirs python3-click python3-pyxdg python3-requests python3-colorama
- &build-deb
name: Build the .deb package
command: |
./install/linux/build-deb.py
dpkg -i deb_dist/dangerzone_*-1_all.deb
ls -lh deb_dist/dangerzone_*-1_all.deb
- &build-rpm
name: Build the .rpm package
command: |
./install/linux/build-rpm.py
dnf install -y dist/dangerzone-*-1.noarch.rpm
ls -lh dist/dangerzone-*-1.noarch.rpm
- &restore-cache
key: v1-{{ checksum "container/Dockerfile" }}-{{ checksum "container/dangerzone.py" }}
paths:
- /caches/container.tar.gz
- /caches/image-id.txt
- &copy-image
name: Copy container image into package
command: |
cp /caches/container.tar.gz share/
cp /caches/image-id.txt share/
- &deploy-packagecloud
name: Deploy to packagecloud.io
command: |
VERSION=$(cat share/version.txt)
if [[ "${PACKAGE_TYPE}" == "deb" ]]; then
# install packagecloud.io
apt-get install -y ruby-dev rubygems
gem install -N rake
gem install -N package_cloud
# deploy the package
package_cloud push firstlookmedia/code/${PACKAGECLOUD_DISTO} deb_dist/dangerzone_${VERSION}-1_all.deb
package_cloud push firstlookmedia/code/${PACKAGECLOUD_DISTO} deb_dist/dangerzone_${VERSION}-1.dsc
elif [[ "${PACKAGE_TYPE}" == "rpm" ]]; then
# install packagecloud.
dnf install -y ruby-devel
gem install package_cloud
# deploy the package
package_cloud push firstlookmedia/code/${PACKAGECLOUD_DISTO} dist/dangerzone-${VERSION}-1.noarch.rpm
package_cloud push firstlookmedia/code/${PACKAGECLOUD_DISTO} dist/dangerzone-${VERSION}-1.src.rpm
fi
jobs:
build-container-image:
working_directory: /app
docker:
- image: docker:dind
steps:
- checkout
- restore_cache:
keys:
- v1-{{ checksum "container/Dockerfile" }}-{{ checksum "container/dangerzone.py" }}
- setup_remote_docker
- run:
name: Build Dangerzone image
command: |
if [ -f "/caches/container.tar.gz" ]; then
echo "Already cached, skipping"
else
docker build --cache-from=dangerzone.rocks/dangerzone --tag dangerzone.rocks/dangerzone container
fi
- run:
name: Save Dangerzone image and image-id.txt to cache
command: |
if [ -f "/caches/container.tar.gz" ]; then
echo "Already cached, skipping"
else
mkdir -p /caches
docker save -o /caches/container.tar dangerzone.rocks/dangerzone
gzip -f /caches/container.tar
docker image ls dangerzone.rocks/dangerzone | grep "dangerzone.rocks/dangerzone" | tr -s ' ' | cut -d' ' -f3 > /caches/image-id.txt
fi
- save_cache:
key: v1-{{ checksum "container/Dockerfile" }}-{{ checksum "container/dangerzone.py" }}
paths:
- /caches/container.tar.gz
- /caches/image-id.txt
convert-test-docs:
machine:
image: ubuntu-2004:202111-01
steps:
# https://www.atlantic.net/dedicated-server-hosting/how-to-install-and-use-podman-on-ubuntu-20-04/
- run:
name: Install podman on Ubuntu 20.04
command: |
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
source /etc/os-release
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_${VERSION_ID}/Release.key -O- | sudo apt-key add -
sudo apt-get update -qq -y
sudo apt-get -qq --yes install podman
podman --version
- checkout
- run:
name: Install poetry dependencies
command: |
sudo pip3 install poetry
poetry install
- run:
name: Prepare cache directory
command: |
sudo mkdir -p /caches
sudo chown -R $USER:$USER /caches
- restore_cache: *restore-cache
- run: *copy-image
- run:
name: Convert each test document
command: |
for FILE in $(ls test_docs); do
echo Converting $FILE
poetry run ./dev_scripts/dangerzone-cli test_docs/$FILE
echo
done
build-ubuntu-impish:
docker:
- image: ubuntu:21.10
resource_class: medium+
steps:
- run: *install-dependencies-deb
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-deb
deploy-ubuntu-impish:
docker:
- image: ubuntu:21.10
resource_class: medium+
steps:
- run: *install-dependencies-deb
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-deb
- run:
environment:
PACKAGE_TYPE: "deb"
PACKAGECLOUD_DISTRO: "ubuntu/impish"
<<: *deploy-packagecloud
build-ubuntu-hirsute:
docker:
- image: ubuntu:21.04
resource_class: medium+
steps:
- run: *install-dependencies-deb
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-deb
deploy-ubuntu-hirsute:
docker:
- image: ubuntu:21.04
resource_class: medium+
steps:
- run: *install-dependencies-deb
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-deb
- run:
environment:
PACKAGE_TYPE: "deb"
PACKAGECLOUD_DISTRO: "ubuntu/hirsute"
<<: *deploy-packagecloud
build-ubuntu-groovy:
docker:
- image: ubuntu:20.10
resource_class: medium+
steps:
- run: *install-dependencies-deb
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-deb
deploy-ubuntu-groovy:
docker:
- image: ubuntu:20.10
resource_class: medium+
steps:
- run: *install-dependencies-deb
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-deb
- run:
environment:
PACKAGE_TYPE: "deb"
PACKAGECLOUD_DISTRO: "ubuntu/groovy"
<<: *deploy-packagecloud
build-debian-bookworm:
docker:
- image: debian:bookworm
resource_class: medium+
steps:
- run: *install-dependencies-deb
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-deb
deploy-debian-bookworm:
docker:
- image: debian:bookworm
resource_class: medium+
steps:
- run: *install-dependencies-deb
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-deb
- run:
environment:
PACKAGE_TYPE: "deb"
PACKAGECLOUD_DISTRO: "debian/bookworm"
<<: *deploy-packagecloud
build-debian-bullseye:
docker:
- image: debian:bullseye
resource_class: medium+
steps:
- run: *install-dependencies-deb
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-deb
deploy-debian-bullseye:
docker:
- image: debian:bullseye
resource_class: medium+
steps:
- run: *install-dependencies-deb
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-deb
- run:
environment:
PACKAGE_TYPE: "deb"
PACKAGECLOUD_DISTRO: "debian/bullseye"
<<: *deploy-packagecloud
build-fedora-35:
docker:
- image: fedora:35
resource_class: medium+
steps:
- run: *install-dependencies-rpm
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-rpm
deploy-fedora-35:
docker:
- image: fedora:35
resource_class: medium+
steps:
- run: *install-dependencies-rpm
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-rpm
- run:
environment:
PACKAGE_TYPE: "rpm"
PACKAGECLOUD_DISTRO: "fedora/35"
<<: *deploy-packagecloud
build-fedora-34:
docker:
- image: fedora:34
resource_class: medium+
steps:
- run: *install-dependencies-rpm
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-rpm
deploy-fedora-34:
docker:
- image: fedora:34
resource_class: medium+
steps:
- run: *install-dependencies-rpm
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-rpm
- run:
environment:
PACKAGE_TYPE: "rpm"
PACKAGECLOUD_DISTRO: "fedora/34"
<<: *deploy-packagecloud
build-fedora-33:
docker:
- image: fedora:33
resource_class: medium+
steps:
- run: *install-dependencies-rpm
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-rpm
deploy-fedora-33:
docker:
- image: fedora:33
resource_class: medium+
steps:
- run: *install-dependencies-rpm
- checkout
- restore_cache: *restore-cache
- run: *copy-image
- run: *build-rpm
- run:
environment:
PACKAGE_TYPE: "rpm"
PACKAGECLOUD_DISTRO: "fedora/33"
<<: *deploy-packagecloud
workflows:
version: 2
build:
jobs:
- build-container-image
- convert-test-docs:
requires:
- build-container-image
- build-ubuntu-impish:
requires:
- build-container-image
- build-ubuntu-hirsute:
requires:
- build-container-image
- build-ubuntu-groovy:
requires:
- build-container-image
- build-debian-bullseye:
requires:
- build-container-image
- build-debian-bookworm:
requires:
- build-container-image
- build-fedora-35:
requires:
- build-container-image
- build-fedora-34:
requires:
- build-container-image
- build-fedora-33:
requires:
- build-container-image
build-and-deploy:
jobs:
- build-container-image:
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- deploy-ubuntu-impish:
requires:
- build-container-image
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- deploy-ubuntu-hirsute:
requires:
- build-container-image
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- deploy-ubuntu-groovy:
requires:
- build-container-image
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- deploy-debian-bookworm:
requires:
- build-container-image
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- deploy-debian-bullseye:
requires:
- build-container-image
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- deploy-fedora-35:
requires:
- build-container-image
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- deploy-fedora-34:
requires:
- build-container-image
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- deploy-fedora-33:
requires:
- build-container-image
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/