Skip to content

fix: Adds missing sub-path in JobnFileTransfer (and updates Python ve… #299

fix: Adds missing sub-path in JobnFileTransfer (and updates Python ve…

fix: Adds missing sub-path in JobnFileTransfer (and updates Python ve… #299

Workflow file for this run

---
name: build dev
# Actions that take place after every commit to 'dev' branches
# Anything that's not staging or production.
#
# If a DOCKERHUB_USERNAME secret is defined the image is pushed.
# ---------------
# Control secrets
# ---------------
#
# At the GitHub 'organisation' or 'project' level you are expected to
# have the following GitHub 'Repository Secrets' defined
# (i.e. via 'Settings -> Secrets'): -
#
# BE_NAMESPACE optional - default xchem
#
# DOCKERHUB_USERNAME optional
# DOCKERHUB_TOKEN optional - required if DOCKERHUB_USERNAME
#
# -----------
# Environment (GitHub Environments)
# -----------
#
# (none)
on:
push:
branches-ignore:
- 'staging'
- 'production'
tags-ignore:
- '**'
env:
# The following 'defaults' are used in the 'Initialise workflow variables' step,
# which creates 'outputs' for use in steps and jobs that follow it.
# The values set here are used unless a matching secret is found.
# Secrets are the way users dynamically control the behaviour of this Action.
#
# For Jobs conditional on the presence of a secret see this Gist...
# https://gist.github.com/jonico/24ffebee6d2fa2e679389fac8aef50a3
BE_NAMESPACE: xchem
jobs:
build:
runs-on: ubuntu-latest
outputs:
push: ${{ steps.vars.outputs.push }}
steps:
- name: Inject slug/short variables
uses: rlespinasse/[email protected]
- name: Initialise workflow variables
id: vars
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
TRIGGER_DOWNSTREAM: ${{ secrets.TRIGGER_DOWNSTREAM }}
run: |
# BE_NAMESPACE
BE_NAMESPACE="${{ env.BE_NAMESPACE }}"
if [ -n "${{ secrets.BE_NAMESPACE }}" ]; then BE_NAMESPACE="${{ secrets.BE_NAMESPACE }}"; fi
echo BE_NAMESPACE=${BE_NAMESPACE}
echo "BE_NAMESPACE=${BE_NAMESPACE}" >> $GITHUB_OUTPUT
# Do we push, i.e. is DOCKERHUB_USERNAME defined?
echo push=${{ env.DOCKERHUB_USERNAME != '' }}
echo "push=${{ env.DOCKERHUB_USERNAME != '' }}" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v3
- name: Lint Dockerfile
uses: hadolint/[email protected]
with:
dockerfile: Dockerfile
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Compile requirements.txt
run: |
pip install --upgrade pip
pip install poetry==1.5.1
poetry export --without-hashes --without dev --output requirements.txt
- name: Build
uses: docker/build-push-action@v4
with:
context: .
tags: ${{ steps.vars.outputs.BE_NAMESPACE }}/fragalysis-backend:${{ env.GITHUB_REF_SLUG }}
# DEVELOPER TESTING DISABLED UNTIL MODEL-REFACTORING IS COMPLETE
#
# - name: Test
# run: >
# docker-compose -f docker-compose.test.yml up
# --build
# --exit-code-from tests
# --abort-on-container-exit
# env:
# BE_NAMESPACE: ${{ steps.vars.outputs.BE_NAMESPACE }}
# BE_TAG: ${{ env.GITHUB_REF_SLUG }}
- name: Login to DockerHub
if: steps.vars.outputs.push == 'true'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push
if: steps.vars.outputs.push == 'true'
run: docker push ${{ steps.vars.outputs.BE_NAMESPACE }}/fragalysis-backend:${{ env.GITHUB_REF_SLUG }}