Skip to content

Commit

Permalink
fix docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizhang committed Apr 1, 2024
1 parent 0537207 commit 5c71b22
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
21 changes: 10 additions & 11 deletions .github/actions/build-docker-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,24 @@ inputs:
description: 'SnapATAC2 version to be installed'
required: true
type: string

python-version:
required: false
default: "python:3.11-slim"

default: "3.11"
flavor:
required: false
default: "default"
username:
required: true
password:
required: true

runs:
using: "composite"
steps:
# This makes some assumptions about `base-docker-image` name format so be sure to test this out if
# things change. For `python:3.11-slim` this should result in `PY_VER_ABBRV=py3.11` beings saved to $GITHUB_ENV
# See: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
- name: Get python version shorthand
run: echo "PY_VER_ABBRV=py$(echo ${{ matrix.base-docker-image }} | cut -d ":" -f 2 | cut -d "-" -f 1)" >> $GITHUB_ENV
# Should result in something like: `IMAGE_TAG=2.5.1-default-py3.11` or `IMAGE_TAG=2.5.1-recommend-interactive-py3.11`
- name: Create Docker image tag
run: echo "IMAGE_TAG=${{ inputs.snapatac2-version }}-${{ inputs.flavor }}-${{ inputs.python-version }}" >> $GITHUB_ENV
run: echo "IMAGE_TAG=${{ inputs.snapatac2-version }}-${{ inputs.flavor }}-py${{ inputs.python-version }}" >> $GITHUB_ENV
shell: bash

- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -58,6 +56,7 @@ runs:
# Mount the Github Workspace (repository root) into our test container
# Then install test required packages and run SnapATAC2 Python tests
- name: Test Docker Image
shell: bash
run: |
docker run --rm -t \
--entrypoint /bin/bash \
Expand All @@ -68,8 +67,8 @@ runs:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.dockerhub_username }}
password: ${{ secrets.dockerhub_token }}
username: ${{ inputs.username }}
password: ${{ inputs.password }}

# Uses cached result from first build
- name: Push to Docker Hub
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ jobs:
with:
snapatac2-version: ${{ steps.get-version.outputs.VERSION_NUMBER }}
python-version: 3.11
username: ${{ secrets.dockerhub_username }}
password: ${{ secrets.dockerhub_token }}

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
Expand Down

0 comments on commit 5c71b22

Please sign in to comment.