Merge pull request #719 from sandialabs/fix/issue-718 #2085
This file contains hidden or 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
| name: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| # Add SHA tags safely for both branches and PRs without generating an invalid leading '-' | |
| type=sha,enable=true,prefix=${{ github.ref_name }}- | |
| type=sha,enable=${{ github.event_name == 'pull_request' }},prefix=pr- | |
| type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | |
| - name: Build test Docker image (debug mode) | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ./Dockerfile-test | |
| load: true | |
| tags: test-image-debug:latest | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - name: Run tests in debug mode | |
| run: | | |
| echo "Running tests in debug mode (DEBUG_MODE=true)" | |
| docker run --rm --workdir /app test-image-debug:latest bash /app/test/run_tests.sh all | |
| - name: Build test Docker image (production mode) | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ./Dockerfile-test | |
| build-args: | | |
| DEBUG_MODE=false | |
| load: true | |
| tags: test-image-prod:latest | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - name: Run tests in production mode | |
| run: | | |
| echo "Running tests in production mode (DEBUG_MODE=false)" | |
| docker run --rm --workdir /app test-image-prod:latest bash /app/test/run_tests.sh all | |
| - name: Get build metadata | |
| id: build_meta | |
| run: | | |
| echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| echo "version=$(grep '^VERSION' atlas/version.py | cut -d'"' -f2)" >> $GITHUB_OUTPUT | |
| - name: Build production Docker image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| load: true | |
| build-args: | | |
| VITE_APP_NAME=ATLAS | |
| VITE_FEATURE_ANIMATED_LOGO=true | |
| VITE_FEATURE_POWERED_BY_ATLAS=false | |
| VITE_FEATURE_RAG_CITATIONS=false | |
| GIT_HASH=${{ steps.build_meta.outputs.sha_short }} | |
| APP_VERSION=${{ steps.build_meta.outputs.version }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - name: Build runtime-only Docker image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ./Dockerfile.runtimeonly | |
| load: true | |
| build-args: | | |
| VITE_APP_NAME=ATLAS | |
| VITE_FEATURE_ANIMATED_LOGO=true | |
| VITE_FEATURE_POWERED_BY_ATLAS=false | |
| VITE_FEATURE_RAG_CITATIONS=false | |
| GIT_HASH=${{ steps.build_meta.outputs.sha_short }} | |
| APP_VERSION=${{ steps.build_meta.outputs.version }} | |
| tags: runtime-only-image:latest | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - name: Push production Docker image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| push: true | |
| build-args: | | |
| VITE_APP_NAME=ATLAS | |
| VITE_FEATURE_ANIMATED_LOGO=true | |
| VITE_FEATURE_POWERED_BY_ATLAS=false | |
| VITE_FEATURE_RAG_CITATIONS=false | |
| GIT_HASH=${{ steps.build_meta.outputs.sha_short }} | |
| APP_VERSION=${{ steps.build_meta.outputs.version }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |