Publish CUDA release #29
Workflow file for this run
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
# Publish new release of tfhe-cuda-backend on crates.io. | |
name: Publish CUDA release | |
on: | |
workflow_dispatch: | |
inputs: | |
dry_run: | |
description: "Dry-run" | |
type: boolean | |
default: true | |
push_to_crates: | |
description: "Push to crate" | |
type: boolean | |
default: true | |
env: | |
ACTION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} | |
SLACK_ICON: https://pbs.twimg.com/profile_images/1274014582265298945/OjBKP9kn_400x400.png | |
SLACK_USERNAME: ${{ secrets.BOT_USERNAME }} | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
jobs: | |
setup-instance: | |
name: Setup instance (publish-cuda-release) | |
runs-on: ubuntu-latest | |
outputs: | |
runner-name: ${{ steps.start-instance.outputs.label }} | |
steps: | |
- name: Start instance | |
id: start-instance | |
uses: zama-ai/slab-github-runner@c0e7168795bd78f61f61146951ed9d0c73c9b701 | |
with: | |
mode: start | |
github-token: ${{ secrets.SLAB_ACTION_TOKEN }} | |
slab-url: ${{ secrets.SLAB_BASE_URL }} | |
job-secret: ${{ secrets.JOB_SECRET }} | |
backend: aws | |
profile: gpu-build | |
publish-cuda-release: | |
name: Publish CUDA Release | |
needs: setup-instance | |
runs-on: ${{ needs.setup-instance.outputs.runner-name }} | |
strategy: | |
fail-fast: false | |
# explicit include-based build matrix, of known valid options | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
cuda: "12.2" | |
gcc: 9 | |
env: | |
CUDA_PATH: /usr/local/cuda-${{ matrix.cuda }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
with: | |
fetch-depth: 0 | |
- name: Set up home | |
run: | | |
echo "HOME=/home/ubuntu" >> "${GITHUB_ENV}" | |
- name: Install latest stable | |
uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a | |
with: | |
toolchain: stable | |
- name: Export CUDA variables | |
if: ${{ !cancelled() }} | |
run: | | |
echo "$CUDA_PATH/bin" >> "${GITHUB_PATH}" | |
{ | |
echo "CUDA_PATH=$CUDA_PATH"; | |
echo "LD_LIBRARY_PATH=$CUDA_PATH/lib:$LD_LIBRARY_PATH"; | |
echo "CUDACXX=/usr/local/cuda-${{ matrix.cuda }}/bin/nvcc"; | |
} >> "${GITHUB_ENV}" | |
# Specify the correct host compilers | |
- name: Export gcc and g++ variables | |
if: ${{ !cancelled() }} | |
run: | | |
{ | |
echo "CC=/usr/bin/gcc-${{ matrix.gcc }}"; | |
echo "CXX=/usr/bin/g++-${{ matrix.gcc }}"; | |
echo "CUDAHOSTCXX=/usr/bin/g++-${{ matrix.gcc }}"; | |
echo "HOME=/home/ubuntu"; | |
} >> "${GITHUB_ENV}" | |
- name: Publish crate.io package | |
if: ${{ inputs.push_to_crates }} | |
env: | |
CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
DRY_RUN: ${{ inputs.dry_run && '--dry-run' || '' }} | |
run: | | |
cargo publish -p tfhe-cuda-backend --token ${{ env.CRATES_TOKEN }} ${{ env.DRY_RUN }} | |
- name: Slack Notification | |
if: ${{ failure() }} | |
continue-on-error: true | |
uses: rtCamp/action-slack-notify@4e5fb42d249be6a45a298f3c9543b111b02f7907 | |
env: | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_MESSAGE: "tfhe-cuda-backend release finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})" | |
teardown-instance: | |
name: Teardown instance (publish-release) | |
if: ${{ always() && needs.setup-instance.result != 'skipped' }} | |
needs: [ setup-instance, publish-cuda-release ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Stop instance | |
id: stop-instance | |
uses: zama-ai/slab-github-runner@c0e7168795bd78f61f61146951ed9d0c73c9b701 | |
with: | |
mode: stop | |
github-token: ${{ secrets.SLAB_ACTION_TOKEN }} | |
slab-url: ${{ secrets.SLAB_BASE_URL }} | |
job-secret: ${{ secrets.JOB_SECRET }} | |
label: ${{ needs.setup-instance.outputs.runner-name }} | |
- name: Slack Notification | |
if: ${{ failure() }} | |
continue-on-error: true | |
uses: rtCamp/action-slack-notify@4e5fb42d249be6a45a298f3c9543b111b02f7907 | |
env: | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_MESSAGE: "Instance teardown (publish-cuda-release) finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})" |