Skip to content

Commit

Permalink
Workflow update (#78)
Browse files Browse the repository at this point in the history
* added pip install --requirement since it is was removed from bin/bootstrap.sh

* need to build image on latest Dockerfile before running tests

* need to build image on latest Dockerfile before running tests

* need github sha like this

* trying to reorder to see if I can access git

* just going to cut the sha manually using cut

* loading version from file before install

* version file will not be there if run as Github Action

* Updating actions versions
  • Loading branch information
crosenth authored Jul 1, 2024
1 parent b7c0d20 commit 917d9c9
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ jobs:
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v6
with:
push: true
tags: |
Expand Down
38 changes: 30 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,40 @@
name: Run deenurp tests on deenurp image

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
on: push

jobs:
build:
dev_image:
environment: docker_build
runs-on: ubuntu-latest
outputs:
sha_short: ${{ env.sha_short }}
steps:
-
name: Set env
run: echo "sha_short=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ghcr.io/fhcrc/deenurp:${{ env.sha_short }}
test:
needs: [dev_image]
runs-on: ubuntu-latest
container:
image: ghcr.io/fhcrc/deenurp:latest
image: ghcr.io/fhcrc/deenurp:${{ needs.dev_image.outputs.sha_short }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: |
python3 -m deenurp.test
tests/run.sh
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ COPY deenurp.py setup.py requirements.txt /usr/local/share/deenurp/
RUN cd /usr/local/share/deenurp/ && \
PYTHON=/usr/local/bin/python3 \
DEENURP=/usr/local/share/deenurp/ \
bin/bootstrap.sh /usr/local/
bin/bootstrap.sh /usr/local/ \
pip install --upgrade --requirement requirements.txt

# clean up sources apt packages
RUN rm -rf /var/lib/apt/lists/* && \
Expand Down
10 changes: 7 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
f'|| rm -f {version_file}.tmp'),
shell=True, stderr=open(os.devnull, "w"))

# import must follow 'git describe' command above to update version
from deenurp import __version__
try:
with open(version_file) as f:
version = f.read().strip().lstrip('v').replace(
'-', '+', 1).replace('-', '.')
except Exception as e:
version = ''


class CheckVersion(Command):
Expand Down Expand Up @@ -77,7 +81,7 @@ def run(self):

setup(
name='deenurp',
version=__version__,
version=version,
package_data={'deenurp': ['data/*', 'test/data/*']},
entry_points={
'console_scripts': {'deenurp = deenurp:main'}},
Expand Down

0 comments on commit 917d9c9

Please sign in to comment.