-
Notifications
You must be signed in to change notification settings - Fork 2
162 lines (142 loc) · 4.54 KB
/
server.yml
File metadata and controls
162 lines (142 loc) · 4.54 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Server
on:
workflow_dispatch:
workflow_call:
inputs:
version:
type: string
description: "Version for the build, without v prefix"
required: false
jobs:
lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./server
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Installing dependencies
uses: ./.github/actions/install
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.64
args: --timeout=3m
working-directory: ./server
- name: Install gofumpt
run: go install mvdan.cc/gofumpt@v0.7.0
- name: Run gofumpt
run: |
ERRORS=$(gofumpt -l . | wc -l)
if [[ "$ERRORS" != "0" ]]; then
echo "following files are not gofumpted:"
gofumpt -l .
exit 1
fi
test:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./server
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Installing dependencies
uses: ./.github/actions/install
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run unit tests
run: go test ./...
build:
name: Build server
strategy:
matrix:
include:
- os: ubuntu-24.04
arch: amd64
target: windows
ext: .exe
- os: ubuntu-24.04
arch: amd64
target: linux
- os: ubuntu-24.04
arch: arm64
target: linux
- os: macos-15
arch: amd64
target: darwin
- os: macos-15
arch: arm64
target: darwin
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./server
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Installing dependencies
uses: ./.github/actions/install
with:
os: ${{ matrix.os }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check if VERSION exists
shell: bash
id: check_version
run: |
if [ ! -z "${{ inputs.version }}" ]; then
echo "PRODUCTION=true" >> $GITHUB_ENV
fi
- name: Build Server
shell: bash
run: task build
env:
OS: ${{ matrix.target }}
ARCH: ${{ matrix.arch }}
VERSION: ${{ inputs.version }}
- name: Sign Macos binary
uses: massalabs/massa/.github/actions/sign-macos@ccc3f02e34544f722634a6fb7732cc4bb515e90b
if: ${{ runner.os == 'macOS' }}
with:
paths: "server/build/deweb-server"
certificate-p12-base64: ${{ secrets.APPLE_CERTIFICATE_P12_BASE64 }}
certificate-password: ${{ secrets.APPLE_CERTIFICATE_P12_PASSWORD }}
signing-identity: ${{ vars.APPLE_DEVELOPER_ID_APPLICATION }}
- name: Rename Server artifact
run: mv build/deweb-server${{ matrix.ext }} build/deweb-server_${{ matrix.target }}_${{ matrix.arch }}${{ matrix.ext }}
- name: Upload Server artifact
uses: actions/upload-artifact@v4
with:
name: deweb-server_${{ matrix.target }}_${{ matrix.arch }}
path: server/build/deweb-server_${{ matrix.target }}_${{ matrix.arch }}${{ matrix.ext }}
sign-windows-binary:
name: Sign Windows binary
needs: build
runs-on: windows-latest
permissions:
contents: write
id-token: write
steps:
- name: Download Windows artifacts
uses: actions/download-artifact@v4
with:
name: deweb-server_windows_amd64
path: ./windows-binaries
- name: Sign Windows binary
uses: massalabs/station/.github/actions/sign-file-digicert@413d4c0bbd042d5e797fbb66bcd2c96be5c3e71a
with:
files: ./windows-binaries/deweb-server_windows_amd64.exe
SM_API_KEY: ${{ secrets.SM_API_KEY }}
SM_CLIENT_CERT_FILE_B64: ${{ secrets.SM_CLIENT_CERT_FILE_B64 }}
SM_CLIENT_CERT_PASSWORD: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
SM_CERT_FINGERPRINT: ${{ secrets.SM_CERT_FINGERPRINT }}
SM_HOST: ${{ secrets.SM_HOST }}
- name: Upload signed Windows binary (overwrite original)
uses: actions/upload-artifact@v4
with:
name: deweb-server_windows_amd64
path: ./windows-binaries/deweb-server_windows_amd64.exe
overwrite: true