1
1
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 }}
3
18
4
19
jobs :
5
20
ubuntu-latest-make :
6
21
runs-on : ubuntu-latest
7
22
8
23
steps :
9
24
- name : Clone
25
+ id : checkout
10
26
uses : actions/checkout@v1
11
27
12
28
- name : Dependencies
29
+ id : depends
13
30
run : |
14
31
sudo apt-get update
15
32
sudo apt-get install build-essential
16
33
17
34
- name : Build
35
+ id : make_build
18
36
run : |
19
37
make
20
38
@@ -42,13 +60,16 @@ jobs:
42
60
43
61
steps :
44
62
- name : Clone
63
+ id : checkout
45
64
uses : actions/checkout@v1
46
65
47
66
- name : Dependencies
67
+ id : depends
48
68
run : |
49
69
brew update
50
70
51
71
- name : Build
72
+ id : make_build
52
73
run : |
53
74
make
54
75
@@ -75,15 +96,49 @@ jobs:
75
96
76
97
steps :
77
98
- name : Clone
99
+ id : checkout
78
100
uses : actions/checkout@v1
79
101
80
102
- name : Build
103
+ id : cmake_build
81
104
run : |
82
105
mkdir build
83
106
cd build
84
107
cmake ..
85
108
cmake --build . --config Release
86
109
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
+
87
142
# ubuntu-latest-gcc:
88
143
# runs-on: ubuntu-latest
89
144
#
0 commit comments