mirror of
https://github.com/bokysan/docker-postfix.git
synced 2025-09-08 07:24:36 +08:00
Upd: Simplyfy GitHub actions
This commit is contained in:
parent
7a22e1817d
commit
81eb4eaef7
3 changed files with 151 additions and 154 deletions
116
.github/workflows/master.yml
vendored
116
.github/workflows/master.yml
vendored
|
@ -5,68 +5,35 @@ on:
|
|||
branches: [ 'master' ]
|
||||
|
||||
jobs:
|
||||
buildx:
|
||||
"Unit Tests":
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/unit-tests
|
||||
"Integration Tests":
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/integration-tests
|
||||
"Helm chart Tests":
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/helm-chart-tests
|
||||
|
||||
- name: Checkout branch
|
||||
"Build Alpine":
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- "Unit Tests"
|
||||
- "Integration Tests"
|
||||
- "Helm chart Tests"
|
||||
steps:
|
||||
# Checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Buildkit setup
|
||||
- uses: ./.github/actions/buildx-setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
- 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 }}"
|
||||
# Docker hub login
|
||||
- uses: ./.github/actions/buildx-setup
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v3
|
||||
|
@ -77,12 +44,6 @@ jobs:
|
|||
restore-keys: |
|
||||
${{ runner.os }}-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
|
||||
|
@ -102,6 +63,37 @@ jobs:
|
|||
build-args: |
|
||||
BASE_IMAGE=alpine:latest
|
||||
|
||||
- name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
"Build Ubuntu":
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- "Unit Tests"
|
||||
- "Integration Tests"
|
||||
- "Helm chart Tests"
|
||||
steps:
|
||||
# Checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Buildkit setup
|
||||
- uses: ./.github/actions/buildx-setup
|
||||
|
||||
# Docker hub login
|
||||
- uses: ./.github/actions/buildx-setup
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
#key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }}
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Build and push Ubuntu
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
|
|
51
.github/workflows/pull_request.yml
vendored
51
.github/workflows/pull_request.yml
vendored
|
@ -5,9 +5,27 @@ on:
|
|||
branches: [ 'master' ]
|
||||
|
||||
jobs:
|
||||
buildx:
|
||||
"Unit Tests":
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/unit-tests
|
||||
"Integration Tests":
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/integration-tests
|
||||
"Helm chart Tests":
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/helm-chart-tests
|
||||
|
||||
"Build Alpine":
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- "Unit Tests"
|
||||
- "Integration Tests"
|
||||
- "Helm chart Tests"
|
||||
steps:
|
||||
- uses: ./.github/actions/buildx-setup
|
||||
|
||||
|
||||
|
||||
|
@ -25,29 +43,6 @@ jobs:
|
|||
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
|
||||
|
||||
|
@ -57,14 +52,6 @@ jobs:
|
|||
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@v3
|
||||
with:
|
||||
|
|
138
.github/workflows/tags.yml
vendored
138
.github/workflows/tags.yml
vendored
|
@ -5,68 +5,37 @@ on:
|
|||
tags: [ 'v*.*.*' ]
|
||||
|
||||
jobs:
|
||||
buildx:
|
||||
"Unit Tests":
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/unit-tests
|
||||
"Integration Tests":
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/integration-tests
|
||||
"Helm chart Tests":
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/helm-chart-tests
|
||||
|
||||
- name: Checkout tag
|
||||
"Build Alpine":
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- "Unit Tests"
|
||||
- "Integration Tests"
|
||||
- "Helm chart Tests"
|
||||
steps:
|
||||
# Checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Checkout gh-pages
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: "gh-pages"
|
||||
path: "gh-pages"
|
||||
fetch-depth: 1
|
||||
# Buildkit setup
|
||||
- uses: ./.github/actions/buildx-setup
|
||||
|
||||
- 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: 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 }}"
|
||||
# Docker hub login
|
||||
- uses: ./.github/actions/buildx-setup
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v3
|
||||
|
@ -77,12 +46,6 @@ jobs:
|
|||
restore-keys: |
|
||||
${{ runner.os }}-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
|
||||
|
@ -102,6 +65,39 @@ jobs:
|
|||
build-args: |
|
||||
BASE_IMAGE=alpine:latest
|
||||
|
||||
- name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
"Build Ubuntu":
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- "Unit Tests"
|
||||
- "Integration Tests"
|
||||
- "Helm chart Tests"
|
||||
steps:
|
||||
# Checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# Buildkit setup
|
||||
- uses: ./.github/actions/buildx-setup
|
||||
|
||||
# Docker hub login
|
||||
- uses: ./.github/actions/buildx-setup
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
#key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }}
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Build and push Ubuntu
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
|
@ -119,10 +115,32 @@ jobs:
|
|||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
"Build Helm chart":
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- "Unit Tests"
|
||||
- "Integration Tests"
|
||||
- "Helm chart Tests"
|
||||
|
||||
steps:
|
||||
# Checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Checkout gh-pages
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: "gh-pages"
|
||||
path: "gh-pages"
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Copy `README.md` and `LICENCE` into the helm chart
|
||||
id: readme_and_licence
|
||||
shell: bash
|
||||
run: cp README.md LICENSE helm/mail/
|
||||
|
||||
- name: Changelog
|
||||
uses: Bullrich/generate-release-changelog@master
|
||||
id: Changelog
|
||||
|
|
Loading…
Add table
Reference in a new issue