-
-
Notifications
You must be signed in to change notification settings - Fork 42
74 lines (72 loc) · 2.93 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# 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.8.0
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: bazelbuild/setup-bazelisk@v3
- name: Mount bazel cache
uses: actions/cache@v4
with:
path: ~/.cache/bazel
key: bazel-${{ matrix.os }}-cuda-${{ matrix.cuda-version }}-${{ hashFiles('.bazelversion') }}
- name: Install CUDA (Linux)
uses: Jimver/cuda-toolkit@v0.2.18
with:
cuda: ${{ matrix.cuda-version }}
sub-packages: '["nvcc", "cudart-dev"]'
method: network
- name: bazel test //...
env:
# Bazelisk will download bazel to here, ensure it is cached within tests.
XDG_CACHE_HOME: /home/runner/.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@v4
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@v2
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