Skip to content

Commit

Permalink
CI to publish images and fix for CUDA/ROCM detection
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Piskun <[email protected]>
  • Loading branch information
bigcat88 committed Jul 30, 2024
1 parent 3756297 commit 51d7629
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 170 deletions.
167 changes: 0 additions & 167 deletions .github/workflows/appstore-build-publish.yml

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/publish-docker-cpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish CPU Image

on:
workflow_dispatch:

jobs:
push_to_registry:
name: Build image
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'cloud-py-api' }} # REPLACE THIS WITH YOUR ORGANIZATION NAME
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: Install xmlstarlet
run: sudo apt-get update && sudo apt-get install -y xmlstarlet

- name: Extract version from XML
id: extract_version
run: |
VERSION=$(xmlstarlet sel -t -v "//image-tag" appinfo/info.xml)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Log version
run: |
echo "Extracted version: ${{ env.VERSION }}"
- name: Build container image
uses: docker/build-push-action@v5
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
file: Dockerfile
tags: ghcr.io/${{ github.repository }}:${{ env.VERSION }}
build-args: |
BUILD_TYPE=cpu
50 changes: 50 additions & 0 deletions .github/workflows/publish-docker-cuda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish CUDA Image

on:
workflow_dispatch:

jobs:
push_to_registry:
name: Build image
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'cloud-py-api' }} # REPLACE THIS WITH YOUR ORGANIZATION NAME
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: Install xmlstarlet
run: sudo apt-get update && sudo apt-get install -y xmlstarlet

- name: Extract version from XML
id: extract_version
run: |
VERSION=$(xmlstarlet sel -t -v "//image-tag" appinfo/info.xml)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Log version
run: |
echo "Extracted version: ${{ env.VERSION }}"
- name: Build container image
uses: docker/build-push-action@v5
with:
push: true
context: .
platforms: linux/amd64
file: Dockerfile
tags: ghcr.io/${{ github.repository }}-cuda:${{ env.VERSION }}
build-args: |
BUILD_TYPE=cuda
50 changes: 50 additions & 0 deletions .github/workflows/publish-docker-rocm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish ROCM Image

on:
workflow_dispatch:

jobs:
push_to_registry:
name: Build image
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'cloud-py-api' }} # REPLACE THIS WITH YOUR ORGANIZATION NAME
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: Install xmlstarlet
run: sudo apt-get update && sudo apt-get install -y xmlstarlet

- name: Extract version from XML
id: extract_version
run: |
VERSION=$(xmlstarlet sel -t -v "//image-tag" appinfo/info.xml)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Log version
run: |
echo "Extracted version: ${{ env.VERSION }}"
- name: Build container image
uses: docker/build-push-action@v5
with:
push: true
context: .
platforms: linux/amd64
file: Dockerfile
tags: ghcr.io/${{ github.repository }}-rocm:${{ env.VERSION }}
build-args: |
BUILD_TYPE=cuda
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ repos:
files: lib/

- repo: https://github.com/psf/black
rev: 24.4.0
rev: 24.4.2
hooks:
- id: black
files: lib/

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.7
rev: v0.5.5
hooks:
- id: ruff
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nc_py_api[app]>=0.12.0
nc_py_api[app]>=0.15.1

0 comments on commit 51d7629

Please sign in to comment.