Skip to content

Commit

Permalink
Merge pull request #12 from cbanek/tickets/DM-30753
Browse files Browse the repository at this point in the history
[DM-30753] TAP SCHEMA publishing
  • Loading branch information
cbanek authored Jun 24, 2021
2 parents 9566c5a + cbbba30 commit 7480de4
Show file tree
Hide file tree
Showing 7 changed files with 470 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

"on": [push]

jobs:
build:
runs-on: ubuntu-latest

# Only do Docker builds of ticket branches and tagged releases.
if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/tickets/')

steps:
- name: Check out repo
uses: actions/checkout@v2

- name: Check out felis
uses: actions/checkout@v2
with:
repository: lsst-dm/felis.git
ref: u/bvan/tap11_fix
path: felis

- name: Install felis
id: felis
run: pip install .
working-directory: ./felis

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Run the build
id: build
run: ./build-all
working-directory: ./tap-schema
3 changes: 3 additions & 0 deletions tap-schema/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM mysql/mysql-server:8.0.13-1.1.8

ADD ./sql/*.sql /docker-entrypoint-initdb.d/
21 changes: 21 additions & 0 deletions tap-schema/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash -ex
ENVIRONMENT="$1"
GIT_TAG=`echo $GITHUB_REF | sed -E 's,refs/(heads|tags)/,,' | sed -E 's,/,-,g'`
shift

# Generate SQL files from Felis yaml files
# Place the SQL files in the sql directory, which gets
# copied into the docker image.
for file in $@
do
felis load-tap --dry-run --engine-url=postgresql+psycopg2:// --tap-schema-name=tap_schema --tap-tables-postfix=11 ../yml/$file > sql/$file.sql
done

# Build and push docker images
docker build . -t lsstsqre/tap-schema-$ENVIRONMENT:$GIT_TAG
docker push lsstsqre/tap-schema-$ENVIRONMENT:$GIT_TAG

# Clean up any untracked files in the sql directory
# between the different runs of this script.
git clean -n
git clean -f sql
6 changes: 6 additions & 0 deletions tap-schema/build-all
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash -ex
./build mock
./build stable dp01_dc2.yaml hsc_gen2.yaml hsc.yaml sdss_stripe82_01.yml wise_00.yml
./build int dp01_dc2.yaml hsc_gen2.yaml hsc.yaml sdss_stripe82_01.yml wise_00.yml
./build idfprod dp01_dc2.yaml hsc_gen2.yaml hsc.yaml sdss_stripe82_01.yml wise_00.yml
./build idfint dp01_dc2.yaml hsc_gen2.yaml hsc.yaml sdss_stripe82_01.yml wise_00.yml
Loading

0 comments on commit 7480de4

Please sign in to comment.