-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (62 loc) · 2.02 KB
/
test_and_build_cache.yml
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
name: cache dependencies, test, and build
on:
push:
branches:
- tickets/DM-45476
tags:
- v*
pull_request:
env:
PROGRAM_NAME: transfer-embargo
EUPS_DISTRIB_VERSION: "w_2024_32"
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/conda/
key: ${{ runner.os }}-eups-${{ env.EUPS_DISTRIB_VERSION }}-${{ hashFiles('**/*.txt') }}
- name: Install dependencies
run: |
curl -OL https://ls.st/lsstinstall
chmod u+x lsstinstall
./lsstinstall -T ${{ env.EUPS_DISTRIB_VERSION }}
source loadLSST.sh
eups distrib install -t ${{ env.EUPS_DISTRIB_VERSION }} obs_lsst
curl -sSL https://raw.githubusercontent.com/lsst/shebangtron/main/shebangtron | python
- name: Run tests
run: |
source loadLSST.sh
setup obs_lsst
cd ./tests
pytest test_move_embargo_args.py
build:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: docker build
run: |
docker build . \
--tag $PROGRAM_NAME
- name: Log in to Github container registry
run: echo "${{ secrets.GITHUB_TOKEN }}" |docker login ghcr.io -u $ --password-stdin
- name: Push images
run: |
PROGRAM_ID=ghcr.io/${{ github.repository_owner }}/$PROGRAM_NAME
if [[ "${{ github.ref }}" == "refs/pull/"* ]]; then
VERSION=$(echo "${{ github.head_ref }}" | sed -e 's|.*/||')
elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
VERSION=$(echo "${{ github.ref_name }}" | sed -e 's|^v||')
else
VERSION=latest
fi
echo VERSION=$VERSION
echo PROGRAM_ID=$PROGRAM_ID
docker tag $PROGRAM_NAME $PROGRAM_ID:$VERSION
docker push $PROGRAM_ID:$VERSION