mirror of
https://github.com/bokysan/docker-postfix.git
synced 2025-09-26 00:14:39 +08:00
121 lines
No EOL
4.1 KiB
YAML
121 lines
No EOL
4.1 KiB
YAML
name: Docker image
|
|
|
|
on:
|
|
push:
|
|
branches: master
|
|
|
|
jobs:
|
|
buildx:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Checkout branch
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get release version
|
|
id: version_number
|
|
shell: bash
|
|
run: |
|
|
echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
|
|
echo "::set-output name=RELEASE_VERSION::${GITHUB_REF:10}"
|
|
|
|
- name: Run unit tests
|
|
run: ./unit-tests.sh
|
|
|
|
- name: Run integration tests
|
|
shell: bash
|
|
env: # Or as an environment variable
|
|
XOAUTH2_RELAYHOST_USERNAME: ${{ secrets.XOAUTH2_RELAYHOST_USERNAME }}
|
|
XOAUTH2_CLIENT_ID: ${{ secrets.XOAUTH2_CLIENT_ID }}
|
|
XOAUTH2_SECRET: ${{ secrets.XOAUTH2_SECRET }}
|
|
XOAUTH2_INITIAL_REFRESH_TOKEN: ${{ secrets.XOAUTH2_INITIAL_REFRESH_TOKEN }}
|
|
run: |
|
|
echo "RELAYHOST_USERNAME=${XOAUTH2_RELAYHOST_USERNAME}" > integration-tests/xoauth2/.env
|
|
echo "FROM=${XOAUTH2_RELAYHOST_USERNAME}" >> integration-tests/xoauth2/.env
|
|
echo "TO=${XOAUTH2_RELAYHOST_USERNAME}" >> integration-tests/xoauth2/.env
|
|
echo "XOAUTH2_CLIENT_ID=${XOAUTH2_CLIENT_ID}" >> integration-tests/xoauth2/.env
|
|
echo "XOAUTH2_SECRET=${XOAUTH2_SECRET}" >> integration-tests/xoauth2/.env
|
|
echo "XOAUTH2_INITIAL_REFRESH_TOKEN=${XOAUTH2_INITIAL_REFRESH_TOKEN}" >> integration-tests/xoauth2/.env
|
|
cp integration-tests/xoauth2/.env integration-tests/xoauth2-error/.env
|
|
./integration-tests.sh
|
|
|
|
- name: Run HELM chart tests
|
|
run: ./helm/tests.sh
|
|
|
|
- name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@master
|
|
with:
|
|
install: true
|
|
|
|
- name: Builder info
|
|
run: |
|
|
echo "Name: ${{ steps.buildx.outputs.name }}"
|
|
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
|
|
echo "Status: ${{ steps.buildx.outputs.status }}"
|
|
echo "Flags: ${{ steps.buildx.outputs.flags }}"
|
|
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
|
|
|
|
- name: Cache Docker layers
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: ${{ runner.os }}-single-buildx-${{ hashFiles('**/Dockerfile') }}
|
|
#key: ${{ runner.os }}-single-buildx-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-single-buildx-
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: 'boky'
|
|
password: '${{ secrets.DOCKER_ACCESS_TOKEN }}'
|
|
|
|
- name: Build and push unmarked release
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: boky/postfix:latest
|
|
platforms: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le" # linux/s390x: "rsyslog (no such package)"
|
|
cache-from: type=local,src=/tmp/.buildx-cache/alpine
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-new/alpine
|
|
build-args: |
|
|
BASE_IMAGE=alpine:latest
|
|
|
|
- name: Build and push Alpine
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: boky/postfix:latest-alpine
|
|
platforms: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le" # linux/s390x: "rsyslog (no such package)"
|
|
cache-from: type=local,src=/tmp/.buildx-cache-new/alpine
|
|
build-args: |
|
|
BASE_IMAGE=alpine:latest
|
|
|
|
- name: Build and push Ubuntu
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: boky/postfix:latest-ubuntu
|
|
platforms: "linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x"
|
|
cache-from: type=local,src=/tmp/.buildx-cache/ubuntu
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-new/ubuntu
|
|
build-args: |
|
|
BASE_IMAGE=ubuntu:focal
|
|
|
|
- name: Move cache
|
|
run: |
|
|
rm -rf /tmp/.buildx-cache
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |