Skip to content

Commit

Permalink
ci: Refinements to build workflows (still failing)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Christie committed Nov 11, 2023
1 parent d80bea6 commit c87dacf
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 61 deletions.
20 changes: 3 additions & 17 deletions .github/workflows/build-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ env:
BE_NAMESPACE: xchem

jobs:
prepare:
build:
runs-on: ubuntu-latest
outputs:
push: ${{ steps.vars.outputs.push }}
Expand Down Expand Up @@ -84,20 +84,6 @@ jobs:
pip install --upgrade pip
pip install poetry==1.7.0
poetry export --without-hashes --without dev --output requirements.txt
- name: Upload compiled requirements
uses: actions/upload-artifact@v3
with:
name: requirements
path: requirements.txt

build-and-push:
needs: prepare
runs-on: ubuntu-latest
steps:
- name: Download requirements
uses: actions/download-artifact@v3
with:
name: requirements
- name: Docker build
uses: docker/build-push-action@v4
with:
Expand All @@ -115,11 +101,11 @@ jobs:
# BE_NAMESPACE: ${{ steps.vars.outputs.BE_NAMESPACE }}
# BE_TAG: ${{ env.GITHUB_REF_SLUG }}
- name: Login to DockerHub
if: ${{needs.prepare.outputs.push}} == 'true'
if: steps.vars.outputs.push == 'true'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push
if: ${{needs.prepare.outputs.push}} == 'true'
if: steps.vars.outputs.push == 'true'
run: docker push ${{ steps.vars.outputs.BE_NAMESPACE }}/fragalysis-backend:${{ env.GITHUB_REF_SLUG }}
72 changes: 29 additions & 43 deletions .github/workflows/build-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,7 @@ env:
STACK_NAMESPACE: xchem

jobs:
prepare:
runs-on: ubuntu-latest
steps:
- 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.11'
- name: Compile requirements.txt
run: |
pip install --upgrade pip
pip install poetry==1.7.0
poetry export --without-hashes --without dev --output requirements.txt
- name: Upload compiled requirements
uses: actions/upload-artifact@v3
with:
name: requirements
path: requirements.txt

build-and-push:
needs: prepare
build:
runs-on: ubuntu-latest
outputs:
push: ${{ steps.vars.outputs.push }}
Expand Down Expand Up @@ -138,10 +113,21 @@ jobs:
# Do we trigger downstream, i.e. is TRIGGER_DOWNSTREAM 'yes'?
echo trigger=${{ env.TRIGGER_DOWNSTREAM == 'yes' }}
echo "trigger=${{ env.TRIGGER_DOWNSTREAM == 'yes' }}" >> $GITHUB_OUTPUT
- name: Download requirements
uses: actions/download-artifact@v3
- 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:
name: requirements
python-version: '3.11'
- name: Compile requirements.txt
run: |
pip install --upgrade pip
pip install poetry==1.7.0
poetry export --without-hashes --without dev --output requirements.txt
- name: Build
uses: docker/build-push-action@v4
with:
Expand All @@ -150,20 +136,20 @@ jobs:
${{ steps.vars.outputs.BE_NAMESPACE }}/fragalysis-backend:${{ steps.vars.outputs.tag }}
${{ steps.vars.outputs.BE_NAMESPACE }}/fragalysis-backend:stable
# - 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: ${{ steps.vars.outputs.tag }}
# - name: Login to DockerHub
# if: steps.vars.outputs.push == 'true'
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# 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: ${{ steps.vars.outputs.tag }}
- 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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ jobs:
# BE_TAG: ${{ steps.vars.outputs.tag }}
- name: Login to DockerHub
if: steps.vars.outputs.push == 'true'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down

0 comments on commit c87dacf

Please sign in to comment.