Merge pull request #228 from lsst-dm/tickets/DM-47737 #276
This file contains 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: Release CI | |
"on": | |
push: | |
branches-ignore: | |
# These should always correspond to pull requests, so ignore them for | |
# the push trigger and let them be triggered by the pull_request | |
# trigger, avoiding running the workflow twice. This is a minor | |
# optimization so there's no need to ensure this is comprehensive. | |
- "dependabot/**" | |
- "renovate/**" | |
- "releases/**" | |
- "tickets/**" | |
- "u/**" | |
tags: | |
- "*" | |
pull_request: | |
# Test changes to build process; code changes are handled by build-service.yml | |
paths: | |
- '.github/workflows/ci-release.yaml' | |
- 'Dockerfile' | |
env: | |
IMAGE_NAME: lsst-dm/prompt-service | |
# Base image and tag to run tests against. NOT used in the container build. | |
BASE_TAG: "latest" | |
BASE_IMAGE: ghcr.io/${{ github.repository_owner }}/prompt-base | |
jobs: | |
# Do testing and building in separate jobs to keep total disk usage down | |
test: | |
name: Test service | |
runs-on: ubuntu-latest | |
if: > | |
startsWith(github.ref, 'refs/tags/') | |
|| startsWith(github.head_ref, 'tickets/') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Fix permissions | |
run: chmod -R a+rwX $GITHUB_WORKSPACE | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run tests | |
run: | | |
docker run \ | |
-v $GITHUB_WORKSPACE:/home/lsst/prompt_processing \ | |
"$BASE_IMAGE":"$BASE_TAG" \ | |
bash -c ' | |
cd /home/lsst/prompt_processing | |
source /opt/lsst/software/stack/loadLSST.bash | |
setup -r . | |
# Fix permissions; arg must be absolute path. | |
git config --global --add safe.directory /home/lsst/prompt_processing | |
scons' | |
build: | |
name: Build release image | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: lsst-sqre/build-and-push-to-ghcr@v1 | |
id: build | |
with: | |
image: ${{ env.IMAGE_NAME }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- run: echo Pushed ghcr.io/${{ github.repository }}:${{ steps.build.outputs.tag }} |