Skip to content

Extend tests to support new components_json field. #145

Extend tests to support new components_json field.

Extend tests to support new components_json field. #145

Workflow file for this run

name: CI
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install tox
run: pip install tox
- name: Cache tox environments
id: cache-tox
uses: actions/cache@v3
with:
path: .tox
# requirements/*.txt, pyproject.toml, and .pre-commit-config.yaml
# have versioning info that would impact the tox environment.
key: tox-${{ hashFiles('requirements/*.txt') }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run tox
run: tox -e lint,py,coverage-report,typing # run tox using Python in path
build:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v3
- name: Define the Docker tag
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF} | sed -E 's,refs/(heads|tags)/,,' | sed -E 's,/,-,g')
- name: Print the tag
id: print
run: echo ${{steps.vars.outputs.tag}}
- name: Log into Docker Hub
run: echo ${{ secrets.DOCKER_TOKEN }} | docker login --username ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Pull previous images
run: |
docker pull lsstsqre/narrativelog:deps-${{steps.vars.outputs.tag}} || true
docker pull lsstsqre/narrativelog:${{steps.vars.outputs.tag}} || true
- name: Build the dependencies Docker image
run: |
docker build --target dependencies-image \
--cache-from=lsstsqre/narrativelog:deps-${{steps.vars.outputs.tag}} \
--tag lsstsqre/narrativelog:deps-${{steps.vars.outputs.tag}} .
- name: Build the runtime Docker image
run: |
docker build --target runtime-image \
--cache-from=lsstsqre/narrativelog:${{steps.vars.outputs.tag}} \
--tag lsstsqre/narrativelog:${{steps.vars.outputs.tag}} .
- name: Push Docker images
run: |
docker push lsstsqre/narrativelog:deps-${{steps.vars.outputs.tag}}
docker push lsstsqre/narrativelog:${{steps.vars.outputs.tag}}