Skip to content

Using environment variables and dripline_mesh file in integration tests #158

Using environment variables and dripline_mesh file in integration tests

Using environment variables and dripline_mesh file in integration tests #158

Workflow file for this run

name: Publish
on:
push:
branches: [ main, develop ]
tags: ['*']
pull_request:
workflow_dispatch:
env:
REGISTRY: ghcr.io
REGISTRY_OLD: docker.io
BASE_IMAGE_USER: ghcr.io/driplineorg
BASE_IMAGE_REPO: dripline-cpp
# BASE_IMAGE_TAG: 'v2.9.1'
DEV_SUFFIX: '-dev'
BASE_IMAGE_TAG: 'develop'
# DEV_SUFFIX: ''
jobs:
test_docker:
runs-on: ubuntu-latest
env:
TAG: gha-test
INT_TAG: gha-int-test
steps:
- name: Concatenate env variables
run: |
echo "DL_PY_TAG=${{ env.REGISTRY }}/${{ github.repository }}:${{ env.TAG }}" >> $GITHUB_ENV
echo "DL_PY_INT_TAG=${{ env.REGISTRY }}/${{ github.repository }}:${{ env.INT_TAG }}" >> $GITHUB_ENV
- name: Checkout the repo
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: setup_buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker
- name: Build
id: build
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
build-args: |
img_user=${{ env.BASE_IMAGE_USER }}
img_repo=${{ env.BASE_IMAGE_REPO }}
img_tag=${{ env.BASE_IMAGE_TAG }}${{ env.DEV_SUFFIX }}
platforms: linux/amd64
tags: ${{ env.DL_PY_TAG }}
- name: Build Integration Tests
id: build_int_tests
uses: docker/build-push-action@v5
with:
context: ./tests/integration
push: false
load: true
build-args: |
img_user=${{ env.BASE_IMAGE_USER }}
img_repo=dripline-python
img_tag=${{ env.TAG }}
platforms: linux/amd64
tags: ${{ env.DL_PY_INT_TAG }}
- name: Unit Tests
run: |
docker run --rm ${{ env.DL_PY_INT_TAG }} bash -c "
cd /usr/local/src_py/tests
pytest"
- name: Integration Tests
run: |
cd tests/integration
./do-testing.sh ${{ env.INT_TAG }}
# For debugging
# - name: Setup tmate session
# if: ${{ ! success() }}
# uses: mxschmitt/action-tmate@v3
build_and_push:
runs-on: ubuntu-latest
if: |
github.event_name == 'push' ||
(github.event_name == 'pull_request' && github.event.pull_request.draft == false)
needs: [test_docker]
strategy:
matrix:
build: [dev, release]
include:
- build: dev
tag-suffix: '-dev'
do-integration: true
int-tag-suffix: '-int-test'
- build: release
tag-suffix: ''
do-integration: false
int-tag-suffix: ''
steps:
- name: Checkout the repo
uses: actions/checkout@v4
with:
submodules: recursive
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY_OLD }}/driplineorg/dripline-python
${{ env.REGISTRY }}/driplineorg/dripline-python
flavor: |
latest=auto
suffix=${{ matrix.tag-suffix }},onlatest=true
tags: |
type=semver,pattern={{raw}}
type=ref,event=branch
type=ref,event=pr
type=raw,value=latest,enable=${{ github.ref == format('refs/heads{0}', 'main') }}
- name: Docker meta - integration
id: docker_meta_integration
if: ${{ matrix.do-integration }}
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/driplineorg/dripline-python
flavor: |
latest=auto
suffix=${{ matrix.int-tag-suffix }},onlatest=true
tags: |
type=semver,pattern={{raw}}
type=ref,event=branch
type=ref,event=pr
type=raw,value=latest,enable=${{ github.ref == format('refs/heads{0}', 'main') }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: setup_buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY_OLD }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: build_push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name == 'push' }} # limited to develop, main, and tags; don't push on PR
build-args: |
img_user=${{ env.BASE_IMAGE_USER }}
img_repo=${{ env.BASE_IMAGE_REPO }}
img_tag=${{ env.BASE_IMAGE_TAG }}${{ env.DEV_SUFFIX }}
tags: ${{ steps.docker_meta.outputs.tags }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
- name: Build and push - integration
id: build_push_integration
if: ${{ matrix.do-integration }}
uses: docker/build-push-action@v5
with:
context: ./tests/integration
push: ${{ github.event_name == 'push' }} # limited to develop, main, and tags; don't push on PR
build-args: |
img_user=${{ env.REGISTRY }}/driplineorg
img_repo=dripline-python
img_tag=latest-dev
tags: ${{ steps.docker_meta_integration.outputs.tags }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
- name: Release
uses: softprops/action-gh-release@v2
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}