-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add PR/push workflow for testing the container image
Signed-off-by: László Várady <laszlo.varady@anno.io>
- Loading branch information
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: CI @ AxoSyslog 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 |