Skip to content

Commit 00fae5d

Browse files
committed
ci: start of something like ci
Taken, with tiny modifications, from osbuild-composer.
1 parent ed4ec04 commit 00fae5d

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/tests.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Tests
2+
3+
# NOTE(mhayden): Restricting branches prevents jobs from being doubled since
4+
# a push to a pull request triggers two events.
5+
on:
6+
pull_request:
7+
branches:
8+
- "*"
9+
push:
10+
branches:
11+
- main
12+
13+
jobs:
14+
test:
15+
name: "🛃 Checks"
16+
runs-on: ubuntu-20.04
17+
steps:
18+
19+
- name: Set up Go 1.14
20+
uses: actions/setup-go@v1
21+
with:
22+
go-version: 1.14
23+
id: go
24+
25+
- name: Check out code into the Go module directory
26+
uses: actions/checkout@v2
27+
with:
28+
ref: ${{ github.event.pull_request.head.sha }}
29+
30+
- name: Check that source has been prepared
31+
run: |
32+
./tools/prepare-source.sh
33+
if [ -n "$(git status --porcelain)" ]; then
34+
echo
35+
echo "Please include these changes in your branch: "
36+
git status -vv
37+
exit "1"
38+
else
39+
exit "0"
40+
fi
41+
42+
- name: Install ostree package
43+
run: sudo apt-get install -y ostree
44+
45+
- name: Install golangci-lint
46+
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.40.0
47+
48+
- name: Run golangci-lint
49+
run: $(go env GOPATH)/bin/golangci-lint run --timeout 5m0s
50+
51+
- name: Run unit tests
52+
run: go test -race -covermode=atomic -coverprofile=coverage.txt -coverpkg=./... ./...
53+
54+
- name: Send coverage to codecov.io
55+
run: bash <(curl -s https://codecov.io/bash)

0 commit comments

Comments
 (0)