2021-08-11 03:22:33 +08:00
|
|
|
name: docker-image
|
2021-04-06 01:26:35 +08:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-08-11 03:22:33 +08:00
|
|
|
branches:
|
|
|
|
- main
|
2021-04-06 01:26:35 +08:00
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- published
|
|
|
|
|
|
|
|
jobs:
|
2022-03-31 03:54:53 +08:00
|
|
|
images:
|
2021-04-06 01:26:35 +08:00
|
|
|
runs-on: ubuntu-latest
|
2022-03-31 03:54:53 +08:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
build:
|
|
|
|
- fromImage: scratch
|
|
|
|
tagPrefix: ""
|
|
|
|
- fromImage: alpine:latest
|
|
|
|
tagPrefix: "alpine-"
|
2021-04-06 01:26:35 +08:00
|
|
|
steps:
|
2021-08-10 00:15:24 +08:00
|
|
|
- name: Get current date
|
|
|
|
id: date
|
|
|
|
run: echo "::set-output name=date::$(date --utc +%Y-%m-%dT%H:%M:%SZ)"
|
2021-04-06 01:26:35 +08:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: Login to Quay
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: quay.io
|
|
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
2021-08-11 03:22:33 +08:00
|
|
|
- name: Login to ghcr.io
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2022-03-31 03:54:53 +08:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Modify Dockerfile
|
|
|
|
run: |
|
|
|
|
sed -i -e "s|FROM scratch|FROM ${{ matrix.build.fromImage }}|g" Dockerfile
|
2022-03-15 03:08:55 +08:00
|
|
|
|
2021-04-06 01:26:35 +08:00
|
|
|
- name: Build and push ${{github.event.release.tag_name }}
|
|
|
|
id: docker_build_release
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
if: ${{ github.event.release.tag_name != '' }}
|
|
|
|
with:
|
2022-03-31 03:54:53 +08:00
|
|
|
context: .
|
2022-01-24 23:56:49 +08:00
|
|
|
pull: true
|
2021-04-06 01:26:35 +08:00
|
|
|
push: true
|
2022-03-31 03:54:53 +08:00
|
|
|
tags: quay.io/bakito/adguardhome-sync:${{ matrix.build.tagPrefix }}latest,quay.io/bakito/adguardhome-sync:${{ matrix.build.tagPrefix }}${{ github.event.release.tag_name }},ghcr.io/bakito/adguardhome-sync:${{ matrix.build.tagPrefix }}latest,ghcr.io/bakito/adguardhome-sync:${{ matrix.build.tagPrefix }}${{ github.event.release.tag_name }}
|
2021-04-06 01:26:35 +08:00
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
2021-08-10 00:15:24 +08:00
|
|
|
build-args: |
|
|
|
|
VERSION=${{ github.event.release.tag_name }}
|
|
|
|
BUILD=${{ steps.date.outputs.date }}
|
2021-04-06 01:26:35 +08:00
|
|
|
|
|
|
|
- name: Build and push main
|
|
|
|
id: docker_build_main
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
if: ${{ github.event.release.tag_name == '' }}
|
|
|
|
with:
|
2022-03-31 03:54:53 +08:00
|
|
|
context: .
|
2022-01-24 23:56:49 +08:00
|
|
|
pull: true
|
2021-04-06 01:26:35 +08:00
|
|
|
push: true
|
2022-03-31 03:54:53 +08:00
|
|
|
tags: quay.io/bakito/adguardhome-sync:${{ matrix.build.tagPrefix }}main,ghcr.io/bakito/adguardhome-sync:${{ matrix.build.tagPrefix }}main
|
2021-04-06 01:26:35 +08:00
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
2021-08-10 00:15:24 +08:00
|
|
|
build-args: |
|
|
|
|
VERSION=main
|
|
|
|
BUILD=${{ steps.date.outputs.date }}
|
2022-03-15 03:08:55 +08:00
|
|
|
|
2021-04-06 01:26:35 +08:00
|
|
|
- name: Image digest
|
|
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
2022-10-06 00:15:07 +08:00
|
|
|
test:
|
|
|
|
needs: images
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Create kind cluster
|
|
|
|
uses: helm/kind-action@v1.3.0
|
|
|
|
with:
|
|
|
|
version: v0.14.0
|
|
|
|
kubectl_version: v1.24.0
|
2022-10-07 03:29:04 +08:00
|
|
|
- name: Install Helm Chart
|
2022-10-07 13:32:20 +08:00
|
|
|
run: ./testdata/e2e/bin/install-chart.sh
|
2022-10-07 03:29:04 +08:00
|
|
|
- name: Wait for sync to finish
|
2022-10-07 13:32:20 +08:00
|
|
|
run: ./testdata/e2e/bin/wait-for-sync.sh
|
2022-10-06 00:15:07 +08:00
|
|
|
- name: Show origin Logs
|
2022-10-07 13:32:20 +08:00
|
|
|
run: ./testdata/e2e/bin/show-origin-logs.sh
|
2022-10-06 00:15:07 +08:00
|
|
|
- name: Show Replica Logs
|
2022-10-07 13:32:20 +08:00
|
|
|
run: ./testdata/e2e/bin/show-replica-logs.sh
|
2022-10-06 00:15:07 +08:00
|
|
|
- name: Show Sync Logs
|
2022-10-07 13:32:20 +08:00
|
|
|
run: ./testdata/e2e/bin/show-sync-logs.sh
|