mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
d2124a6529
* ci: add paths-ignore * fix: use explicit trigger paths * fix: revert changes as every file should be linted
111 lines
3.1 KiB
YAML
111 lines
3.1 KiB
YAML
name: "Build, Test & Deploy"
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- stable
|
|
paths:
|
|
- 'target/**'
|
|
- '.dockerignore'
|
|
- '.gitmodules'
|
|
- 'Dockerfile'
|
|
- 'setup.sh'
|
|
tags:
|
|
- '*.*.*'
|
|
|
|
jobs:
|
|
build-and-test-image:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
id: buildx
|
|
- name: Cache Docker layers
|
|
uses: actions/cache@v2.1.4
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-buildx-
|
|
- name: Build image locally
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
context: .
|
|
file: ./Dockerfile
|
|
build-args: |
|
|
VCS_REF=${{ github.sha }}
|
|
VCS_VER=${{ github.ref }}
|
|
platforms: linux/amd64
|
|
load: true
|
|
tags: mailserver-testing:ci
|
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
|
- name: Run test suite
|
|
run: >
|
|
NAME=mailserver-testing:ci
|
|
bash -c 'make generate-accounts tests'
|
|
env:
|
|
CI: true
|
|
|
|
build-multiarch-and-publish:
|
|
needs: build-and-test-image
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
- name: Prepare tags
|
|
id: prep
|
|
uses: crazy-max/ghaction-docker-meta@v1
|
|
with:
|
|
images: |
|
|
${{ secrets.DOCKER_REPOSITORY }}
|
|
${{ secrets.GHCR_REPOSITORY }}
|
|
tag-edge: true
|
|
tag-semver: |
|
|
{{major}}
|
|
{{major}}.{{minor}}
|
|
{{major}}.{{minor}}.{{patch}}
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
id: buildx
|
|
- name: Cache Docker layers
|
|
uses: actions/cache@v2.1.4
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-buildx-
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ secrets.GHCR_USERNAME }}
|
|
password: ${{ secrets.GHCR_PASSWORD }}
|
|
- name: Build image locally
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
context: .
|
|
file: ./Dockerfile
|
|
build-args: |
|
|
VCS_REF=${{ github.sha }}
|
|
VCS_VER=${{ github.ref }}
|
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.prep.outputs.tags }}
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|