forked from berty/berty
-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (123 loc) · 4.17 KB
/
mac.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
name: macOS Release
on:
push:
tags:
- v*
branches:
- master
paths:
- "go/**"
- "!go/**.md"
- ".goreleaser"
- "go.*"
- "**.go"
- ".github/workflows/go.yml"
- "js/**"
- "config/**"
- "tool/generate-i18n-testlang"
- ".github/workflows/js.yml"
pull_request:
paths:
- "go/**"
- "!go/**.md"
- ".goreleaser"
- "go.*"
- "**.go"
- ".github/workflows/go.yml"
- "js/**"
- "config/**"
- "tool/generate-i18n-testlang"
- ".github/workflows/js.yml"
jobs:
mac_runner_matrix_builder:
name: macOS matrix builder
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- id: set-matrix
run: |
# usage: node .github/workflows/mac-runner-matrix-builder.js STRATEGY
#
# STRATEGY
# random pick a random runner configuration
# dc4 pick the dc4 runner configuration
# github pick the github runner configuration
# all pick all the runner configurations (in parallel)
# optimized pick a dc4 runner if available or fallback on github one
#
node .github/workflows/utils/mac-runner-matrix-builder.js optimized "${{ secrets.SELFHOSTED_STATUS_CHECK_TOKEN }}"
build-macos-app:
name: "Build electron app (macos)"
needs: mac_runner_matrix_builder
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.mac_runner_matrix_builder.outputs.matrix)}}
env:
OS: macos-latest
GOLANG: ${{ matrix.golang }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Load variables from file
uses: antifree/json-to-variables@v1.0.1
with:
filename: .github/workflows/utils/variables.json
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Cache Node.js modules
uses: actions/cache@v2.1.6
with:
path: js/node_modules
key: ${{ runner.OS }}-node-${{ matrix.node }}-${{ env.json_cache-version_node }}-${{ hashFiles('js/yarn.lock') }}-${{ hashFiles('js/electron-app/yarn.lock') }}
restore-keys: ${{ runner.OS }}-node-${{ matrix.node }}-${{ env.json_cache-version_node }}-
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.golang }}
- name: Cache Go modules
uses: actions/cache@v2.1.6
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.golang }}-${{ env.json_cache-version_go }}-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-${{ matrix.golang }}-${{ env.json_cache-version_go }}-
- name: Compile the project on Unix-like operating systems
working-directory: go
run: |
touch gen.sum # avoid triggering make generate
make go.install
- name: Check go.mod and go.sum
run: |
go mod tidy -v
git --no-pager diff go.mod go.sum
git --no-pager diff --quiet go.mod go.sum
- name: Install Yarn
run: npm install -g yarn
- name: Install electron app deps (node_modules)
working-directory: js
run: make node_modules && make web/node_modules
- name: Build the app (PR)
if: github.event_name == 'pull_request'
env:
CSC_IDENTITY_AUTO_DISCOVERY: false
working-directory: js
run: make electron.mac
- name: Build the app (Merge)
if: github.event_name != 'pull_request'
env:
CSC_LINK: ${{ secrets.MAC_APP_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.MAC_APP_CSC_KEY_PASSWORD }}
working-directory: js
run: make electron.mac
- name: Upload the Archive
uses: actions/upload-artifact@v3
with:
path: js/web/dist/Berty.dmg
name: berty-yolo-${{github.sha}}.unsigned-dmg
if-no-files-found: error