Skip to content

Commit

Permalink
updated CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandip117 committed Oct 3, 2024
1 parent cf4ddd7 commit 5652025
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 39 deletions.
63 changes: 26 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# https://github.com/FNNDSC/cookiecutter-chrisapp/wiki/Automatic-Builds
#
# - targeted platforms: x86_64, PowerPC64, ARM64
# - master is built as fnndsc/pl-simpledsapp:latest
# - tagged commits are built as fnndsc/pl-simpledsapp:<tag>
# - master is built as fnndsc/pl-markimg:latest
# - tagged commits are built as fnndsc/pl-markimg:<tag>
# - tagged commits are also uploaded to chrisstore.co
#
# In order to use this workflow, see
Expand All @@ -18,12 +18,11 @@ on:
tags: [ '**' ]
pull_request:
branches: [ master, main, trunk ]
release:
types: [ created ]

jobs:
test:
runs-on: ubuntu-20.04
if: false
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: build
Expand All @@ -33,7 +32,7 @@ jobs:

publish:
if: github.event_name == 'push' || github.event_name == 'release'
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

# we want to both push the build to DockerHub, but also
# keep a local copy so that we can run
Expand Down Expand Up @@ -90,9 +89,9 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand All @@ -108,7 +107,7 @@ jobs:
${{ steps.determine.outputs.dock_image }}
localhost:5000/${{ steps.determine.outputs.dock_image }}
ghcr.io/${{ steps.determine.outputs.dock_image }}
platforms: linux/amd64,linux/ppc64le,linux/arm64
platforms: linux/amd64
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
Expand All @@ -121,11 +120,16 @@ jobs:
docker pull localhost:5000/$dock_image
docker tag localhost:5000/$dock_image $dock_image
script=$(docker inspect --format '{{ (index .Config.Cmd 0) }}' $dock_image)
docker run --rm $dock_image $script --json \
| jq '. += {"name":"pl-simpledsapp", "dock_image": "'$dock_image'", "public_repo": "'${{ github.server_url }}/${{ github.repository }}'" }' \
> /tmp/description.json
json="$(docker run --rm $dock_image $script --json)"
jq <<< "$json" # pretty print in log
# Escape single quotes
json_escaped=$(echo "$json" | sed "s/'/\\'/g")
echo "::set-output name=json::$json"
echo "::set-output name=title::$(jq -r '.title' <<< "$json")"
jq <<< "$json" # pretty print in log
echo "json=$json_escaped" >> $GITHUB_OUTPUT
echo "title=$(jq -r '.title' <<< "$json")" >> $GITHUB_OUTPUT
- name: Update DockerHub description
uses: peter-evans/dockerhub-description@v2
Expand All @@ -137,28 +141,13 @@ jobs:
readme-filepath: ./README.rst
repository: ${{ steps.determine.outputs.repo }}

- name: Upload to ChRIS Store
if: "!endsWith(steps.determine.outputs.dock_image, ':latest')"
run: |
repo=${{ steps.determine.outputs.repo }}
dock_image=${{ steps.determine.outputs.dock_image }}
descriptor_file=$(mktemp --suffix .json)
cat > $descriptor_file <<< '${{ steps.pluginmeta.outputs.json }}'
res=$(
curl -s -u "${{ secrets.CHRIS_STORE_USER }}" "https://chrisstore.co/api/v1/plugins/" \
-F "name=$(sed 's/^.*\///' <<< $repo)" \
-F "dock_image=$dock_image" \
-F "descriptor_file=@$descriptor_file" \
-F "public_repo=https://github.com/${{ github.repository }}"
)
success=$?
if [ "$success" = "0" ]; then
href="$(jq -r '.collection.items[0].href' <<< "$res")"
echo $href
echo "::set-output name=pluginurl::$href"
else
echo "::error ::Failed upload to ChRIS Store"
echo "$res"
exit $success
fi
- name: Upload ChRIS Plugin
id: upload
if: github.ref_type == 'tag'
uses: FNNDSC/upload-chris-plugin@main
with:
description_file: /tmp/description.json
username: ${{ secrets.CHRISPROJECT_USERNAME }}
password: ${{ secrets.CHRISPROJECT_PASSWORD }}
chris_url: https://cube.chrisproject.org/api/v1/
compute_names: NERC
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

setup(
name = 'simpledsapp',
version = '2.1.3',
version = '2.1.4',
description = 'A simple ChRIS ds app demo',
long_description = readme,
author = 'FNNDSC',
author_email = '[email protected]',
url = 'http://wiki',
url = 'https://github.com/FNNDSC/pl-simpledsapp#readme',
packages = ['simpledsapp'],
install_requires = ['chrisapp'],
test_suite = 'nose.collector',
Expand Down

0 comments on commit 5652025

Please sign in to comment.