docker-postfix/.github/workflows/master.yml
dependabot[bot] 43c6d5a2b7
Bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-02 03:17:28 +00:00

120 lines
3.9 KiB
YAML

name: Docker image
on:
push:
branches: [ 'master' ]
jobs:
buildx:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
- 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 QEMU
uses: docker/setup-qemu-action@v1
- 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: Fix issue with building Alpine # See https://gitlab.alpinelinux.org/alpine/aports/-/issues/12406
run: |
update-binfmts --enable
- name: Build and push Alpine
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
boky/postfix:latest
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/alpine
cache-to: type=local,dest=/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/arm/v7,linux/amd64,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:impish
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache