Skip to content

Testing Image Analysis on PR #288

Testing Image Analysis on PR

Testing Image Analysis on PR #288

Workflow file for this run

name: Smoke Test Docker Image
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
push:
branches:
- main
env:
ORG: timescaledev
TS_VERSION: main
PLATFORM: linux/amd64
jobs:
smoketest:
name: PG${{ matrix.pg }}-${{ matrix.type }}-docker
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pg: [15]
type: ["normal", "bitnami"]
steps:
- name: set the correct commit sha
env:
EVENT: ${{github.event_name}}
run: |
if [ "$EVENT" == 'pull_request' ]
then
echo "commit=${{ github.event.pull_request.head.sha}}" >> "$GITHUB_ENV"
else
echo "commit=${{ github.sha}}" >> "$GITHUB_ENV"
fi
- name: Check out the source
uses: actions/checkout@v3
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
- name: Build Docker Image for TimescaleDB
run: |
if [ ${{ matrix.type }} == bitnami ]
then
cd bitnami
fi
make build-docker-cache image PG_VER=pg${{ matrix.pg }} TAG_VERSION=smoketest-image BETA=1
- name: Install psql
run: sudo apt install postgresql-client
- name: Run the smoke test
run: |
set -eu
export PGHOST=localhost
export PGUSER=postgres
export PGPASSWORD=test1234
docker container stop smoketest-container || true
docker container rm smoketest-container || true
docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=${PGPASSWORD} --name smoketest-container smoketest-image
for _ in {1..120}
do
if [ -z "$(docker container ls -q --filter name=smoketest-container)" ]
then
echo "Smoketest container is not running"
exit 1
fi
if psql -c "select 1"
then
bash ./test/smoke_test/smoke_test.sh
break
fi
sleep 1
done
if ! psql -c "select 1"
then
echo "Cannot connect to PostgreSQL"
exit 1
fi
- name: Show the logs
if: always()
run: |
docker logs smoketest-container
- name: export the image
run: |
set -eux
export PGHOST=localhost
export PGUSER=postgres
export PGPASSWORD=test1234
docker container stop smoketest-container || true
docker container rm smoketest-container || true
docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=${PGPASSWORD} --name smoketest-container smoketest-image
docker export smoketest-container > ${{matrix.type}}-${{ env.commit }}.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{matrix.type}}-${{ env.commit }}
path: ./${{matrix.type}}-${{ env.commit }}.tar
retention-days: 1