mirror of
https://github.com/outbackdingo/Mailu.git
synced 2026-01-27 10:19:35 +00:00
Switch from docker build to buildx for CI/CD.
- The main workflow file has been optimised and simplified. - Images are built in parallel when building locally resulting in faster build times. - The github action workflow is about 50% faster. - Arm images are built as well. These images are not tested due to restrictions of github actions (no arm runners). The tags of the images have -arm appended to it. - Arm images can also be built locally. - Reusable workflow is introduced for building, testing and deploying the images. This allows the workflow to be reused for other purposes in the future. - Workflow can be manually triggered. This allows forked Mailu projects to also use the workflow for building images.
This commit is contained in:
678
.github/workflows/CI.yml
vendored
678
.github/workflows/CI.yml
vendored
@@ -1,678 +0,0 @@
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- staging
|
||||
- testing
|
||||
- '1.8'
|
||||
- '1.9'
|
||||
- master
|
||||
# test branches, e.g. test-debian
|
||||
- test-*
|
||||
|
||||
concurrency: ci-${{ github.ref }}
|
||||
|
||||
###############################################
|
||||
# REQUIRED secrets
|
||||
# DOCKER_UN: ${{ secrets.Docker_Login }}
|
||||
# Username of docker login for pushing the images to repo $DOCKER_ORG and $DOCKER_ORG_TESTS
|
||||
# DOCKER_PW: ${{ secrets.Docker_Password }}
|
||||
# Password of docker login for pushing the images to repo $DOCKER_ORG and $DOCKER_ORG_TESTS
|
||||
# DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
|
||||
# The docker repository where the images are pushed to.
|
||||
# DOCKER_ORG_TESTS: ${{ secrets.DOCKER_ORG_TESTS }}
|
||||
# The docker repository for test images. Only used for the branch TESTING (BORS try).
|
||||
# Add the above secrets to your github repo to determine where the images will be pushed.
|
||||
################################################
|
||||
# Code block that is used as one liner.
|
||||
##!/bin/bash
|
||||
#version=$( git tag --sort=version:refname --list "{{ env.MAILU_VERSION }}.*" | tail -1 )
|
||||
#root_version=${version%.*}
|
||||
#patch_version=${version##*.}
|
||||
#if [ "$patch_version" == "" ]
|
||||
#then
|
||||
# pinned_version={{ env.MAILU_VERSION }}.0
|
||||
#else
|
||||
# pinned_version=$root_version.$(expr $patch_version + 1)
|
||||
#fi
|
||||
#echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build images
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# fetch-depth 0 is required to also retrieve all tags.
|
||||
fetch-depth: 0
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||
#For branch TESTING, we set the image tag to PR-xxxx
|
||||
- name: Derive MAILU_VERSION and PINNED_MAILU_VERSION for branch testing
|
||||
if: ${{ env.BRANCH == 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||
DOCKER_ORG_TESTS: ${{ secrets.DOCKER_ORG_TESTS }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "PINNED_MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG_TESTS" >> $GITHUB_ENV
|
||||
- name: Derive MAILU_VERSION for other branches than testing
|
||||
if: ${{ env.BRANCH != 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=${{ env.BRANCH }}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for normal release x.y
|
||||
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master' }}
|
||||
shell: bash
|
||||
run: |
|
||||
version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for staging
|
||||
if: ${{ env.BRANCH == 'staging' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=staging" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for master
|
||||
if: ${{ env.BRANCH == 'master' }}
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_SHA: ${{ env.GITHUB_SHA }}
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=$GITHUB_SHA" >> $GITHUB_ENV
|
||||
- name: Create folder for storing images
|
||||
run: |
|
||||
sudo mkdir -p /images
|
||||
sudo chmod 777 /images
|
||||
- name: Configure images folder for caching
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /images
|
||||
key: ${{ env.BRANCH }}-${{ github.run_id }}-${{ github.run_number }}
|
||||
- name: Check docker-compose version
|
||||
run: docker-compose -v
|
||||
- name: Login docker
|
||||
env:
|
||||
DOCKER_UN: ${{ secrets.Docker_Login }}
|
||||
DOCKER_PW: ${{ secrets.Docker_Password }}
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG }}
|
||||
run: echo "$DOCKER_PW" | docker login --username $DOCKER_UN --password-stdin
|
||||
- name: Build all docker images
|
||||
env:
|
||||
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
||||
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG }}
|
||||
run: docker-compose -f tests/build.yml build
|
||||
- name: Save all docker images
|
||||
run: docker save ${{ env.DOCKER_ORG }}/admin ${{ env.DOCKER_ORG }}/clamav ${{ env.DOCKER_ORG }}/docs ${{ env.DOCKER_ORG }}/dovecot ${{ env.DOCKER_ORG }}/fetchmail ${{ env.DOCKER_ORG }}/nginx ${{ env.DOCKER_ORG }}/none ${{ env.DOCKER_ORG }}/postfix ${{ env.DOCKER_ORG }}/radicale ${{ env.DOCKER_ORG }}/rainloop ${{ env.DOCKER_ORG }}/roundcube ${{ env.DOCKER_ORG }}/rspamd ${{ env.DOCKER_ORG }}/setup ${{ env.DOCKER_ORG }}/traefik-certdumper ${{ env.DOCKER_ORG }}/unbound -o /images/images.tar.gz
|
||||
|
||||
test-core:
|
||||
name: Perform core tests
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# fetch-depth 0 is required to also retrieve all tags.
|
||||
fetch-depth: 0
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||
#For branch TESTING, we set the image tag to PR-xxxx
|
||||
- name: Derive MAILU_VERSION and PINNED_MAILU_VERSION for branch testing
|
||||
if: ${{ env.BRANCH == 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||
DOCKER_ORG_TESTS: ${{ secrets.DOCKER_ORG_TESTS }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "PINNED_MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG_TESTS" >> $GITHUB_ENV
|
||||
- name: Derive MAILU_VERSION for other branches than testing
|
||||
if: ${{ env.BRANCH != 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=${{ env.BRANCH }}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for normal release x.y
|
||||
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
|
||||
shell: bash
|
||||
run: |
|
||||
version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for staging
|
||||
if: ${{ env.BRANCH == 'staging' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=staging" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for master
|
||||
if: ${{ env.BRANCH == 'master' }}
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_SHA: ${{ env.GITHUB_SHA }}
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=$GITHUB_SHA" >> $GITHUB_ENV
|
||||
- name: Create folder for storing images
|
||||
run: |
|
||||
sudo mkdir -p /images
|
||||
sudo chmod 777 /images
|
||||
- name: Configure images folder for caching
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /images
|
||||
key: ${{ env.BRANCH }}-${{ github.run_id }}-${{ github.run_number }}
|
||||
- name: Load docker images
|
||||
run: docker load -i /images/images.tar.gz
|
||||
- name: Install python packages
|
||||
run: python3 -m pip install -r tests/requirements.txt
|
||||
- name: Copy all certs
|
||||
run: sudo -- sh -c 'mkdir -p /mailu && cp -r tests/certs /mailu && chmod 600 /mailu/certs/*'
|
||||
- name: Test core suite
|
||||
run: python tests/compose/test.py core 2
|
||||
env:
|
||||
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
||||
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG }}
|
||||
|
||||
test-fetchmail:
|
||||
name: Perform fetchmail tests
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# fetch-depth 0 is required to also retrieve all tags.
|
||||
fetch-depth: 0
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||
#For branch TESTING, we set the image tag to PR-xxxx
|
||||
- name: Derive MAILU_VERSION and PINNED_MAILU_VERSION for branch testing
|
||||
if: ${{ env.BRANCH == 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||
DOCKER_ORG_TESTS: ${{ secrets.DOCKER_ORG_TESTS }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "PINNED_MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG_TESTS" >> $GITHUB_ENV
|
||||
- name: Derive MAILU_VERSION for other branches than testing
|
||||
if: ${{ env.BRANCH != 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=${{ env.BRANCH }}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for normal release x.y
|
||||
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
|
||||
shell: bash
|
||||
run: |
|
||||
version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for staging
|
||||
if: ${{ env.BRANCH == 'staging' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=staging" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for master
|
||||
if: ${{ env.BRANCH == 'master' }}
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_SHA: ${{ env.GITHUB_SHA }}
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=$GITHUB_SHA" >> $GITHUB_ENV
|
||||
- name: Create folder for storing images
|
||||
run: |
|
||||
sudo mkdir -p /images
|
||||
sudo chmod 777 /images
|
||||
- name: Configure images folder for caching
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /images
|
||||
key: ${{ env.BRANCH }}-${{ github.run_id }}-${{ github.run_number }}
|
||||
- name: Load docker images
|
||||
run: docker load -i /images/images.tar.gz
|
||||
- name: Install python packages
|
||||
run: python3 -m pip install -r tests/requirements.txt
|
||||
- name: Copy all certs
|
||||
run: sudo -- sh -c 'mkdir -p /mailu && cp -r tests/certs /mailu && chmod 600 /mailu/certs/*'
|
||||
- name: Test fetch
|
||||
run: python tests/compose/test.py fetchmail 2
|
||||
env:
|
||||
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
||||
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG }}
|
||||
|
||||
test-filters:
|
||||
name: Perform filter tests
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# fetch-depth 0 is required to also retrieve all tags.
|
||||
fetch-depth: 0
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||
#For branch TESTING, we set the image tag to PR-xxxx
|
||||
- name: Derive MAILU_VERSION and PINNED_MAILU_VERSION for branch testing
|
||||
if: ${{ env.BRANCH == 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||
DOCKER_ORG_TESTS: ${{ secrets.DOCKER_ORG_TESTS }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "PINNED_MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG_TESTS" >> $GITHUB_ENV
|
||||
- name: Derive MAILU_VERSION for other branches than testing
|
||||
if: ${{ env.BRANCH != 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=${{ env.BRANCH }}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for normal release x.y
|
||||
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
|
||||
shell: bash
|
||||
run: |
|
||||
version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for staging
|
||||
if: ${{ env.BRANCH == 'staging' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=staging" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for master
|
||||
if: ${{ env.BRANCH == 'master' }}
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_SHA: ${{ env.GITHUB_SHA }}
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=$GITHUB_SHA" >> $GITHUB_ENV
|
||||
- name: Create folder for storing images
|
||||
run: |
|
||||
sudo mkdir -p /images
|
||||
sudo chmod 777 /images
|
||||
- name: Configure images folder for caching
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /images
|
||||
key: ${{ env.BRANCH }}-${{ github.run_id }}-${{ github.run_number }}
|
||||
- name: Load docker images
|
||||
run: docker load -i /images/images.tar.gz
|
||||
- name: Install python packages
|
||||
run: python3 -m pip install -r tests/requirements.txt
|
||||
- name: Copy all certs
|
||||
run: sudo -- sh -c 'mkdir -p /mailu && cp -r tests/certs /mailu && chmod 600 /mailu/certs/*'
|
||||
- name: Test clamvav
|
||||
run: python tests/compose/test.py filters 3
|
||||
env:
|
||||
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
||||
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG }}
|
||||
|
||||
test-rainloop:
|
||||
name: Perform rainloop tests
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# fetch-depth 0 is required to also retrieve all tags.
|
||||
fetch-depth: 0
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||
#For branch TESTING, we set the image tag to PR-xxxx
|
||||
- name: Derive MAILU_VERSION and PINNED_MAILU_VERSION for branch testing
|
||||
if: ${{ env.BRANCH == 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||
DOCKER_ORG_TESTS: ${{ secrets.DOCKER_ORG_TESTS }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "PINNED_MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG_TESTS" >> $GITHUB_ENV
|
||||
- name: Derive MAILU_VERSION for other branches than testing
|
||||
if: ${{ env.BRANCH != 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=${{ env.BRANCH }}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for normal release x.y
|
||||
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
|
||||
shell: bash
|
||||
run: |
|
||||
version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for staging
|
||||
if: ${{ env.BRANCH == 'staging' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=staging" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for master
|
||||
if: ${{ env.BRANCH == 'master' }}
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_SHA: ${{ env.GITHUB_SHA }}
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=$GITHUB_SHA" >> $GITHUB_ENV
|
||||
- name: Create folder for storing images
|
||||
run: |
|
||||
sudo mkdir -p /images
|
||||
sudo chmod 777 /images
|
||||
- name: Configure images folder for caching
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /images
|
||||
key: ${{ env.BRANCH }}-${{ github.run_id }}-${{ github.run_number }}
|
||||
- name: Load docker images
|
||||
run: docker load -i /images/images.tar.gz
|
||||
- name: Install python packages
|
||||
run: python3 -m pip install -r tests/requirements.txt
|
||||
- name: Copy all certs
|
||||
run: sudo -- sh -c 'mkdir -p /mailu && cp -r tests/certs /mailu && chmod 600 /mailu/certs/*'
|
||||
- name: Test rainloop
|
||||
run: python tests/compose/test.py rainloop 2
|
||||
env:
|
||||
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
||||
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG }}
|
||||
|
||||
test-roundcube:
|
||||
name: Perform roundcube tests
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# fetch-depth 0 is required to also retrieve all tags.
|
||||
fetch-depth: 0
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||
#For branch TESTING, we set the image tag to PR-xxxx
|
||||
- name: Derive MAILU_VERSION and PINNED_MAILU_VERSION for branch testing
|
||||
if: ${{ env.BRANCH == 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||
DOCKER_ORG_TESTS: ${{ secrets.DOCKER_ORG_TESTS }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "PINNED_MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG_TESTS" >> $GITHUB_ENV
|
||||
- name: Derive MAILU_VERSION for other branches than testing
|
||||
if: ${{ env.BRANCH != 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=${{ env.BRANCH }}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for normal release x.y
|
||||
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
|
||||
shell: bash
|
||||
run: |
|
||||
version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for staging
|
||||
if: ${{ env.BRANCH == 'staging' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=staging" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for master
|
||||
if: ${{ env.BRANCH == 'master' }}
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_SHA: ${{ env.GITHUB_SHA }}
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=$GITHUB_SHA" >> $GITHUB_ENV
|
||||
- name: Create folder for storing images
|
||||
run: |
|
||||
sudo mkdir -p /images
|
||||
sudo chmod 777 /images
|
||||
- name: Configure images folder for caching
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /images
|
||||
key: ${{ env.BRANCH }}-${{ github.run_id }}-${{ github.run_number }}
|
||||
- name: Load docker images
|
||||
run: docker load -i /images/images.tar.gz
|
||||
- name: Install python packages
|
||||
run: python3 -m pip install -r tests/requirements.txt
|
||||
- name: Copy all certs
|
||||
run: sudo -- sh -c 'mkdir -p /mailu && cp -r tests/certs /mailu && chmod 600 /mailu/certs/*'
|
||||
- name: Test roundcube
|
||||
run: python tests/compose/test.py roundcube 2
|
||||
env:
|
||||
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
||||
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG }}
|
||||
|
||||
test-webdav:
|
||||
name: Perform webdav tests
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# fetch-depth 0 is required to also retrieve all tags.
|
||||
fetch-depth: 0
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||
#For branch TESTING, we set the image tag to PR-xxxx
|
||||
- name: Derive MAILU_VERSION and PINNED_MAILU_VERSION for branch testing
|
||||
if: ${{ env.BRANCH == 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||
DOCKER_ORG_TESTS: ${{ secrets.DOCKER_ORG_TESTS }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "PINNED_MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG_TESTS" >> $GITHUB_ENV
|
||||
- name: Derive MAILU_VERSION for other branches than testing
|
||||
if: ${{ env.BRANCH != 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=${{ env.BRANCH }}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for normal release x.y
|
||||
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
|
||||
shell: bash
|
||||
run: |
|
||||
version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for staging
|
||||
if: ${{ env.BRANCH == 'staging' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=staging" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for master
|
||||
if: ${{ env.BRANCH == 'master' }}
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_SHA: ${{ env.GITHUB_SHA }}
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=$GITHUB_SHA" >> $GITHUB_ENV
|
||||
- name: Create folder for storing images
|
||||
run: |
|
||||
sudo mkdir -p /images
|
||||
sudo chmod 777 /images
|
||||
- name: Configure images folder for caching
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /images
|
||||
key: ${{ env.BRANCH }}-${{ github.run_id }}-${{ github.run_number }}
|
||||
- name: Load docker images
|
||||
run: docker load -i /images/images.tar.gz
|
||||
- name: Install python packages
|
||||
run: python3 -m pip install -r tests/requirements.txt
|
||||
- name: Copy all certs
|
||||
run: sudo -- sh -c 'mkdir -p /mailu && cp -r tests/certs /mailu && chmod 600 /mailu/certs/*'
|
||||
- name: Test webdav
|
||||
run: python tests/compose/test.py webdav 2
|
||||
env:
|
||||
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
||||
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG }}
|
||||
|
||||
deploy:
|
||||
name: Deploy images
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
- test-core
|
||||
- test-fetchmail
|
||||
- test-filters
|
||||
- test-rainloop
|
||||
- test-roundcube
|
||||
- test-webdav
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# fetch-depth 0 is required to also retrieve all tags.
|
||||
fetch-depth: 0
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||
#For branch TESTING, we set the image tag to PR-xxxx
|
||||
- name: Derive MAILU_VERSION and PINNED_MAILU_VERSION for branch testing
|
||||
if: ${{ env.BRANCH == 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||
DOCKER_ORG_TESTS: ${{ secrets.DOCKER_ORG_TESTS }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "PINNED_MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG_TESTS" >> $GITHUB_ENV
|
||||
- name: Derive MAILU_VERSION for other branches than testing
|
||||
if: ${{ env.BRANCH != 'testing' }}
|
||||
shell: bash
|
||||
env:
|
||||
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=${{ env.BRANCH }}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for normal release x.y
|
||||
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
|
||||
shell: bash
|
||||
run: |
|
||||
version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for staging
|
||||
if: ${{ env.BRANCH == 'staging' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=staging" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for master
|
||||
if: ${{ env.BRANCH == 'master' }}
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_SHA: ${{ env.GITHUB_SHA }}
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=$GITHUB_SHA" >> $GITHUB_ENV
|
||||
- name: Create folder for storing images
|
||||
run: |
|
||||
sudo mkdir -p /images
|
||||
sudo chmod 777 /images
|
||||
- name: Configure images folder for caching
|
||||
# For staging we do not deploy images. So we do not have to load them from cache.
|
||||
if: ${{ env.BRANCH != 'staging' }}
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /images
|
||||
key: ${{ env.BRANCH }}-${{ github.run_id }}-${{ github.run_number }}
|
||||
- name: Load docker images
|
||||
if: ${{ env.BRANCH != 'staging' }}
|
||||
run: docker load -i /images/images.tar.gz
|
||||
- name: Deploy built docker images
|
||||
env:
|
||||
DOCKER_UN: ${{ secrets.Docker_Login }}
|
||||
DOCKER_PW: ${{ secrets.Docker_Password }}
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG }}
|
||||
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
||||
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
||||
BRANCH: ${{ env.BRANCH }}
|
||||
run: bash tests/deploy.sh
|
||||
|
||||
tag-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- deploy
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# fetch-depth 0 is required to also retrieve all tags.
|
||||
fetch-depth: 0
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||
- name: Derive MAILU_VERSION amd DOCKER_ORG
|
||||
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master' }}
|
||||
shell: bash
|
||||
env:
|
||||
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=${{ env.BRANCH }}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=$DOCKER_ORG" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for normal release x.y
|
||||
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master' }}
|
||||
shell: bash
|
||||
run: |
|
||||
version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
|
||||
- name: Create tag for branch x.y.
|
||||
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master' && env.PINNED_MAILU_VERSION != '' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo git tag ${{ env.PINNED_MAILU_VERSION }} $(/usr/bin/git rev-parse HEAD)
|
||||
git tag ${{ env.PINNED_MAILU_VERSION }} $(/usr/bin/git rev-parse HEAD)
|
||||
git push origin ${{ env.PINNED_MAILU_VERSION }}
|
||||
- name: Create release for tag x.y.z.
|
||||
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master' && env.PINNED_MAILU_VERSION != '' }}
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
bodyFile: "RELEASE_TEMPLATE.md"
|
||||
tag: ${{ env.PINNED_MAILU_VERSION }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# This job is watched by bors. It only complets if building,testing and deploy worked.
|
||||
ci-success:
|
||||
name: CI-Done
|
||||
#Returns true when none of the **previous** steps have failed or have been canceled.
|
||||
if: ${{ success() }}
|
||||
needs:
|
||||
- deploy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: CI/CD succeeded.
|
||||
run: exit 0
|
||||
101
.github/workflows/arm.yml
vendored
Normal file
101
.github/workflows/arm.yml
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
name: start-linux-arm
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '1.9'
|
||||
- master
|
||||
|
||||
concurrency: ci-arm-${{ github.ref }}
|
||||
|
||||
###############################################
|
||||
# REQUIRED secrets
|
||||
# ${{ secrets.Docker_Login }}
|
||||
# Username of docker login for pushing the images to repo env.DOCKER_ORG and env.DOCKER_ORG_TESTS
|
||||
# ${{ secrets.Docker_Password }}
|
||||
# Password of docker login for pushing the images to repo env.DOCKER_ORG and env.DOCKER_ORG_TESTS
|
||||
# Add the above secrets to your github repo to determine where the images will be pushed.
|
||||
################################################
|
||||
# REQUIRED global variables
|
||||
# DOCKER_ORG, docker org used for pushing release images (branch x.y and master)
|
||||
# DOCKER_ORG_TEST, docker org used for pushing images for testing (branch testing).
|
||||
env:
|
||||
DOCKER_ORG: mailu
|
||||
DOCKER_ORG_TEST: mailuci
|
||||
|
||||
jobs:
|
||||
# This job calculates all global job variables that are required by all the subsequent jobs.
|
||||
# All subsequent jobs will retrieve and use these variables. This way the variables only have to be derived once.
|
||||
derive-variables:
|
||||
name: derive variables
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
||||
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG_DERIVED }}
|
||||
BRANCH: ${{ env.BRANCH }}
|
||||
DEPLOY: ${{ env.DEPLOY }}
|
||||
RELEASE: ${{ env.RELEASE }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
# fetch-depth 0 is required to also retrieve all tags.
|
||||
fetch-depth: 0
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||
#For branch TESTING, we set the image tag to pr-xxxx
|
||||
- name: Derive MAILU_VERSION and DEPLOY/RELEASE for other branches than testing
|
||||
if: env.BRANCH != 'testing'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "MAILU_VERSION=${{ env.BRANCH }}-arm" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG_DERIVED=${{ env.DOCKER_ORG }}" >> $GITHUB_ENV
|
||||
echo "DEPLOY=true" >> $GITHUB_ENV
|
||||
echo "RELEASE=false" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION and DEPLOY/RELEASE for normal release x.y
|
||||
if: env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master'
|
||||
shell: bash
|
||||
run: |
|
||||
version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version-arm" >> $GITHUB_ENV
|
||||
echo "RELEASE=true" >> $GITHUB_ENV
|
||||
echo "DEPLOY=true" >> $GITHUB_ENV
|
||||
echo "RELEASE=true" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for staging for master
|
||||
if: env.BRANCH == 'master'
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_SHA: ${{ env.GITHUB_SHA }}
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=$GITHUB_SHA-arm" >> $GITHUB_ENV
|
||||
echo "DEPLOY=true" >> $GITHUB_ENV
|
||||
echo "RELEASE=false" >> $GITHUB_ENV
|
||||
|
||||
build-test-deploy:
|
||||
needs:
|
||||
- derive-variables
|
||||
uses: ./.github/workflows/build_test_deploy.yml
|
||||
with:
|
||||
architecture: 'linux/arm64,linux/arm/v7'
|
||||
mailu_version: ${{needs.derive-variables.outputs.MAILU_VERSION}}
|
||||
pinned_mailu_version: ${{needs.derive-variables.outputs.PINNED_MAILU_VERSION}}
|
||||
docker_org: ${{needs.derive-variables.outputs.DOCKER_ORG}}
|
||||
branch: ${{needs.derive-variables.outputs.BRANCH}}
|
||||
deploy: ${{needs.derive-variables.outputs.DEPLOY}}
|
||||
release: ${{needs.derive-variables.outputs.RELEASE}}
|
||||
secrets: inherit
|
||||
|
||||
################################################
|
||||
# Code block that is used as one liner for the step:
|
||||
# Derive PINNED_MAILU_VERSION and DEPLOY/RELEASE for normal release x.y
|
||||
##!/bin/bash
|
||||
#version=$( git tag --sort=version:refname --list "{{ env.MAILU_VERSION }}.*" | tail -1 )
|
||||
#root_version=${version%.*}
|
||||
#patch_version=${version##*.}
|
||||
#if [ "$patch_version" == "" ]
|
||||
#then
|
||||
# pinned_version={{ env.MAILU_VERSION }}.0
|
||||
#else
|
||||
# pinned_version=$root_version.$(expr $patch_version + 1)
|
||||
#fi
|
||||
#echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
|
||||
355
.github/workflows/build_test_deploy.yml
vendored
Normal file
355
.github/workflows/build_test_deploy.yml
vendored
Normal file
@@ -0,0 +1,355 @@
|
||||
name: build-test-deploy
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
architecture:
|
||||
description: 'The architecture of the images that will be build.'
|
||||
required: false
|
||||
default: 'linux/amd64'
|
||||
type: string
|
||||
mailu_version:
|
||||
description: 'The main version that is build. E.g. master or x.y.'
|
||||
required: true
|
||||
type: string
|
||||
pinned_mailu_version:
|
||||
description: 'The specific version that is build. E.g. commit hash or x.y.z.'
|
||||
required: true
|
||||
type: string
|
||||
docker_org:
|
||||
description: 'The docker organisation where the images are pushed to.'
|
||||
required: true
|
||||
type: string
|
||||
branch:
|
||||
description: 'The branch that triggered this workflow.'
|
||||
required: true
|
||||
type: string
|
||||
deploy:
|
||||
description: Deploy to docker hub. Happens for all branches but staging. Use string true or false.
|
||||
default: true
|
||||
required: false
|
||||
type: string
|
||||
release:
|
||||
description: Tag and create the github release. Use string true or false.
|
||||
default: false
|
||||
required: false
|
||||
type: string
|
||||
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
architecture:
|
||||
description: 'The architecture of the images that will be build.'
|
||||
required: false
|
||||
default: 'linux/amd64'
|
||||
type: string
|
||||
mailu_version:
|
||||
description: 'The main version that is build. E.g. master or x.y.'
|
||||
required: true
|
||||
type: string
|
||||
pinned_mailu_version:
|
||||
description: 'The specific version that is build. E.g. commit hash or x.y.z.'
|
||||
required: true
|
||||
type: string
|
||||
docker_org:
|
||||
description: 'The docker organisation where the images are pushed to.'
|
||||
required: true
|
||||
type: string
|
||||
branch:
|
||||
description: 'The branch that triggered this workflow.'
|
||||
required: true
|
||||
type: string
|
||||
deploy:
|
||||
description: Deploy to docker hub. Happens for all branches but staging
|
||||
default: true
|
||||
required: false
|
||||
type: boolean
|
||||
release:
|
||||
description: 'Tag and create the github release. Only happens for branch x.y (release branch)'
|
||||
default: false
|
||||
required: false
|
||||
type: boolean
|
||||
env:
|
||||
HCL_FILE: ./tests/build.hcl
|
||||
|
||||
jobs:
|
||||
# This job calculates what images must be build. It reads the build.hcl file and then outputs all targets (images) in it.
|
||||
# This is used by the next build job.
|
||||
targets:
|
||||
name: create targets
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.targets.outputs.matrix }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Create matrix
|
||||
id: targets
|
||||
run: |
|
||||
echo ::set-output name=matrix::$(docker buildx bake -f ${{env.HCL_FILE}} --print | jq -cr '.group.default.targets')
|
||||
- name: Show matrix
|
||||
run: |
|
||||
echo ${{ steps.targets.outputs.matrix }}
|
||||
|
||||
# This job builds all the images. The build cache is stored in the github actions cache.
|
||||
# In further jobs, this cache is used to quickly rebuild the images.
|
||||
build:
|
||||
name: Build images
|
||||
needs:
|
||||
- targets
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target: ${{ fromJson(needs.targets.outputs.matrix) }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Retrieve global variables
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${{ inputs.branch }}" >> $GITHUB_ENV
|
||||
echo "MAILU_VERSION=${{ inputs.mailu_version }}" >> $GITHUB_ENV
|
||||
echo "PINNED_MAILU_VERSION=${{ inputs.pinned_mailu_version }}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=${{ inputs.docker_org }}" >> $GITHUB_ENV
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- uses: crazy-max/ghaction-github-runtime@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.Docker_Login }}
|
||||
password: ${{ secrets.Docker_Password }}
|
||||
- name: Build all docker images
|
||||
env:
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG }}
|
||||
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
||||
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
||||
uses: docker/bake-action@v2
|
||||
with:
|
||||
files: ${{env.HCL_FILE}}
|
||||
targets: ${{ matrix.target }}
|
||||
load: false
|
||||
push: false
|
||||
set: |
|
||||
*.cache-from=type=gha,scope=build-${{ matrix.target }}
|
||||
*.cache-to=type=gha,scope=build-${{ matrix.target }},mode=max
|
||||
*.platform=${{ inputs.architecture }}
|
||||
|
||||
# This job runs all the tests.
|
||||
tests:
|
||||
name: tests
|
||||
if: inputs.architecture == 'linux/amd64'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
needs:
|
||||
- targets
|
||||
- build
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target: ["core", "fetchmail", "filters", "rainloop", "roundcube", "webdav"]
|
||||
time: ["2"]
|
||||
include:
|
||||
- target: "filters"
|
||||
time: "3"
|
||||
exclude:
|
||||
- target: "filters"
|
||||
time: "2"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Retrieve global variables
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${{ inputs.branch }}" >> $GITHUB_ENV
|
||||
echo "MAILU_VERSION=${{ inputs.mailu_version }}" >> $GITHUB_ENV
|
||||
echo "PINNED_MAILU_VERSION=${{ inputs.pinned_mailu_version }}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=${{ inputs.docker_org }}" >> $GITHUB_ENV
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- uses: crazy-max/ghaction-github-runtime@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.Docker_Login }}
|
||||
password: ${{ secrets.Docker_Password }}
|
||||
- name: Build docker images for testing from cache
|
||||
env:
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG }}
|
||||
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
||||
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
||||
uses: docker/bake-action@v2
|
||||
with:
|
||||
files: ${{env.HCL_FILE}}
|
||||
load: true
|
||||
push: false
|
||||
set: |
|
||||
*.cache-from=type=gha,scope=build-docs
|
||||
*.cache-from=type=gha,scope=build-setup
|
||||
*.cache-from=type=gha,scope=build-admin
|
||||
*.cache-from=type=gha,scope=build-antispam
|
||||
*.cache-from=type=gha,scope=build-front
|
||||
*.cache-from=type=gha,scope=build-imap
|
||||
*.cache-from=type=gha,scope=build-smtp
|
||||
*.cache-from=type=gha,scope=build-rainloop
|
||||
*.cache-from=type=gha,scope=build-roundcube
|
||||
*.cache-from=type=gha,scope=build-antivirus
|
||||
*.cache-from=type=gha,scope=build-fetchmail
|
||||
*.cache-from=type=gha,scope=build-resolver
|
||||
*.cache-from=type=gha,scope=build-traefik-certdumper
|
||||
*.cache-from=type=gha,scope=build-webdav
|
||||
*.platform=${{ inputs.architecture }}
|
||||
- name: Install python packages
|
||||
run: python3 -m pip install -r tests/requirements.txt
|
||||
- name: Copy all certs
|
||||
run: sudo -- sh -c 'mkdir -p /mailu && cp -r tests/certs /mailu && chmod 600 /mailu/certs/*'
|
||||
- name: Test ${{ matrix.target }}
|
||||
run: python tests/compose/test.py ${{ matrix.target }} ${{ matrix.time }}
|
||||
env:
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG }}
|
||||
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
||||
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
||||
|
||||
# This job deploys the docker images to the docker repository. The build.hcl file contains logic that determines what tags are pushed.
|
||||
# E.g. for master only the :master and :latest tags are pushed.
|
||||
deploy:
|
||||
name: Deploy images
|
||||
# Deploying is not required for staging
|
||||
if: inputs.deploy == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
- tests
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Retrieve global variables
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${{ inputs.branch }}" >> $GITHUB_ENV
|
||||
echo "MAILU_VERSION=${{ inputs.mailu_version }}" >> $GITHUB_ENV
|
||||
echo "PINNED_MAILU_VERSION=${{ inputs.pinned_mailu_version }}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=${{ inputs.docker_org }}" >> $GITHUB_ENV
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- uses: crazy-max/ghaction-github-runtime@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.Docker_Login }}
|
||||
password: ${{ secrets.Docker_Password }}
|
||||
- name: Deploy images to docker hub. Build.hcl contains the logic for the tags that are pushed.
|
||||
env:
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG }}
|
||||
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
||||
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
||||
uses: docker/bake-action@v2
|
||||
with:
|
||||
files: ${{env.HCL_FILE}}
|
||||
push: true
|
||||
set: |
|
||||
*.cache-from=type=gha,scope=build-docs
|
||||
*.cache-from=type=gha,scope=build-setup
|
||||
*.cache-from=type=gha,scope=build-admin
|
||||
*.cache-from=type=gha,scope=build-antispam
|
||||
*.cache-from=type=gha,scope=build-front
|
||||
*.cache-from=type=gha,scope=build-imap
|
||||
*.cache-from=type=gha,scope=build-smtp
|
||||
*.cache-from=type=gha,scope=build-rainloop
|
||||
*.cache-from=type=gha,scope=build-roundcube
|
||||
*.cache-from=type=gha,scope=build-antivirus
|
||||
*.cache-from=type=gha,scope=build-fetchmail
|
||||
*.cache-from=type=gha,scope=build-resolver
|
||||
*.cache-from=type=gha,scope=build-traefik-certdumper
|
||||
*.cache-from=type=gha,scope=build-webdav
|
||||
*.platform=${{ inputs.architecture }}
|
||||
|
||||
deploy-arm:
|
||||
name: Deploy images for arm
|
||||
# Deploying is not required for staging
|
||||
if: inputs.deploy == 'true' && inputs.architecture != 'linux/amd64'
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Retrieve global variables
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${{ inputs.branch }}" >> $GITHUB_ENV
|
||||
echo "MAILU_VERSION=${{ inputs.mailu_version }}" >> $GITHUB_ENV
|
||||
echo "PINNED_MAILU_VERSION=${{ inputs.pinned_mailu_version }}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=${{ inputs.docker_org }}" >> $GITHUB_ENV
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- uses: crazy-max/ghaction-github-runtime@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.Docker_Login }}
|
||||
password: ${{ secrets.Docker_Password }}
|
||||
- name: Deploy images to docker hub. Build.hcl contains the logic for the tags that are pushed.
|
||||
env:
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG }}
|
||||
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
||||
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
||||
uses: docker/bake-action@v2
|
||||
with:
|
||||
files: ${{env.HCL_FILE}}
|
||||
push: true
|
||||
set: |
|
||||
*.cache-from=type=gha,scope=build-docs
|
||||
*.cache-from=type=gha,scope=build-setup
|
||||
*.cache-from=type=gha,scope=build-admin
|
||||
*.cache-from=type=gha,scope=build-antispam
|
||||
*.cache-from=type=gha,scope=build-front
|
||||
*.cache-from=type=gha,scope=build-imap
|
||||
*.cache-from=type=gha,scope=build-smtp
|
||||
*.cache-from=type=gha,scope=build-rainloop
|
||||
*.cache-from=type=gha,scope=build-roundcube
|
||||
*.cache-from=type=gha,scope=build-antivirus
|
||||
*.cache-from=type=gha,scope=build-fetchmail
|
||||
*.cache-from=type=gha,scope=build-resolver
|
||||
*.cache-from=type=gha,scope=build-traefik-certdumper
|
||||
*.cache-from=type=gha,scope=build-webdav
|
||||
*.platform=${{ inputs.architecture }}
|
||||
|
||||
#This job creates a tagged release. A tag is created for the pinned version x.y.z. The GH release refers to this tag.
|
||||
tag-release:
|
||||
if: inputs.release == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- deploy
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
# fetch-depth 0 is required to also retrieve all tags.
|
||||
fetch-depth: 0
|
||||
- name: Retrieve global variables
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${{ inputs.branch }}" >> $GITHUB_ENV
|
||||
echo "MAILU_VERSION=${{ inputs.mailu_version }}" >> $GITHUB_ENV
|
||||
echo "PINNED_MAILU_VERSION=${{ inputs.pinned_mailu_version }}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG=${{ inputs.docker_org }}" >> $GITHUB_ENV
|
||||
- name: Create tag for branch x.y.
|
||||
shell: bash
|
||||
run: |
|
||||
echo git tag ${{ env.PINNED_MAILU_VERSION }} $(/usr/bin/git rev-parse HEAD)
|
||||
git tag ${{ env.PINNED_MAILU_VERSION }} $(/usr/bin/git rev-parse HEAD)
|
||||
git push origin ${{ env.PINNED_MAILU_VERSION }}
|
||||
- name: Create release for tag x.y.z.
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
bodyFile: "RELEASE_TEMPLATE.md"
|
||||
tag: ${{ env.PINNED_MAILU_VERSION }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
134
.github/workflows/x64.yml
vendored
Normal file
134
.github/workflows/x64.yml
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
name: start-linux-amd64
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- testing
|
||||
- staging
|
||||
- '1.9'
|
||||
- master
|
||||
|
||||
concurrency: ci-x64-${{ github.ref }}
|
||||
|
||||
###############################################
|
||||
# REQUIRED secrets
|
||||
# ${{ secrets.Docker_Login }}
|
||||
# Username of docker login for pushing the images to repo env.DOCKER_ORG and env.DOCKER_ORG_TESTS
|
||||
# ${{ secrets.Docker_Password }}
|
||||
# Password of docker login for pushing the images to repo env.DOCKER_ORG and env.DOCKER_ORG_TESTS
|
||||
# Add the above secrets to your github repo to determine where the images will be pushed.
|
||||
################################################
|
||||
# REQUIRED global variables
|
||||
# DOCKER_ORG, docker org used for pushing release images (branch x.y and master)
|
||||
# DOCKER_ORG_TEST, docker org used for pushing images for testing (branch testing).
|
||||
env:
|
||||
DOCKER_ORG: mailu
|
||||
DOCKER_ORG_TEST: mailuci
|
||||
|
||||
jobs:
|
||||
# This job calculates all global job variables that are required by all the subsequent jobs.
|
||||
# All subsequent jobs will retrieve and use these variables. This way the variables only have to be derived once.
|
||||
derive-variables:
|
||||
name: derive variables
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
||||
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
||||
DOCKER_ORG: ${{ env.DOCKER_ORG_DERIVED }}
|
||||
BRANCH: ${{ env.BRANCH }}
|
||||
DEPLOY: ${{ env.DEPLOY }}
|
||||
RELEASE: ${{ env.RELEASE }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
# fetch-depth 0 is required to also retrieve all tags.
|
||||
fetch-depth: 0
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||
#For branch TESTING, we set the image tag to pr-xxxx
|
||||
- name: Derive MAILU_VERSION and PINNED_MAILU_VERSION and DEPLOY/RELEASE for branch testing
|
||||
if: env.BRANCH == 'testing'
|
||||
shell: bash
|
||||
env:
|
||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||
run: |
|
||||
echo "MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "PINNED_MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG_DERIVED=${{ env.DOCKER_ORG_TEST }}" >> $GITHUB_ENV
|
||||
echo "DEPLOY=true" >> $GITHUB_ENV
|
||||
echo "RELEASE=false" >> $GITHUB_ENV
|
||||
- name: Derive MAILU_VERSION and DEPLOY/RELEASE for other branches than testing
|
||||
if: env.BRANCH != 'testing'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "MAILU_VERSION=${{ env.BRANCH }}" >> $GITHUB_ENV
|
||||
echo "DOCKER_ORG_DERIVED=${{ env.DOCKER_ORG }}" >> $GITHUB_ENV
|
||||
echo "DEPLOY=true" >> $GITHUB_ENV
|
||||
echo "RELEASE=false" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION and DEPLOY/RELEASE for normal release x.y
|
||||
if: env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master'
|
||||
shell: bash
|
||||
run: |
|
||||
version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
|
||||
echo "RELEASE=true" >> $GITHUB_ENV
|
||||
echo "DEPLOY=true" >> $GITHUB_ENV
|
||||
echo "RELEASE=true" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION and DEPLOY/RELEASE for staging
|
||||
id: deploy
|
||||
if: env.BRANCH == 'staging'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=staging" >> $GITHUB_ENV
|
||||
echo "DEPLOY=false" >> $GITHUB_ENV
|
||||
echo "RELEASE=false" >> $GITHUB_ENV
|
||||
- name: Derive PINNED_MAILU_VERSION for staging for master
|
||||
if: env.BRANCH == 'master'
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_SHA: ${{ env.GITHUB_SHA }}
|
||||
run: |
|
||||
echo "PINNED_MAILU_VERSION=$GITHUB_SHA" >> $GITHUB_ENV
|
||||
echo "DEPLOY=true" >> $GITHUB_ENV
|
||||
echo "RELEASE=false" >> $GITHUB_ENV
|
||||
|
||||
build-test-deploy:
|
||||
needs:
|
||||
- derive-variables
|
||||
uses: ./.github/workflows/build_test_deploy.yml
|
||||
with:
|
||||
architecture: 'linux/amd64'
|
||||
mailu_version: ${{needs.derive-variables.outputs.MAILU_VERSION}}
|
||||
pinned_mailu_version: ${{needs.derive-variables.outputs.PINNED_MAILU_VERSION}}
|
||||
docker_org: ${{needs.derive-variables.outputs.DOCKER_ORG}}
|
||||
branch: ${{needs.derive-variables.outputs.BRANCH}}
|
||||
deploy: ${{needs.derive-variables.outputs.DEPLOY}}
|
||||
release: ${{needs.derive-variables.outputs.RELEASE}}
|
||||
secrets: inherit
|
||||
|
||||
# This job is watched by bors. It only complets if building,testing and deploy worked.
|
||||
ci-success:
|
||||
name: CI-Done
|
||||
#Returns true when none of the **previous** steps have failed or have been canceled.
|
||||
if: success()
|
||||
needs:
|
||||
- build-test-deploy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: CI/CD succeeded.
|
||||
run: exit 0
|
||||
|
||||
################################################
|
||||
# Code block that is used as one liner for the step:
|
||||
# Derive PINNED_MAILU_VERSION and DEPLOY/RELEASE for normal release x.y
|
||||
##!/bin/bash
|
||||
#version=$( git tag --sort=version:refname --list "{{ env.MAILU_VERSION }}.*" | tail -1 )
|
||||
#root_version=${version%.*}
|
||||
#patch_version=${version##*.}
|
||||
#if [ "$patch_version" == "" ]
|
||||
#then
|
||||
# pinned_version={{ env.MAILU_VERSION }}.0
|
||||
#else
|
||||
# pinned_version=$root_version.$(expr $patch_version + 1)
|
||||
#fi
|
||||
#echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
|
||||
Reference in New Issue
Block a user