Skip to content

Commit

Permalink
ci: add PR/push workflow for testing the container image
Browse files Browse the repository at this point in the history
Signed-off-by: László Várady <[email protected]>
  • Loading branch information
MrAnno committed May 18, 2024
1 parent 53bb3b9 commit af935c4
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/axosyslog-image-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI @ Docker image

on:
pull_request:
push:

jobs:
tarball:
runs-on: ubuntu-latest
outputs:
snapshot-version: ${{ steps.snapshot-version.outputs.SNAPSHOT_VERSION }}
steps:
- name: Checkout AxoSyslog source
uses: actions/checkout@v4

- name: Prepare docker image
run: ./dbld/rules cache-image-tarball

- name: Create source tarball
run: ./dbld/rules pkg-tarball

- name: Determine snapshot version
id: snapshot-version
run: |
tarball_filename="$(find dbld/build -name '*.tar.*' -printf '%f\n')"
tarball_name="${tarball_filename/\.tar.*}"
tarball_version="${tarball_name/axosyslog-}"
pkg_version="$(echo $tarball_version | sed -E 's|(([0-9]+\.){2}[0-9]+).*|\1|')_git$(date +%Y%m%d)"
echo "SNAPSHOT_VERSION=${pkg_version}" >> $GITHUB_OUTPUT
- name: Store source tarball as artifact
uses: actions/upload-artifact@v4
with:
name: source-tarball
path: dbld/build/*.tar.gz

build-and-test:
runs-on: ubuntu-latest
needs: tarball
steps:
- name: Checkout AxoSyslog source
uses: actions/checkout@v4

- name: Download source tarball artifact
uses: actions/download-artifact@v4
with:
name: source-tarball
path: docker/apkbuild/axoflow/axosyslog

- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: docker
file: docker/alpine.dockerfile
load: true
tags: axosyslog:test
build-args: |
PKG_TYPE=snapshot
SNAPSHOT_VERSION=${{ needs.tarball.outputs.snapshot-version }}
- name: Smoke test
run: |
export SYSLOG_NG_IMAGE="axosyslog:test"
export SYSLOG_NG_VERSION="${{ needs.tarball.outputs.snapshot-version }}"
docker/tests/smoke.sh

0 comments on commit af935c4

Please sign in to comment.