Merge pull request #809 from zonedb/ydnar/github-actions
GitHub Actions
Randy Reddig authored 3 years ago
GitHub committed 3 years ago
|
0 |
version: 2
|
|
1 |
updates:
|
|
2 |
- package-ecosystem: github-actions
|
|
3 |
directory: "/"
|
|
4 |
schedule:
|
|
5 |
interval: weekly
|
|
6 |
open-pull-requests-limit: 10
|
|
7 |
|
|
8 |
- package-ecosystem: gomod
|
|
9 |
directory: "/"
|
|
10 |
schedule:
|
|
11 |
interval: daily
|
|
12 |
open-pull-requests-limit: 10
|
|
0 |
name: Dependabot
|
|
1 |
|
|
2 |
on:
|
|
3 |
pull_request:
|
|
4 |
|
|
5 |
jobs:
|
|
6 |
go:
|
|
7 |
name: Check Dependabot Go updates
|
|
8 |
if: github.event.pull_request.sender.login == 'dependabot-bot'
|
|
9 |
runs-on: ubuntu-latest
|
|
10 |
steps:
|
|
11 |
- name: Checkout repo
|
|
12 |
uses: actions/checkout@v2
|
|
13 |
with:
|
|
14 |
token: ${{ secrets.ZONEDBOT_RW_GITHUB_ACCESS_TOKEN }}
|
|
15 |
ref: ${{ github.head_ref }} # Ensures we check out the branch, not the PR ref
|
|
16 |
submodules: recursive
|
|
17 |
|
|
18 |
- name: Set up Go
|
|
19 |
uses: actions/setup-go@v2
|
|
20 |
with:
|
|
21 |
go-version: ^1
|
|
22 |
|
|
23 |
- name: Download Go modules
|
|
24 |
run: |
|
|
25 |
go mod tidy
|
|
26 |
go test -i -mod=readonly -race ./...
|
|
27 |
|
|
28 |
- name: Verify repo is unchanged
|
|
29 |
run: git diff --exit-code HEAD
|
|
30 |
|
|
31 |
- name: Create fixup commit
|
|
32 |
if: failure()
|
|
33 |
run: |
|
|
34 |
git config --global user.email [email protected]
|
|
35 |
git config --global user.name zonedbot
|
|
36 |
git add go.mod go.sum
|
|
37 |
git commit -m "go.{mod,sum}: fixup commit for Dependabot"
|
|
38 |
git push origin -u HEAD
|
|
0 |
name: Go
|
|
1 |
|
|
2 |
on:
|
|
3 |
push:
|
|
4 |
branches:
|
|
5 |
- master
|
|
6 |
pull_request:
|
|
7 |
|
|
8 |
jobs:
|
|
9 |
test:
|
|
10 |
name: Test Go
|
|
11 |
runs-on: ubuntu-latest
|
|
12 |
timeout-minutes: 15
|
|
13 |
steps:
|
|
14 |
- name: Checkout repo
|
|
15 |
uses: actions/checkout@v2
|
|
16 |
with:
|
|
17 |
submodules: recursive
|
|
18 |
|
|
19 |
- name: Set up Go
|
|
20 |
uses: actions/setup-go@v2
|
|
21 |
with:
|
|
22 |
go-version: ^1
|
|
23 |
|
|
24 |
- name: Vet Go code
|
|
25 |
run: go vet ./...
|
|
26 |
|
|
27 |
- name: Run Go tests
|
|
28 |
run: go test -mod=readonly -v -race ./...
|
|
29 |
|
|
30 |
- name: Verify repo is unchanged
|
|
31 |
run: git diff --exit-code HEAD
|
|
32 |
|
|
33 |
# Via: https://github.com/dependabot/dependabot-core/issues/1973#issuecomment-701889737
|
|
34 |
automerge:
|
|
35 |
name: Automerge
|
|
36 |
needs: test
|
|
37 |
if: github.event.pull_request.sender.login == 'dependabot-bot'
|
|
38 |
runs-on: ubuntu-latest
|
|
39 |
steps:
|
|
40 |
- name: automerge
|
|
41 |
uses: actions/github-script@v3
|
|
42 |
with:
|
|
43 |
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
44 |
script: |
|
|
45 |
github.pulls.createReview({
|
|
46 |
owner: context.payload.repository.owner.login,
|
|
47 |
repo: context.payload.repository.name,
|
|
48 |
pull_number: context.payload.pull_request.number,
|
|
49 |
event: 'APPROVE'
|
|
50 |
})
|
|
51 |
github.pulls.merge({
|
|
52 |
owner: context.payload.repository.owner.login,
|
|
53 |
repo: context.payload.repository.name,
|
|
54 |
pull_number: context.payload.pull_request.number
|
|
55 |
})
|
0 | |
# GitHub's starter Go config file
|
1 | |
|
2 | |
name: Go
|
3 | |
on: [push]
|
4 | |
jobs:
|
5 | |
|
6 | |
build:
|
7 | |
name: Build
|
8 | |
runs-on: ubuntu-latest
|
9 | |
steps:
|
10 | |
|
11 | |
- name: Set up Go 1.13
|
12 | |
uses: actions/setup-go@v1
|
13 | |
with:
|
14 | |
go-version: 1.13
|
15 | |
id: go
|
16 | |
|
17 | |
- name: Check out code into the Go module directory
|
18 | |
uses: actions/checkout@v1
|
19 | |
|
20 | |
- name: Get dependencies
|
21 | |
run: |
|
22 | |
go get -v -t -d ./...
|
23 | |
|
24 | |
- name: Build
|
25 | |
run: go build -v .
|