refactor: move GPU drivers to config and refactor pipelines for CUDA driver #102
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI test build | |
on: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: {} | |
jobs: | |
load_config: | |
runs-on: ubuntu-latest | |
outputs: | |
cuda_version: ${{ steps.set_config.outputs.cuda_version }} | |
grid_version: ${{ steps.set_config.outputs.grid_version }} | |
grid_url: ${{ steps.set_config.outputs.grid_url }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install yq | |
run: | | |
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | |
sudo chmod a+x /usr/local/bin/yq | |
- name: Load config | |
id: set_config | |
run: | | |
CUDA_VERSION=$(yq e '.cuda.version' driver_config.yml) | |
GRID_VERSION=$(yq e '.grid.version' driver_config.yml) | |
GRID_URL=$(yq e '.grid.url' driver_config.yml) | |
echo "CUDA_VERSION=$CUDA_VERSION" | |
echo "GRID_VERSION=$GRID_VERSION" | |
echo "GRID_URL=$GRID_URL" | |
echo "::set-output name=cuda_version::$CUDA_VERSION" | |
echo "::set-output name=grid_version::$GRID_VERSION" | |
echo "::set-output name=grid_url::$GRID_URL" | |
cuda: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
driver_version: ["${{ needs.load_config.outputs.cuda_version }}"] | |
driver_kind: ["cuda"] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- uses: paulhatch/semantic-version@v5.0.0-alpha2 | |
with: | |
bump_each_commit: false | |
version_format: "${{ matrix.driver_kind}}-${{ matrix.driver_version }}-sha-${GITHUB_SHA:0:6}" | |
id: semver | |
- name: 'Check version' | |
run: | | |
echo "version is ${{ steps.semver.outputs.version }}" | |
echo "version is ${{ steps.semver.outputs.version_tag }}" | |
- name: 'Build and Push' | |
run: | | |
set -x | |
echo "tag is: " | |
echo ${{ steps.semver.outputs.version }} | |
docker buildx build --build-arg DRIVER_KIND=${{ matrix.driver_kind }} --build-arg DRIVER_VERSION=${{ matrix.driver_version }} --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache-new --output=type=docker -t ${{ secrets.AZURE_REGISTRY_SERVER }}/public/aks/aks-gpu:${{ steps.semver.outputs.version }} . | |
docker images | |
- name: Move cache | |
run: | | |
rm -r /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
grid535: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
driver_version: ["535.161.08"] | |
driver_kind: ["grid"] | |
driver_url: ["https://download.microsoft.com/download/8/d/a/8da4fb8e-3a9b-4e6a-bc9a-72ff64d7a13c/NVIDIA-Linux-x86_64-535.161.08-grid-azure.run"] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ matrix.driver_kind}}-${{ matrix.driver_version }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ matrix.driver_kind}}-${{ matrix.driver_version }} | |
- uses: paulhatch/semantic-version@v5.0.0-alpha2 | |
with: | |
bump_each_commit: false | |
version_format: "${{ matrix.driver_kind}}-${{ matrix.driver_version }}-sha-${GITHUB_SHA:0:6}" | |
id: semver | |
- name: 'Check version' | |
run: | | |
echo "version is ${{ steps.semver.outputs.version }}" | |
echo "version is ${{ steps.semver.outputs.version_tag }}" | |
- name: 'Build and Push' | |
run: | | |
set -x | |
echo "tag is: " | |
echo ${{ steps.semver.outputs.version }} | |
docker buildx build --build-arg DRIVER_URL=${{ matrix.driver_url }} --build-arg DRIVER_KIND=${{ matrix.driver_kind }} --build-arg DRIVER_VERSION=${{ matrix.driver_version }} --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache-new --output=type=docker -t ${{ secrets.AZURE_REGISTRY_SERVER }}/public/aks/aks-gpu:${{ steps.semver.outputs.version }} . | |
docker images | |
- name: Move cache | |
run: | | |
rm -r /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |