blob: 8ba527d8e7483a7859ed49a8219ed8a0f5adce05 (
plain)
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
|
name: release_grpc
on:
release: # Docs: <https://help.github.com/en/articles/events-that-trigger-workflows#release-event-release>
types: [ published ]
jobs:
build:
name: Build for ${{ matrix.os }} (${{ matrix.arch }}, ${{ matrix.compiler }})
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
os: [ windows, darwin ] # linux, darwin, windows
compiler: [ gcc ] # gcc, musl-gcc
archiver: [ zip ] # tar, zip
arch: [ amd64 ] # amd64, 386
include:
- os: linux
compiler: gcc
archiver: tar
arch: amd64
- os: linux
compiler: gcc
archiver: tar
arch: arm64
- os: darwin
compiler: gcc
archiver: tar
arch: arm64
- os: ''
compiler: musl-gcc # more info: <https://musl.libc.org/>
archiver: zip
arch: amd64
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17.7
- name: Check out code
uses: actions/checkout@v2
with:
repository: 'roadrunner-server/grpc'
- name: Install musl
if: matrix.compiler == 'musl-gcc'
run: sudo apt-get install -y musl-tools
- name: Download dependencies
run: go mod download
- name: Generate builder values
id: values
run: |
echo "::set-output name=version::`echo ${GITHUB_REF##*/} | sed -e 's/^[vV ]*//'`"
echo "::set-output name=timestamp::`date +%FT%T%z`"
echo "::set-output name=binary-name::protoc-gen-php-grpc`[ ${{ matrix.os }} = 'windows' ] && echo '.exe'`"
- name: Compile binary file
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CC: ${{ matrix.compiler }}
CGO_ENABLED: 0
LDFLAGS: >-
-s
run: |
go build -trimpath -ldflags "$LDFLAGS" -o "./${{ steps.values.outputs.binary-name }}" protoc_plugins/protoc-gen-php-grpc/main.go
stat "./${{ steps.values.outputs.binary-name }}"
- name: Generate distributive directory name
id: dist-dir
run: >
echo "::set-output name=name::protoc-gen-php-grpc-${{ steps.values.outputs.version }}-$(
[ ${{ matrix.os }} != '' ] && echo '${{ matrix.os }}' || echo 'unknown'
)$(
[ ${{ matrix.compiler }} = 'musl-gcc' ] && echo '-musl'
)-${{ matrix.arch }}"
- name: Generate distributive archive name
id: dist-arch
run: >
echo "::set-output name=name::${{ steps.dist-dir.outputs.name }}.$(
case ${{ matrix.archiver }} in
zip) echo 'zip';;
tar) echo 'tar.gz';;
*) exit 10;
esac
)"
- name: Create distributive
run: |
mkdir ${{ steps.dist-dir.outputs.name }}
mv "./${{ steps.values.outputs.binary-name }}" ./${{ steps.dist-dir.outputs.name }}/
- name: Pack distributive using tar
if: matrix.archiver == 'tar'
run: tar -zcf "${{ steps.dist-arch.outputs.name }}" "${{ steps.dist-dir.outputs.name }}"
- name: Pack distributive using zip
if: matrix.archiver == 'zip'
run: zip -r -q "${{ steps.dist-arch.outputs.name }}" "${{ steps.dist-dir.outputs.name }}"
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ steps.dist-dir.outputs.name }}
path: ${{ steps.dist-arch.outputs.name }}
if-no-files-found: error
retention-days: 30
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.dist-arch.outputs.name }}
asset_name: ${{ steps.dist-arch.outputs.name }}
tag: ${{ github.ref }}
|