Skip to content

Commit

Permalink
CI: adjusted ROCM and CUDA actions
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Piskun <[email protected]>
  • Loading branch information
bigcat88 committed Aug 21, 2024
1 parent f254e3a commit 5bdd70b
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 8 deletions.
51 changes: 47 additions & 4 deletions .github/workflows/publish-docker-cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,51 @@ jobs:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set app env
run: |
# Split and keep last
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
path: ${{ env.APP_NAME }}

- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
id: versions
# Continue if no package.json
continue-on-error: true
with:
path: ${{ env.APP_NAME }}
fallbackNode: "^20"
fallbackNpm: "^10"

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
# Skip if no package.json
if: ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
# Skip if no package.json
if: ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Build ${{ env.APP_NAME }}
# Skip if no package.json
if: ${{ steps.versions.outputs.nodeVersion }}
run: |
cd ${{ env.APP_NAME }}
npm ci
npm run build
- 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
Expand All @@ -31,6 +74,7 @@ jobs:
- name: Extract version from XML
id: extract_version
run: |
cd ${{ env.APP_NAME }}
VERSION=$(xmlstarlet sel -t -v "//image-tag" appinfo/info.xml)
echo "VERSION=$VERSION" >> $GITHUB_ENV
Expand All @@ -42,9 +86,8 @@ jobs:
uses: docker/build-push-action@v5
with:
push: true
context: .
context: ./${{ env.APP_NAME }}
platforms: linux/amd64
file: Dockerfile
tags: ghcr.io/cloud-py-api/visionatrix:${{ env.VERSION }}-cuda
build-args: |
BUILD_TYPE=cuda
51 changes: 47 additions & 4 deletions .github/workflows/publish-docker-rocm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,51 @@ jobs:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set app env
run: |
# Split and keep last
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
path: ${{ env.APP_NAME }}

- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
id: versions
# Continue if no package.json
continue-on-error: true
with:
path: ${{ env.APP_NAME }}
fallbackNode: "^20"
fallbackNpm: "^10"

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
# Skip if no package.json
if: ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
# Skip if no package.json
if: ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Build ${{ env.APP_NAME }}
# Skip if no package.json
if: ${{ steps.versions.outputs.nodeVersion }}
run: |
cd ${{ env.APP_NAME }}
npm ci
npm run build
- 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
Expand All @@ -31,6 +74,7 @@ jobs:
- name: Extract version from XML
id: extract_version
run: |
cd ${{ env.APP_NAME }}
VERSION=$(xmlstarlet sel -t -v "//image-tag" appinfo/info.xml)
echo "VERSION=$VERSION" >> $GITHUB_ENV
Expand All @@ -42,9 +86,8 @@ jobs:
uses: docker/build-push-action@v5
with:
push: true
context: .
context: ./${{ env.APP_NAME }}
platforms: linux/amd64
file: Dockerfile
tags: ghcr.io/cloud-py-api/visionatrix:${{ env.VERSION }}-rocm
build-args: |
BUILD_TYPE=rocm

0 comments on commit 5bdd70b

Please sign in to comment.