Skip to content

Test CI

Test CI #15

Workflow file for this run

# Cut a release whenever a new tag is pushed to the repo.
# You should use an annotated tag, like `git tag -a v1.2.3`
# and put the release notes into the commit message for the tag.
name: Release
# on:
# push:
# tags:
# - "v*.*.*"
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
matrix:
os:
- ubuntu-22.04
cuda-version:
- 11.6.2
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: bazelbuild/setup-bazelisk@v2
- name: Mount bazel cache
uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: bazel-${{ matrix.os }}-cuda-${{ matrix.cuda-version }}-${{ hashFiles('.bazelversion') }}
- name: Install CUDA (Linux)
uses: Jimver/cuda-toolkit@v0.2.11
with:
cuda: ${{ matrix.cuda-version }}
sub-packages: '["nvcc", "cudart-dev"]'
method: network
- name: bazel test //...
env:
# Bazelisk will download bazel to here
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: bazelisk --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //...
- name: Create rules archive
run: |
PREFIX="rules_cuda-${GITHUB_REF_NAME}"
git archive --format=tar.gz --prefix=${PREFIX}/ ${GITHUB_REF_NAME} -o ${{ github.workspace }}/.github/rules_cuda.tar.gz
echo "ARCHIVE_SHA256=$(shasum -a 256 ${{ github.workspace }}/.github/rules_cuda.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_ENV
echo "RELEASE_VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
# Upload the artifact in case creating a release fails so all artifacts can then be manually recovered.
- uses: actions/upload-artifact@v3
with:
name: "rules_cuda.tar.gz"
path: ${{ github.workspace }}/.github/rules_cuda.tar.gz
if-no-files-found: error
- name: Prepare workspace snippet
run: |
sed 's/{version}/${{ env.RELEASE_VERSION }}/g' ${{ github.workspace }}/.github/release_notes.template \
| sed 's/{archive_sha256}/${{ env.ARCHIVE_SHA256 }}/g' \
> ${{ github.workspace }}/.github/release_notes.txt
- name: Create the release
uses: softprops/action-gh-release@v1
id: rules_cuda_release
with:
prerelease: true
# Use GH feature to populate the changelog automatically
generate_release_notes: true
body_path: ${{ github.workspace }}/.github/release_notes.txt
- name: "Upload the rules archive"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.rules_cuda_release.outputs.upload_url }}
asset_name: rules_cuda-${{ env.RELEASE_VERSION }}.tar.gz
asset_path: ${{ github.workspace }}/.github/rules_cuda.tar.gz
asset_content_type: application/gzip