Skip to content

Commit 86ad359

Browse files
authored
ci: uci/copy-templates (#35)
* chore: add or force update .github/workflows/go-test.yml * chore: add or force update .github/workflows/go-check.yml * chore: add or force update .github/workflows/releaser.yml * chore: add or force update .github/workflows/release-check.yml * chore: add or force update .github/workflows/tagpush.yml * chore: add or force update version.json * chore: bump go.mod to Go 1.19 and run go fix * fix: initdb on macos * chore: bump go.mod to Go 1.20 and run go fix * Update action.yml
1 parent c47f2fe commit 86ad359

File tree

8 files changed

+68
-150
lines changed

8 files changed

+68
-150
lines changed

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

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ runs:
1616
- if: ${{ runner.os == 'macOS' }}
1717
run: echo "PGDATA=/usr/local/var/postgres" >> $GITHUB_ENV
1818
shell: bash
19+
- if: ${{ runner.os == 'macOS' }}
20+
run: pg_ctl -D "$PGDATA" initdb
21+
shell: bash
1922
- if: ${{ runner.os == 'Windows' || runner.os == 'macOS' }}
2023
run: pg_ctl -D "$PGDATA" -l "$PGDATA/server.log" start
2124
shell: bash

.github/workflows/go-check.yml

+15-70
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,18 @@
1-
# File managed by web3-bot. DO NOT EDIT.
2-
# See https://github.com/protocol/.github/ for details.
3-
4-
on: [push, pull_request]
51
name: Go Checks
62

3+
on:
4+
pull_request:
5+
push:
6+
branches: ["master"]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
14+
cancel-in-progress: true
15+
716
jobs:
8-
unit:
9-
runs-on: ubuntu-latest
10-
name: All
11-
env:
12-
RUNGOGENERATE: false
13-
steps:
14-
- uses: actions/checkout@v3
15-
with:
16-
submodules: recursive
17-
- uses: actions/setup-go@v3
18-
with:
19-
go-version: "1.19.x"
20-
- name: Run repo-specific setup
21-
uses: ./.github/actions/go-check-setup
22-
if: hashFiles('./.github/actions/go-check-setup') != ''
23-
- name: Read config
24-
if: hashFiles('./.github/workflows/go-check-config.json') != ''
25-
run: |
26-
if jq -re .gogenerate ./.github/workflows/go-check-config.json; then
27-
echo "RUNGOGENERATE=true" >> $GITHUB_ENV
28-
fi
29-
- name: Install staticcheck
30-
run: go install honnef.co/go/tools/cmd/staticcheck@376210a89477dedbe6fdc4484b233998650d7b3c # 2022.1.3 (v0.3.3)
31-
- name: Check that go.mod is tidy
32-
uses: protocol/multiple-go-modules@v1.2
33-
with:
34-
run: |
35-
go mod tidy
36-
if [[ -n $(git ls-files --other --exclude-standard --directory -- go.sum) ]]; then
37-
echo "go.sum was added by go mod tidy"
38-
exit 1
39-
fi
40-
git diff --exit-code -- go.sum go.mod
41-
- name: gofmt
42-
if: ${{ success() || failure() }} # run this step even if the previous one failed
43-
run: |
44-
out=$(gofmt -s -l .)
45-
if [[ -n "$out" ]]; then
46-
echo $out | awk '{print "::error file=" $0 ",line=0,col=0::File is not gofmt-ed."}'
47-
exit 1
48-
fi
49-
- name: go vet
50-
if: ${{ success() || failure() }} # run this step even if the previous one failed
51-
uses: protocol/multiple-go-modules@v1.2
52-
with:
53-
run: go vet ./...
54-
- name: staticcheck
55-
if: ${{ success() || failure() }} # run this step even if the previous one failed
56-
uses: protocol/multiple-go-modules@v1.2
57-
with:
58-
run: |
59-
set -o pipefail
60-
staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g'
61-
- name: go generate
62-
uses: protocol/multiple-go-modules@v1.2
63-
if: (success() || failure()) && env.RUNGOGENERATE == 'true'
64-
with:
65-
run: |
66-
git clean -fd # make sure there aren't untracked files / directories
67-
go generate ./...
68-
# check if go generate modified or added any files
69-
if ! $(git add . && git diff-index HEAD --exit-code --quiet); then
70-
echo "go generated caused changes to the repository:"
71-
git status --short
72-
exit 1
73-
fi
17+
go-check:
18+
uses: pl-strflt/uci/.github/workflows/go-check.yml@v0.0

.github/workflows/go-test.yml

+15-65
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,18 @@
1-
# File managed by web3-bot. DO NOT EDIT.
2-
# See https://github.com/protocol/.github/ for details.
3-
4-
on: [push, pull_request]
51
name: Go Test
62

3+
on:
4+
pull_request:
5+
push:
6+
branches: ["master"]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
14+
cancel-in-progress: true
15+
716
jobs:
8-
unit:
9-
strategy:
10-
fail-fast: false
11-
matrix:
12-
os: [ "ubuntu", "windows", "macos" ]
13-
go: [ "1.18.x", "1.19.x" ]
14-
env:
15-
COVERAGES: ""
16-
runs-on: ${{ format('{0}-latest', matrix.os) }}
17-
name: ${{ matrix.os }} (go ${{ matrix.go }})
18-
steps:
19-
- uses: actions/checkout@v3
20-
with:
21-
submodules: recursive
22-
- uses: actions/setup-go@v3
23-
with:
24-
go-version: ${{ matrix.go }}
25-
- name: Go information
26-
run: |
27-
go version
28-
go env
29-
- name: Use msys2 on windows
30-
if: ${{ matrix.os == 'windows' }}
31-
shell: bash
32-
# The executable for msys2 is also called bash.cmd
33-
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#shells
34-
# If we prepend its location to the PATH
35-
# subsequent 'shell: bash' steps will use msys2 instead of gitbash
36-
run: echo "C:/msys64/usr/bin" >> $GITHUB_PATH
37-
- name: Run repo-specific setup
38-
uses: ./.github/actions/go-test-setup
39-
if: hashFiles('./.github/actions/go-test-setup') != ''
40-
- name: Run tests
41-
uses: protocol/multiple-go-modules@v1.2
42-
with:
43-
# Use -coverpkg=./..., so that we include cross-package coverage.
44-
# If package ./A imports ./B, and ./A's tests also cover ./B,
45-
# this means ./B's coverage will be significantly higher than 0%.
46-
run: go test -v -shuffle=on -coverprofile=module-coverage.txt -coverpkg=./... ./...
47-
- name: Run tests (32 bit)
48-
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
49-
uses: protocol/multiple-go-modules@v1.2
50-
env:
51-
GOARCH: 386
52-
with:
53-
run: |
54-
export "PATH=${{ env.PATH_386 }}:$PATH"
55-
go test -v -shuffle=on ./...
56-
- name: Run tests with race detector
57-
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
58-
uses: protocol/multiple-go-modules@v1.2
59-
with:
60-
run: go test -v -race ./...
61-
- name: Collect coverage files
62-
shell: bash
63-
run: echo "COVERAGES=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
64-
- name: Upload coverage to Codecov
65-
uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0
66-
with:
67-
files: '${{ env.COVERAGES }}'
68-
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}
17+
go-test:
18+
uses: pl-strflt/uci/.github/workflows/go-test.yml@v0.0

.github/workflows/release-check.yml

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
# File managed by web3-bot. DO NOT EDIT.
2-
# See https://github.com/protocol/.github/ for details.
3-
41
name: Release Checker
2+
53
on:
6-
pull_request:
4+
pull_request_target:
75
paths: [ 'version.json' ]
6+
types: [ opened, synchronize, reopened, labeled, unlabeled ]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
816

917
jobs:
1018
release-check:
11-
uses: protocol/.github/.github/workflows/release-check.yml@master
19+
uses: pl-strflt/uci/.github/workflows/release-check.yml@v0.0

.github/workflows/releaser.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
# File managed by web3-bot. DO NOT EDIT.
2-
# See https://github.com/protocol/.github/ for details.
3-
41
name: Releaser
2+
53
on:
64
push:
75
paths: [ 'version.json' ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.sha }}
13+
cancel-in-progress: true
814

915
jobs:
1016
releaser:
11-
uses: protocol/.github/.github/workflows/releaser.yml@master
17+
uses: pl-strflt/uci/.github/workflows/releaser.yml@v0.0

.github/workflows/tagpush.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
# File managed by web3-bot. DO NOT EDIT.
2-
# See https://github.com/protocol/.github/ for details.
3-
41
name: Tag Push Checker
2+
53
on:
64
push:
75
tags:
86
- v*
97

8+
permissions:
9+
contents: read
10+
issues: write
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
1016
jobs:
1117
releaser:
12-
uses: protocol/.github/.github/workflows/tagpush.yml@master
18+
uses: pl-strflt/uci/.github/workflows/tagpush.yml@v0.0

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/ipfs/go-ds-sql
22

3-
go 1.18
3+
go 1.20
44

55
require (
66
github.com/ipfs/go-datastore v0.5.1

version.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
22
"version": "v0.3.0"
3-
}
3+
}

0 commit comments

Comments
 (0)