-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (66 loc) · 2.27 KB
/
ci-release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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/**"
- "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 }}