Skip to content

Initial commit

Initial commit #1

name: CD | Build-Test-Release
on:
push:
branches:
- "main"
release:
types: [published]
workflow_dispatch:
inputs:
image_tag:
description: "Docker Image Tag"
required: false
default: "dev"
jobs:
docker-build:
runs-on: DO
# DO is a custom runner deployed on DigitalOcean, only available for workflows under the runpod-workers organization.
# If you would like to use this workflow, you can replace DO with ubuntu-latest or any other runner.
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Build and push step
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ vars.DOCKERHUB_REPO }}/${{ vars.DOCKERHUB_IMG }}:${{ (github.event_name == 'release' && github.event.release.tag_name) || (github.event_name == 'workflow_dispatch' && github.event.inputs.image_tag) || 'dev' }}
dev-test:
needs: docker-build
runs-on: ubuntu-latest
steps:
# Checkout
- uses: actions/checkout@v4
# Tests
- name: Run Tests
if: github.event_name != 'release'
id: run-tests
uses: direlines/[email protected]
with:
image-tag: ${{ vars.DOCKERHUB_REPO }}/${{ vars.DOCKERHUB_IMG }}:${{ (github.event_name == 'release' && github.event.release.tag_name) || (github.event_name == 'workflow_dispatch' && github.event.inputs.image_tag) || 'dev' }}
runpod-api-key: ${{ secrets.RUNPOD_API_KEY }}
request-timeout: 600
# Pass/Fail
- name: Verify Tests
env:
TOTAL_TESTS: ${{ steps.run-tests.outputs.total-tests }}
SUCCESSFUL_TESTS: ${{ steps.run-tests.outputs.succeeded }}
RESULTS: ${{ steps.run-tests.outputs.results }}
run: |
echo "Total tests: $TOTAL_TESTS"
echo "Successful tests: $SUCCESSFUL_TESTS"
echo "Full results: $RESULTS"
if [ "$TOTAL_TESTS" != "$SUCCESSFUL_TESTS" ]; then
exit 1
fi