Skip to content

Commit b2de7f1

Browse files
authored
CI Improvements (abetlen#230)
* CI Improvements Manual build feature, autoreleases for Windows * better CI naming convention use branch name in releases and tags
1 parent a292747 commit b2de7f1

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

.github/workflows/build.yml

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,38 @@
11
name: CI
2-
on: [push, pull_request]
2+
3+
on:
4+
workflow_dispatch: # allows manual triggering
5+
inputs:
6+
create_release:
7+
description: 'Create new release'
8+
required: true
9+
type: boolean
10+
push:
11+
paths: ['.github/workflows/**', 'CMakeLists.txt', 'Makefile', '**.h', '*.c', '**.cpp']
12+
pull_request:
13+
types: [opened, synchronize, edited, reopened, review_requested, ready_for_review]
14+
paths: ['CMakeLists.txt', 'Makefile', '**.h', '*.c', '**.cpp']
15+
16+
env:
17+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
318

419
jobs:
520
ubuntu-latest-make:
621
runs-on: ubuntu-latest
722

823
steps:
924
- name: Clone
25+
id: checkout
1026
uses: actions/checkout@v1
1127

1228
- name: Dependencies
29+
id: depends
1330
run: |
1431
sudo apt-get update
1532
sudo apt-get install build-essential
1633
1734
- name: Build
35+
id: make_build
1836
run: |
1937
make
2038
@@ -42,13 +60,16 @@ jobs:
4260

4361
steps:
4462
- name: Clone
63+
id: checkout
4564
uses: actions/checkout@v1
4665

4766
- name: Dependencies
67+
id: depends
4868
run: |
4969
brew update
5070
5171
- name: Build
72+
id: make_build
5273
run: |
5374
make
5475
@@ -75,15 +96,49 @@ jobs:
7596

7697
steps:
7798
- name: Clone
99+
id: checkout
78100
uses: actions/checkout@v1
79101

80102
- name: Build
103+
id: cmake_build
81104
run: |
82105
mkdir build
83106
cd build
84107
cmake ..
85108
cmake --build . --config Release
86109
110+
- name: Get commit hash
111+
id: commit
112+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
113+
uses: pr-mpt/actions-commit-hash@v2
114+
115+
- name: Pack artifacts
116+
id: pack_artifacts
117+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
118+
run: |
119+
7z a llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-x64.zip .\build\Release\*
120+
121+
- name: Create release
122+
id: create_release
123+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
124+
uses: zendesk/action-create-release@v1
125+
env:
126+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127+
with:
128+
tag_name: ${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}
129+
130+
- name: Upload release
131+
id: upload_release
132+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
133+
uses: actions/upload-release-asset@v1
134+
env:
135+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
136+
with:
137+
upload_url: ${{ steps.create_release.outputs.upload_url }}
138+
asset_path: .\llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-x64.zip
139+
asset_name: llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-x64.zip
140+
asset_content_type: application/octet-stream
141+
87142
# ubuntu-latest-gcc:
88143
# runs-on: ubuntu-latest
89144
#

0 commit comments

Comments
 (0)