Skip to content

Commit 1a1515c

Browse files
authored
Merge pull request #473 from lightninglabs/linter-fix
tools: fix lint VSC permission error
2 parents 7497edf + ce6ce3c commit 1a1515c

File tree

4 files changed

+114
-151
lines changed

4 files changed

+114
-151
lines changed

.github/actions/setup-go/action.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Setup Golang environment"
2+
description: "A reusable workflow that's used to set up the Go environment and cache."
3+
inputs:
4+
go-version:
5+
description: "The version of Golang to set up"
6+
required: true
7+
8+
runs:
9+
using: "composite"
10+
11+
steps:
12+
- name: set git config
13+
shell: bash
14+
run: |
15+
git config --global core.eol lf
16+
git config --global core.autocrlf false
17+
18+
- name: setup go ${{ inputs.go-version }}
19+
uses: actions/setup-go@v3
20+
with:
21+
go-version: '${{ inputs.go-version }}'
22+
23+
- name: go cache
24+
uses: actions/cache@v3
25+
with:
26+
path: |
27+
/home/runner/go/pkg/mod
28+
/home/runner/.cache/go-build
29+
key: litd-${{ runner.os }}-go-${{ inputs.go-version }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
30+
restore-keys: |
31+
litd-${{ runner.os }}-go-${{ inputs.go-version }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
32+
litd-${{ runner.os }}-go-${{ inputs.go-version }}-${{ github.job }}-
33+
litd-${{ runner.os }}-go-${{ inputs.go-version }}-
34+
litd-${{ runner.os }}-go-

.github/actions/setup-node/action.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: "Setup Node environment"
2+
description: "A reusable workflow that's used to set up the Node environment and cache."
3+
inputs:
4+
node-version:
5+
description: "The version of Node to set up"
6+
required: true
7+
8+
runs:
9+
using: "composite"
10+
11+
steps:
12+
- name: set git config
13+
shell: bash
14+
run: |
15+
git config --global core.eol lf
16+
git config --global core.autocrlf false
17+
18+
- name: setup nodejs v${{ inputs.node-version }}
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: '${{ inputs.node-version }}'
22+
23+
- name: get yarn cache dir
24+
id: yarn-cache-dir
25+
shell: bash
26+
run: echo "YARN_CACHE_DIR=$(yarn cache dir)" >> $GITHUB_ENV
27+
28+
- name: yarn cache
29+
uses: actions/cache@v3
30+
id: yarn-cache
31+
with:
32+
path: ${{ env.YARN_CACHE_DIR }}
33+
key: litd-${{ runner.os }}-yarn-${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
34+
restore-keys: |
35+
litd-${{ runner.os }}-yarn-${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
36+
litd-${{ runner.os }}-yarn-${{ inputs.node-version }}-
37+
litd-${{ runner.os }}-yarn-

.github/workflows/main.yml

Lines changed: 41 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ on:
99
- "*"
1010

1111
env:
12-
# go needs absolute directories, using the $HOME variable doesn't work here.
13-
DOWNLOAD_CACHE: /home/runner/work/download_cache
14-
1512
# If you change this value, please change it in the following files as well:
1613
# /Dockerfile
1714
# /dev.Dockerfile
@@ -31,33 +28,15 @@ jobs:
3128
os: [ubuntu-latest, windows-latest, macOS-latest]
3229

3330
steps:
34-
- name: set git config
35-
run: |
36-
git config --global core.eol lf
37-
git config --global core.autocrlf false
38-
3931
- name: git checkout
40-
uses: actions/checkout@v2
41-
42-
- name: setup nodejs v${{ matrix.node_version }}
43-
uses: actions/setup-node@v1
32+
uses: actions/checkout@v3
4433
with:
45-
node-version: ${{ matrix.node_version }}
46-
47-
- name: get yarn cache dir
48-
id: yarn-cache-dir
49-
run: echo "::set-output name=dir::$(yarn cache dir)"
34+
fetch-depth: 0
5035

51-
- name: yarn cache
52-
uses: actions/cache@v2
53-
id: yarn-cache
36+
- name: setup nodejs ${{ matrix.node_version }}
37+
uses: ./.github/actions/setup-node
5438
with:
55-
path: ${{ steps.yarn-cache-dir.outputs.dir }}
56-
key: ${{ runner.os }}-yarn-${{ matrix.node_version }}-${{ hashFiles('**/yarn.lock') }}
57-
restore-keys: |
58-
${{ runner.os }}-yarn-${{ matrix.node_version }}-${{ hashFiles('**/yarn.lock') }}
59-
${{ runner.os }}-yarn-${{ matrix.node_version }}-
60-
${{ runner.os }}-yarn-
39+
node-version: '${{ matrix.node_version }}'
6140

6241
- name: install dependencies
6342
working-directory: ./app
@@ -88,43 +67,20 @@ jobs:
8867
os: [ubuntu-latest, windows-latest, macOS-latest]
8968

9069
steps:
91-
- name: Set git to use LF
92-
run: |
93-
git config --global core.eol lf
94-
git config --global core.autocrlf false
95-
9670
- name: git checkout
97-
uses: actions/checkout@v2
98-
99-
- name: go cache
100-
uses: actions/cache@v2
71+
uses: actions/checkout@v3
10172
with:
102-
path: ~/go/pkg/mod
103-
key: ${{ runner.os }}-go-${{ matrix.go_version }}-${{ hashFiles('**/go.sum') }}
104-
restore-keys: |
105-
${{ runner.os }}-go-${{ matrix.go_version }}-${{ hashFiles('**/go.sum') }}
106-
${{ runner.os }}-go-${{ matrix.go_version }}-
107-
${{ runner.os }}-go-
108-
109-
- name: get yarn cache dir
110-
id: yarn-cache-dir
111-
run: echo "::set-output name=dir::$(yarn cache dir)"
112-
113-
- name: yarn cache
114-
uses: actions/cache@v2
115-
id: yarn-cache
73+
fetch-depth: 0
74+
75+
- name: setup nodejs ${{ matrix.node_version }}
76+
uses: ./.github/actions/setup-node
11677
with:
117-
path: ${{ steps.yarn-cache-dir.outputs.dir }}
118-
key: ${{ runner.os }}-yarn-16.x-${{ hashFiles('**/yarn.lock') }}
119-
restore-keys: |
120-
${{ runner.os }}-yarn-16.x-${{ hashFiles('**/yarn.lock') }}
121-
${{ runner.os }}-yarn-16.x-
122-
${{ runner.os }}-yarn-
123-
124-
- name: setup go v${{ matrix.go_version }}
125-
uses: actions/setup-go@v2
78+
node-version: '${{ matrix.node_version }}'
79+
80+
- name: setup go ${{ env.GO_VERSION }}
81+
uses: ./.github/actions/setup-go
12682
with:
127-
go-version: '~${{ matrix.go_version }}'
83+
go-version: '${{ env.GO_VERSION }}'
12884

12985
- name: build backend binary
13086
run: make build
@@ -139,52 +95,25 @@ jobs:
13995
name: RPC proto compilation check
14096
runs-on: ubuntu-latest
14197
steps:
142-
- name: set git config
143-
run: |
144-
git config --global core.eol lf
145-
git config --global core.autocrlf false
146-
14798
- name: git checkout
148-
uses: actions/checkout@v2
149-
150-
- name: setup nodejs v16.x
151-
uses: actions/setup-node@v1
99+
uses: actions/checkout@v3
152100
with:
153-
node-version: 16.x
101+
fetch-depth: 0
154102

155-
- name: download cache
156-
uses: actions/cache@v1
103+
- name: setup nodejs ${{ matrix.node_version }}
104+
uses: ./.github/actions/setup-node
157105
with:
158-
path: /home/runner/work/download_cache
159-
key: litd-${{ runner.os }}-download-${{ hashFiles('**/install_protoc.sh') }}
160-
restore-keys: |
161-
litd-${{ runner.os }}-download-${{ hashFiles('**/install_protoc.sh') }}
162-
litd-${{ runner.os }}-download-
163-
164-
- name: get yarn cache dir
165-
id: yarn-cache-dir
166-
run: echo "::set-output name=dir::$(yarn cache dir)"
167-
168-
- name: yarn cache
169-
uses: actions/cache@v2
170-
id: yarn-cache
106+
node-version: '${{ matrix.node_version }}'
107+
108+
- name: setup go ${{ env.GO_VERSION }}
109+
uses: ./.github/actions/setup-go
171110
with:
172-
path: ${{ steps.yarn-cache-dir.outputs.dir }}
173-
key: ${{ runner.os }}-yarn-${{ matrix.node_version }}-${{ hashFiles('**/yarn.lock') }}
174-
restore-keys: |
175-
${{ runner.os }}-yarn-${{ matrix.node_version }}-${{ hashFiles('**/yarn.lock') }}
176-
${{ runner.os }}-yarn-${{ matrix.node_version }}-
177-
${{ runner.os }}-yarn-
111+
go-version: '${{ env.GO_VERSION }}'
178112

179113
- name: install dependencies
180114
working-directory: ./app
181115
run: yarn
182116

183-
- name: setup go ${{ env.GO_VERSION }}
184-
uses: actions/setup-go@v2
185-
with:
186-
go-version: '${{ env.GO_VERSION }}'
187-
188117
- name: compile rpc for golang
189118
run: make rpc
190119

@@ -200,23 +129,12 @@ jobs:
200129
runs-on: ubuntu-latest
201130
steps:
202131
- name: git checkout
203-
uses: actions/checkout@v2
132+
uses: actions/checkout@v3
204133
with:
205134
fetch-depth: 0
206135

207-
- name: go cache
208-
uses: actions/cache@v1
209-
with:
210-
path: /home/runner/work/go
211-
key: litd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
212-
restore-keys: |
213-
litd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
214-
litd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-
215-
litd-${{ runner.os }}-go-${{ env.GO_VERSION }}-
216-
litd-${{ runner.os }}-go-
217-
218136
- name: setup go ${{ env.GO_VERSION }}
219-
uses: actions/setup-go@v2
137+
uses: ./.github/actions/setup-go
220138
with:
221139
go-version: '${{ env.GO_VERSION }}'
222140

@@ -239,12 +157,12 @@ jobs:
239157
runs-on: ubuntu-latest
240158
steps:
241159
- name: git checkout
242-
uses: actions/checkout@v2
160+
uses: actions/checkout@v3
243161
with:
244162
fetch-depth: 0
245163

246164
- name: setup go ${{ env.GO_VERSION }}
247-
uses: actions/setup-go@v2
165+
uses: ./.github/actions/setup-go
248166
with:
249167
go-version: '${{ env.GO_VERSION }}'
250168

@@ -262,12 +180,12 @@ jobs:
262180
runs-on: ubuntu-latest
263181
steps:
264182
- name: git checkout
265-
uses: actions/checkout@v2
183+
uses: actions/checkout@v3
266184
with:
267185
fetch-depth: 0
268186

269187
- name: setup go ${{ env.GO_VERSION }}
270-
uses: actions/setup-go@v2
188+
uses: ./.github/actions/setup-go
271189
with:
272190
go-version: '${{ env.GO_VERSION }}'
273191

@@ -282,12 +200,12 @@ jobs:
282200
runs-on: ubuntu-latest
283201
steps:
284202
- name: git checkout
285-
uses: actions/checkout@v2
203+
uses: actions/checkout@v3
286204
with:
287205
fetch-depth: 0
288206

289207
- name: setup go ${{ env.GO_VERSION }}
290-
uses: actions/setup-go@v2
208+
uses: ./.github/actions/setup-go
291209
with:
292210
go-version: '${{ env.GO_VERSION }}'
293211

@@ -301,51 +219,24 @@ jobs:
301219
name: integration test
302220
runs-on: ubuntu-latest
303221
steps:
304-
- name: set git config
305-
run: |
306-
git config --global core.eol lf
307-
git config --global core.autocrlf false
308-
309222
- name: git checkout
310-
uses: actions/checkout@v2
311-
312-
- name: setup nodejs v${{ matrix.node_version }}
313-
uses: actions/setup-node@v1
223+
uses: actions/checkout@v3
314224
with:
315-
node-version: 16.x
225+
fetch-depth: 0
316226

317-
- name: download cache
318-
uses: actions/cache@v1
227+
- name: setup nodejs ${{ matrix.node_version }}
228+
uses: ./.github/actions/setup-node
319229
with:
320-
path: /home/runner/work/download_cache
321-
key: litd-${{ runner.os }}-download-${{ hashFiles('**/install_protoc.sh') }}
322-
restore-keys: |
323-
litd-${{ runner.os }}-download-${{ hashFiles('**/install_protoc.sh') }}
324-
litd-${{ runner.os }}-download-
325-
326-
- name: get yarn cache dir
327-
id: yarn-cache-dir
328-
run: echo "::set-output name=dir::$(yarn cache dir)"
329-
330-
- name: yarn cache
331-
uses: actions/cache@v2
332-
id: yarn-cache
230+
node-version: '${{ matrix.node_version }}'
231+
232+
- name: setup go ${{ env.GO_VERSION }}
233+
uses: ./.github/actions/setup-go
333234
with:
334-
path: ${{ steps.yarn-cache-dir.outputs.dir }}
335-
key: ${{ runner.os }}-yarn-${{ matrix.node_version }}-${{ hashFiles('**/yarn.lock') }}
336-
restore-keys: |
337-
${{ runner.os }}-yarn-${{ matrix.node_version }}-${{ hashFiles('**/yarn.lock') }}
338-
${{ runner.os }}-yarn-${{ matrix.node_version }}-
339-
${{ runner.os }}-yarn-
235+
go-version: '${{ env.GO_VERSION }}'
340236

341237
- name: install dependencies
342238
working-directory: ./app
343239
run: yarn
344240

345-
- name: setup go ${{ env.GO_VERSION }}
346-
uses: actions/setup-go@v2
347-
with:
348-
go-version: '${{ env.GO_VERSION }}'
349-
350241
- name: run check
351242
run: make itest

tools/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ RUN cd /tmp \
1111
&& mkdir -p /tmp/build/.modcache \
1212
&& cd /tmp/tools \
1313
&& go install -trimpath -tags=tools github.com/golangci/golangci-lint/cmd/golangci-lint \
14-
&& chmod -R 777 /tmp/build/
14+
&& chmod -R 777 /tmp/build/ \
15+
&& git config --global --add safe.directory /build
1516

1617
WORKDIR /build

0 commit comments

Comments
 (0)