@@ -3,11 +3,8 @@ name: Setup
3
3
description : Setup CI environment.
4
4
5
5
inputs :
6
- type :
7
- description : Type of setup, `minimal` will only setup the JavaScript monorepo, empty will also install Java.
8
- required : false
9
- language :
10
- description : the language for which to install deps
6
+ javascript-utils :
7
+ description : If true, it will also restore the cache of the javascript util packages.
11
8
required : false
12
9
13
10
runs :
18
15
run : |
19
16
echo "CACHE_VERSION=$(< .github/.cache_version)" >> $GITHUB_ENV
20
17
21
- # Java for code generation
22
- - name : Install Java
23
- if : inputs.type != 'minimal'
24
- uses : actions/setup-java@v4
25
- with :
26
- distribution : zulu
27
- java-version-file : config/.java-version
28
- cache : gradle
29
-
30
- - name : Validate gradle wrapper
31
- if : inputs.type != 'minimal'
32
- uses : gradle/wrapper-validation-action@v1
33
-
34
- - name : Download Java formatter
35
- if : inputs.type != 'minimal'
36
- shell : bash
37
- run : curl --retry 3 -L "https://github.com/google/google-java-format/releases/download/v1.19.2/google-java-format-1.19.2-all-deps.jar" > /tmp/java-formatter.jar
38
-
39
18
# JavaScript for monorepo and tooling
40
- - name : Install Node
41
- uses : actions/setup-node@v4
42
- with :
43
- node-version-file : .nvmrc
44
- cache : yarn
45
-
46
19
- name : Get yarn cache directory path
47
20
shell : bash
48
21
id : yarn-cache-dir
@@ -69,143 +42,29 @@ runs:
69
42
shell : bash
70
43
run : yarn workspace scripts build:cli
71
44
72
- - name : Get all languages versions
73
- id : versions
74
- shell : bash
75
- run : |
76
- # remove patch from php version
77
- echo "CSHARP_VERSION=$(cat config/.csharp-version)" >> $GITHUB_OUTPUT
78
- echo "DART_VERSION=$(cat config/.dart-version)" >> $GITHUB_OUTPUT
79
- echo "GO_VERSION=$(cat config/.go-version)" >> $GITHUB_OUTPUT
80
- echo "PHP_VERSION=$(cat config/.php-version | cut -d '.' -f 1,2)" >> $GITHUB_OUTPUT
81
- echo "PYTHON_VERSION=$(cat config/.python-version)" >> $GITHUB_OUTPUT
82
- echo "RUBY_VERSION=$(cat config/.ruby-version)" >> $GITHUB_OUTPUT
83
- echo "SWIFT_VERSION=$(cat config/.swift-version)" >> $GITHUB_OUTPUT
84
-
85
45
# JavaScript client deps
86
46
- name : Get yarn js-client cache directory path
87
- if : ${{ inputs.language == 'javascript ' }}
47
+ if : ${{ inputs.javascript-utils == 'true ' }}
88
48
shell : bash
89
49
id : yarn-cache-dir-client
90
50
run : echo "dir=$(cd clients/algoliasearch-client-javascript && yarn config get cacheFolder)" >> $GITHUB_OUTPUT
91
51
92
52
- name : Restore Yarn js-client
93
- if : ${{ inputs.language == 'javascript ' }}
53
+ if : ${{ inputs.javascript-utils == 'true ' }}
94
54
uses : actions/cache@v3
95
55
with :
96
56
path : ${{ steps.yarn-cache-dir-client.outputs.dir || 'clients/algoliasearch-client-javascript/.yarn/cache' }}
97
57
# let yarn handle the cache hash
98
58
key : yarn-cache-client-${{ env.CACHE_VERSION }}
99
59
100
60
- name : Cache js-client node modules
101
- if : ${{ inputs.language == 'javascript ' }}
61
+ if : ${{ inputs.javascript-utils == 'true ' }}
102
62
uses : actions/cache@v3
103
63
with :
104
64
path : clients/algoliasearch-client-javascript/node_modules
105
65
key : node-modules-client-${{ env.CACHE_VERSION }}-${{ hashFiles('clients/algoliasearch-client-javascript/yarn.lock') }}
106
66
107
67
- name : Install JavaScript client dependencies
108
- if : ${{ inputs.language == 'javascript ' }}
68
+ if : ${{ inputs.javascript-utils == 'true ' }}
109
69
shell : bash
110
70
run : cd clients/algoliasearch-client-javascript && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install
111
-
112
- # PHP
113
- - name : Install PHP
114
- if : ${{ inputs.language == 'php' }}
115
- uses : shivammathur/setup-php@v2
116
- with :
117
- php-version : ${{ steps.versions.outputs.PHP_VERSION }}
118
- tools : composer
119
-
120
- - name : Run composer install
121
- if : ${{ inputs.language == 'php' }}
122
- shell : bash
123
- run : |
124
- composer install --working-dir=clients/algoliasearch-client-php
125
- composer dump-autoload --working-dir=clients/algoliasearch-client-php
126
-
127
- # Golang
128
- - name : Install golang
129
- if : ${{ inputs.language == 'go' }}
130
- uses : actions/setup-go@v5
131
- with :
132
- cache-dependency-path : clients/algoliasearch-client-go/go.sum
133
- go-version : ${{ steps.versions.outputs.GO_VERSION }}
134
-
135
- - name : Install golangci-lint
136
- if : ${{ inputs.language == 'go' }}
137
- shell : bash
138
- run : |
139
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
140
- echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
141
- go install golang.org/x/tools/cmd/goimports@latest
142
-
143
- # Dart
144
- - name : Install dart
145
- if : ${{ inputs.language == 'dart' }}
146
- uses : dart-lang/setup-dart@v1
147
- with :
148
- sdk : ${{ steps.versions.outputs.DART_VERSION }}
149
-
150
- - name : Setup dart tools
151
- if : ${{ inputs.language == 'dart' }}
152
- shell : bash
153
- run : dart pub global activate melos
154
-
155
- # Python
156
- - name : Install poetry
157
- if : ${{ inputs.language == 'python' }}
158
- shell : bash
159
- run : pipx install poetry
160
-
161
- - uses : actions/setup-python@v5
162
- if : ${{ inputs.language == 'python' }}
163
- with :
164
- python-version : ${{ steps.versions.outputs.PYTHON_VERSION }}
165
- cache : ' poetry'
166
-
167
- - run : poetry install
168
- if : ${{ inputs.language == 'python' }}
169
- working-directory : clients/algoliasearch-client-python
170
- shell : bash
171
-
172
- # Ruby
173
- - name : Install Ruby
174
- if : ${{ inputs.language == 'ruby' }}
175
- uses : ruby/setup-ruby@v1
176
- with :
177
- ruby-version : ${{ steps.versions.outputs.RUBY_VERSION }}
178
- bundler-cache : true
179
-
180
- # Csharp
181
- - name : Install dotnet
182
- if : ${{ inputs.language == 'csharp' }}
183
- uses : actions/setup-dotnet@v4
184
- with :
185
- dotnet-version : ${{ steps.versions.outputs.CSHARP_VERSION }}
186
-
187
- # Swift deps
188
- - name : Install swift
189
- if : ${{ inputs.language == 'swift' }}
190
- uses : swift-actions/setup-swift@v1
191
- with :
192
- swift-version : ${{ steps.versions.outputs.SWIFT_VERSION }}
193
-
194
- - name : Set up Homebrew
195
- if : ${{ inputs.language == 'swift' }}
196
- id : set-up-homebrew
197
- uses : Homebrew/actions/setup-homebrew@master
198
-
199
- - name : Cache Homebrew Bundler RubyGems
200
- if : ${{ inputs.language == 'swift' }}
201
- id : cache
202
- uses : actions/cache@v3
203
- with :
204
- path : ${{ steps.set-up-homebrew.outputs.gems-path }}
205
- key : ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
206
- restore-keys : ${{ runner.os }}-rubygems-
207
-
208
- - name : Install swift-format
209
- if : ${{ inputs.language == 'swift' && steps.cache.outputs.cache-hit != 'true' }}
210
- shell : bash
211
- run : brew install swift-format
0 commit comments