-
Notifications
You must be signed in to change notification settings - Fork 17
139 lines (118 loc) · 3.95 KB
/
build.yml
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Build
on:
pull_request:
branches:
- master
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build-windows:
runs-on: windows-2022
steps:
# If this step breaks, try inspecting MSVC directory and consider changing appropriate paths.
#
# ls 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\'
#
# Since windows runner can be updated the version can change in future releases.
- name: Install SQLite3 + generate sqlite3.lib
run: |
choco install sqlite -y
cd C:\ProgramData\chocolatey\lib\SQLite\tools
ls 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\'
& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\bin\Hostx64\x64\lib.exe' /DEF:sqlite3.def /OUT:sqlite3.lib /MACHINE:x64
cp sqlite3.lib 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\lib\x64'
- name: Checkout code
uses: actions/checkout@v3
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: 1.9
- run: shards install --production
- run: crystal build src\cli.cr -o dist\coveralls --release --static --no-debug --progress
- run: |
cd dist
tar -acf coveralls-windows.zip coveralls.exe
- name: Upload exe
uses: actions/upload-artifact@v3
with:
name: coveralls-windows.exe
path: dist/coveralls.exe
if-no-files-found: error
- name: Upload zip
uses: actions/upload-artifact@v3
with:
name: coveralls-windows.zip
path: dist/coveralls-windows.zip
if-no-files-found: error
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: 1.9
- name: Build (Linux)
run: make release_linux
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: coveralls-linux
path: dist/coveralls
if-no-files-found: error
- name: Upload tar.gz
uses: actions/upload-artifact@v3
with:
name: coveralls-linux.tar.gz
path: dist/coveralls-linux.tar.gz
if-no-files-found: error
release:
runs-on: ubuntu-latest
needs: [build-windows, build-linux]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --force --tags
- uses: actions/download-artifact@v3
with:
path: artifacts/
- name: Prepare files for release
run: |
mkdir release/
find artifacts/ -type f -exec cp \{} release/ \;
cd release/
mv coveralls coveralls-linux
mv coveralls.exe coveralls-windows.exe
sha256sum * > coveralls-checksums.txt
- name: Create Github release
env:
TAG: ${{ github.ref }}
GH_TOKEN: ${{ github.token }}
run: >
cd release/;
gh release create ${TAG}
'coveralls-linux#coveralls-linux'
'coveralls-linux.tar.gz#coveralls-linux.tar.gz'
'coveralls-windows.exe#coveralls-windows.exe'
'coveralls-windows.zip#coveralls-windows.zip'
'coveralls-checksums.txt#coveralls-checksums.txt'
--generate-notes
homebrew:
runs-on: ubuntu-latest
needs: [release]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Update Homebrew formula
uses: dawidd6/action-homebrew-bump-formula@v3
with:
tap: coverallsapp/coveralls
formula: coveralls
token: ${{ secrets.HOMEBREW_TOKEN }}