Skip to content

Commit aaf8792

Browse files
committed
[lbry] ci: add github workflows
1 parent 0375a6d commit aaf8792

File tree

5 files changed

+181
-7
lines changed

5 files changed

+181
-7
lines changed

.github/workflows/go.yml renamed to .github/workflows/basic-check.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,20 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
go: [1.16.8, 1.17.1]
12+
go: [1.18.2]
1313
steps:
1414
- name: Set up Go
1515
uses: actions/setup-go@v2
1616
with:
1717
go-version: ${{ matrix.go }}
18+
1819
- name: Check out source
1920
uses: actions/checkout@v2
20-
- name: Install Linters
21-
run: "curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.26.0"
21+
2222
- name: Build
23-
env:
24-
GO111MODULE: "on"
2523
run: go build ./...
24+
2625
- name: Test
27-
env:
28-
GO111MODULE: "on"
2926
run: |
3027
sh ./goclean.sh
3128
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Full Sync From 0
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
note:
7+
description: 'Note'
8+
required: false
9+
default: ''
10+
11+
jobs:
12+
build:
13+
name: Go CI
14+
runs-on: self-hosted
15+
strategy:
16+
matrix:
17+
go: [1.18.2]
18+
steps:
19+
- run: |
20+
echo "Note ${{ github.event.inputs.note }}!"
21+
- name: Setup Go
22+
uses: actions/setup-go@v2
23+
with:
24+
go-version: ${{ matrix.go }}
25+
- name: Checkout source
26+
uses: actions/checkout@v2
27+
- name: Build lbcd
28+
run: go build .
29+
- name: Create datadir
30+
run: echo "TEMP_DATA_DIR=$(mktemp -d)" >> $GITHUB_ENV
31+
- name: Run lbcd
32+
run: ./lbcd --datadir=${{env.TEMP_DATA_DIR}}/data --logdir=${{env.TEMP_DATA_DIR}}/logs --nolisten --norpc
33+
- name: Remove datadir
34+
if: always()
35+
run: rm -rf ${{env.TEMP_DATA_DIR}}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Full Sync From 814k
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
note:
7+
description: 'Note'
8+
required: false
9+
default: ''
10+
11+
jobs:
12+
build:
13+
name: Go CI
14+
runs-on: self-hosted
15+
strategy:
16+
matrix:
17+
go: [1.18.2]
18+
steps:
19+
- run: |
20+
echo "Note ${{ github.event.inputs.note }}!"
21+
- name: Setup Go
22+
uses: actions/setup-go@v2
23+
with:
24+
go-version: ${{ matrix.go }}
25+
- name: Checkout source
26+
uses: actions/checkout@v2
27+
- name: Build lbcd
28+
run: go build .
29+
- name: Create datadir
30+
run: echo "TEMP_DATA_DIR=$(mktemp -d)" >> $GITHUB_ENV
31+
- name: Copy initial data
32+
run: cp -r /home/lbry/lbcd_814k/* ${{env.TEMP_DATA_DIR}}
33+
- name: Run lbcd
34+
run: ./lbcd --datadir=${{env.TEMP_DATA_DIR}}/data --logdir=${{env.TEMP_DATA_DIR}}/logs --nolisten --norpc
35+
- name: Remove datadir
36+
if: always()
37+
run: rm -rf ${{env.TEMP_DATA_DIR}}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: golangci-lint
2+
3+
env:
4+
# go needs absolute directories, using the $HOME variable doesn't work here.
5+
GOCACHE: /home/runner/work/go/pkg/build
6+
GOPATH: /home/runner/work/go
7+
GO_VERSION: '^1.18.2'
8+
9+
on:
10+
push:
11+
tags:
12+
- v*
13+
branches:
14+
- "*"
15+
pull_request:
16+
branches:
17+
- "*"
18+
19+
jobs:
20+
golangci:
21+
name: lint
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: setup go ${{ env.GO_VERSION }}
25+
uses: actions/setup-go@v2
26+
with:
27+
go-version: '${{ env.GO_VERSION }}'
28+
29+
- name: checkout source
30+
uses: actions/checkout@v2
31+
32+
- name: compile code
33+
run: go install -v ./...
34+
35+
- name: golangci-lint
36+
uses: golangci/golangci-lint-action@v2
37+
with:
38+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
39+
version: latest
40+
41+
# Optional: working directory, useful for monorepos
42+
# working-directory: somedir
43+
44+
# Optional: golangci-lint command line arguments.
45+
# args: --issues-exit-code=0
46+
47+
# Optional: show only new issues if it's a pull request. The default value is `false`.
48+
# only-new-issues: true
49+
50+
# Optional: if set to true then the action will use pre-installed Go.
51+
skip-go-installation: true
52+
53+
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
54+
# skip-pkg-cache: true
55+
56+
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
57+
# skip-build-cache: true

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: goreleaser
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
note:
7+
description: 'Note'
8+
required: false
9+
default: ''
10+
pull_request:
11+
push:
12+
tags:
13+
- '*'
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
goreleaser:
20+
runs-on: ubuntu-latest
21+
steps:
22+
-
23+
name: Checkout
24+
uses: actions/checkout@v2
25+
with:
26+
fetch-depth: 0
27+
-
28+
name: Set up Go
29+
uses: actions/setup-go@v2
30+
with:
31+
go-version: 1.18.2
32+
-
33+
name: Run GoReleaser
34+
uses: goreleaser/goreleaser-action@v2
35+
with:
36+
distribution: goreleaser
37+
version: latest
38+
args: release --rm-dist
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
-
42+
name: Upload artifacts
43+
uses: actions/upload-artifact@v2
44+
with:
45+
name: lbcd-${{ github.sha }}
46+
path: |
47+
dist/checksums.txt
48+
dist/*.tar.gz

0 commit comments

Comments
 (0)