Skip to content

Commit 8198d2f

Browse files
authored
Merge pull request #18 from cure/add-actions
Add a basic CI workflow with github actions
2 parents 3532eaf + 491fb0a commit 8198d2f

File tree

3 files changed

+45
-2
lines changed

3 files changed

+45
-2
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
# The "build" workflow
7+
build:
8+
# The type of runner that the job will run on
9+
runs-on: ubuntu-latest
10+
11+
# Steps represent a sequence of tasks that will be executed as part of the job
12+
steps:
13+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
14+
- uses: actions/checkout@v2
15+
16+
# Install and run golangci-lint as a separate step, it's much faster this
17+
# way because this action has caching. It'll get run again in `make lint`
18+
# below, but it's still much faster in the end than installing
19+
# golangci-lint manually in the `Run lint` step.
20+
- uses: golangci/golangci-lint-action@v2
21+
22+
# Setup Go
23+
- name: Setup Go
24+
uses: actions/setup-go@v2
25+
with:
26+
go-version: '1.16.3' # The Go version to download (if necessary) and use.
27+
28+
# Install all the dependencies
29+
- name: Install dependencies
30+
run: |
31+
go version
32+
go get -u golang.org/x/lint/golint
33+
sudo apt update
34+
sudo apt install -y make
35+
36+
- name: Run tests
37+
run: make test
38+
39+
- name: Run lint
40+
run: make lint
41+
42+
- name: Run build
43+
run: make
44+

cmd/headscale/headscale.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func loadConfig(path string) error {
5050

5151
err := viper.ReadInConfig()
5252
if err != nil {
53-
return errors.New(fmt.Sprintf("Fatal error reading config file: %s \n", err))
53+
return fmt.Errorf("Fatal error reading config file: %s \n", err)
5454
}
5555

5656
// Collect any validation errors and return them all at once

cmd/headscale/headscale_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ func (*Suite) TestTLSConfigValidation(c *check.C) {
9090

9191
// Check configuration validation errors (2)
9292
configYaml = []byte("---\nserver_url: \"http://192.168.1.12:8000\"\ntls_letsencrypt_hostname: \"example.com\"\ntls_letsencrypt_challenge_type: \"TLS-ALPN-01\"")
93-
fmt.Printf(string(configYaml))
9493
writeConfig(c, tmpDir, configYaml)
9594
err = loadConfig(tmpDir)
9695
c.Assert(err, check.NotNil)

0 commit comments

Comments
 (0)