forked from hlandau/passlib
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (55 loc) · 1.85 KB
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Tests
on:
push:
branches: ["master", "dev"]
pull_request:
branches: ["master"]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.13", "1.16"]
env:
GO111MODULE: off
GOMODCACHE: /sys/no/permission
GOPRIVATE: '*'
GOPROXY: off
GOSUMDB: off
GOPATH: ${{github.workspace}}/go/
PKGNAME: gopkg.in/hlandau/passlib.v1
steps:
- name: Modules mitigation
run: |
mkdir -p "$GOPATH/hooks"
cat <<END > "$GOPATH/hooks/post-checkout"
#!/usr/bin/env bash
set -euo pipefail
echo checking for errant files...
find . -regextype posix-extended -iregex '^.*/(go\.mod|go\.sum)$' -printf 'WARNING: obliterating %p\n' -exec rm '{}' ';'
exit 0
END
chmod +x "$GOPATH/hooks/post-checkout"
git config --global core.hooksPath "$GOPATH/hooks"
git config --global init.defaultBranch master
- uses: actions/checkout@v2
with:
path: ${{env.GOPATH}}/src/${{env.PKGNAME}}
- name: Go
uses: actions/setup-go@v2
with:
go-version: ${{matrix.go-version}}
- name: Install non-Go dependencies
run: sudo apt-get install libcap-dev
- name: Install Go dependencies
run: |
if [[ "${{matrix.go-version}}" == "1.4" ]]; then echo disabling PIE; export CGO_LDFLAGS=-no-pie; fi
go get -v -t "$PKGNAME"/...
- name: Build
run: go build -v "$PKGNAME"/...
- name: Test
run: go test -v "$PKGNAME"/...
- name: Ensure no modules
run: |
find "$GOPATH" -regextype posix-extended -regex '^.*/(go\.mod|go\.sum)$' |& tee "$GOPATH/modlist.txt"
[[ "$(cat "$GOPATH/modlist.txt" | wc -l)" == 0 ]] || { echo HAVE MODULES; cat "$GOPATH/modlist.txt"; exit 1; }