Skip to content

Commit

Permalink
Add a workflow to create release build (#217)
Browse files Browse the repository at this point in the history
This CL setup a workflow to create a release build.

Below is the steps to create a release:
1. submit all changes to master branch
2. create a RELEASE.md file under the root directory, the "RELEASE.md" can be created via github's draft new release text page
3. submit RELEASE.md to master branch
4. create a release tag, a release tag is like "v[0-9]+.[0-9]+.[0-9]+", this can be done locally: git tag <tag_name>
5. push the tag: git push <repo> tag <tag_name>
6. the work flow will be triggered

This workflow can also be manually triggered to create a release for older versions.

The workflow shall be further improved so that we can create the release on the github webpage and let it trigger the release build.

* Add a workflow to create relase build.

* Addressed review comments.

* Use clang/clang++ to build release binaries.
  • Loading branch information
shenhanc78 authored Jul 20, 2024
1 parent 5282585 commit 4765163
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/create-release-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This workflow is to create a release with prebuilt create_llvm_prof binary.
name: Create Release Build

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

# Manual trigger using the Actions page.
workflow_dispatch:

jobs:
build_release:
runs-on: ubuntu-22.04-8core

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
ref: '${{github.ref}}'

- name: Install Dependencies
run: sudo apt-get -y install libunwind-dev libgflags-dev libssl-dev libelf-dev protobuf-compiler libzstd-dev

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DENABLE_TOOL=LLVM -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -S ${{github.workspace}}

- name: Build
# Build your program with the given configuration
run: make -C ${{github.workspace}}/build -j8

- name: Run Tests
run: make -C ${{github.workspace}}/build test

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{github.ref}}
release_name: ${{github.ref_name}}
body_path: "${{github.workspace}}/RELEASE.md"
draft: false
prerelease: false

- name: Create Zip Package
run: |
zip --junk-paths create_llvm_prof-x86_64-${{github.ref_name}}.zip ${{github.workspace}}/build/create_llvm_prof
- name: Upload Release Asset
id: upload_release_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: create_llvm_prof-x86_64-${{github.ref_name}}.zip
asset_name: create_llvm_prof-x86_64-${{github.ref_name}}.zip
asset_content_type: application/zip

0 comments on commit 4765163

Please sign in to comment.