Skip to content

Tickets/dm 41033 Use a configurable list of dataset types #85

Tickets/dm 41033 Use a configurable list of dataset types

Tickets/dm 41033 Use a configurable list of dataset types #85

name: cache dependencies, test, and build
on:
push:
branches:
tags:
- v*
pull_request:
env:
PROGRAM_NAME: transfer-embargo
EUPS_DISTRIB_VERSION: "w_2024_16"
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 }}/eups/
key: ${{ runner.os }}-eups-${{ env.EUPS_DISTRIB_VERSION }}-${{ hashFiles('**/*.txt') }}
restore-keys: ${{ runner.os }}-eups-
- 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
- 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