Skip to content

Build and test on arm64 platform #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ env:
TEST_TAG: test
DISTRO: jammy
PROJECT_ID: piler
ARCH: amd64
ARCH: arm64
CONTAINER: piler
RT: 1

jobs:
build:
runs-on: ubuntu-latest
runs-on:
- self-hosted
- ARM64

outputs:
IMAGE_TAG: ${{ steps.generate-version.outputs.IMAGE_TAG }}
Expand Down Expand Up @@ -47,6 +49,7 @@ jobs:
id: build-package
run: |
docker run --rm -e PROJECT_ID -e DISTRO -e ARCH -e VERSION -e COMMIT_ID -e BUILD_NUMBER=$GITHUB_RUN_ID -v $PWD:/repo -v $PWD/docker:/data ${{ env.BUILDER_IMAGE }}
docker run --rm -v ${{ github.workspace }}:/workspace busybox:latest /bin/sh -c "chown -R $(id -u):$(id -g) /workspace"
ls -la docker
a="$(ls docker/*deb)"
PACKAGE="${a##*/}"
Expand All @@ -69,14 +72,14 @@ jobs:
with:
context: docker
push: true
tags: ${{ env.IMAGE_NAME }}:${{ env.TEST_TAG }}
tags: ${{ env.IMAGE_NAME }}:${{ env.TEST_TAG }}-${{ env.ARCH }}
build-args: |
PACKAGE=${{ env.PACKAGE }}

run-tests:
runs-on:
- self-hosted
- X64
- ARM64

needs:
- build
Expand All @@ -95,7 +98,7 @@ jobs:

- name: Start containers
run: |
export VERSION=${{ env.TEST_TAG }}
export VERSION=${{ env.TEST_TAG }}-${{ env.ARCH }}
pushd docker
docker compose pull piler
docker compose up -d
Expand All @@ -111,6 +114,8 @@ jobs:
docker compose ps
popd
shell: bash
env:
ARCHIVE_HOST: ${{ vars.ARCHIVE_HOST }}

- name: Remove stale images
run: yes|docker image prune
Expand All @@ -126,3 +131,8 @@ jobs:
run: |
./tests/run.sh
shell: bash
env:
ARCHIVE_HOST: ${[ vars.ARCHIVE_HOST }}
EML_DIR: ${{ vars.EML_DIR }}
SMTP_SOURCE_PROG: ${{ vars.SMTP_SOURCE_PROG }}
SMTP_HOST: ${{ vars.SMTP_HOST }}
2 changes: 1 addition & 1 deletion docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
- MYSQL_DATABASE=piler
- MYSQL_USER=piler
- MYSQL_PASSWORD=piler123
- PILER_HOSTNAME=cust1.acts.hu
- PILER_HOSTNAME=${ARCHIVE_HOST:-archive.example.com}
- RT=1
ports:
- "25:25"
Expand Down
24 changes: 10 additions & 14 deletions tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ set -o nounset
set -o errexit
set -o pipefail

SCRIPT_PATH="$(readlink -f "$0")"
SCRIPT_DIR="${SCRIPT_PATH%/*}"

EML_DIR=/home/sj/temp/eml
SMTP_SOURCE_PROG=/home/sj/devel/ci/test/smtp/smtp-source.py
SMTP_HOST="127.0.0.1"

declare -a SEARCH_QUERIES
declare -a SEARCH_HITS
declare -A SHA256_SUM

VERDICT=0
RESULT_CRITICAL=2

error() {
echo "$@"
exit 1
}

set_verdict() {
[[ ${VERDICT} -ge "$1" ]] || { VERDICT="$1"; echo "verdict: ${VERDICT}"; }
}
Expand All @@ -30,8 +28,9 @@ get_verdict() {
count_status_values() {
local logfile="mail.log"

echo "$FUNCNAME"
echo "${FUNCNAME[0]}"

# shellcheck disable=SC2153
docker exec "$CONTAINER" cat "/var/log/${logfile}" > "$logfile"

received=$(grep -c "received:" "$logfile")
Expand Down Expand Up @@ -64,7 +63,7 @@ append_queries() {
}

run_sphinx_tests() {
echo "$FUNCNAME"
echo "${FUNCNAME[0]}"

append_queries

Expand Down Expand Up @@ -136,14 +135,11 @@ read_eml_files_data() {

ts_stop="$(date +%s)"
echo "${FUNCNAME[0]}" "took" $(( ts_stop - ts_start )) "secs"

READ_EML_TEST_FILES=1
}

test_retrieved_messages_are_the_same() {
local container="$1"
local database="$2"
local piler_id
local message_id
local i=0
local bad=0
Expand Down Expand Up @@ -183,10 +179,10 @@ test_retrieved_messages_are_the_same() {
}

for i in Inbox Inbox2 Levelszemet Levelszemet2 spam0 spam1 spam2 journal deduptest special; do
"$SMTP_SOURCE_PROG" -s "$SMTP_HOST" -r archive@cust1.acts.hu -p 25 -t 20 --dir "$EML_DIR/$i" --no-counter
"$SMTP_SOURCE_PROG" -s "$SMTP_HOST" -r "archive@${ARCHIVE_HOST}" -p 25 -t 20 --dir "$EML_DIR/$i" --no-counter
done

"$SMTP_SOURCE_PROG" -s $SMTP_HOST -r archive@cust1.acts.hu [email protected] [email protected] -p 25 -t 20 --dir "$EML_DIR/virus" --no-counter
"$SMTP_SOURCE_PROG" -s "$SMTP_HOST" -r "archive@${ARCHIVE_HOST}" [email protected] [email protected] -p 25 -t 20 --dir "$EML_DIR/virus" --no-counter

wait_until_emails_are_processed "$CONTAINER" 3020

Expand Down