]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Create go.yml (#497)
authorMatt Joiner <anacrolix@gmail.com>
Mon, 7 Jun 2021 02:44:51 +0000 (12:44 +1000)
committerGitHub <noreply@github.com>
Mon, 7 Jun 2021 02:44:51 +0000 (12:44 +1000)
* Create go.yml

* Go version 1.16

* Add benchmarks

* Match CircleCI test coverage

* Add 15 minute timeout

* Don't log to file

* Download modules in separate step, minimize test runs

* Install godo before running torrentfs end-to-end test

* More fixes

* More fixes for GitHub Actions CI

.github/workflows/go.yml [new file with mode: 0644]
fs/test.sh

diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
new file mode 100644 (file)
index 0000000..d6f788f
--- /dev/null
@@ -0,0 +1,46 @@
+name: Go
+
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    branches: [ master ]
+
+jobs:
+
+  build:
+    timeout-minutes: 30
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+
+    - name: Set up Go
+      uses: actions/setup-go@v2
+      with:
+        go-version: 1.16
+
+    - name: Download Go modules
+      run: go mod download
+
+    - name: Build
+      run: go build ./...
+
+    - name: Test
+      run: go test -race ./...
+
+    - name: Bench
+      run: go test -run @ -bench . ./...
+
+    - name: Test on 386
+      run: GOARCH=386 go test ./... -bench .
+      continue-on-error: true
+
+    - name: Install godo
+      run: go install github.com/anacrolix/godo@latest
+
+    - name: Apt packages
+      run: sudo apt install pv fuse
+
+    - name: torrentfs end-to-end test
+      run: fs/test.sh
+      timeout-minutes: 10
index 08d303fc755461d9d3a6b3cb9fa0babf6c6ab49a..c7e85835a4bb2ee98648845097a142adda30bf9f 100755 (executable)
@@ -1,7 +1,7 @@
 set -eux
 repopath="$(cd "$(dirname "$0")/.."; pwd)"
 mkdir -p mnt torrents
-GOPPROF=http godo -v "$repopath/cmd/torrentfs" -mountDir=mnt -metainfoDir=torrents &> log &
+GOPPROF=http godo -v "$repopath/cmd/torrentfs" -mountDir=mnt -metainfoDir=torrents &
 trap 'set +e; sudo umount -f mnt' EXIT
 debian_file=debian-10.8.0-amd64-netinst.iso
 pushd torrents
@@ -11,7 +11,7 @@ popd
 file="$debian_file"
 # file=sintel.mp4
 while [ ! -e "mnt/$file" ]; do sleep 1; done
-pv "mnt/$file" | md5sum
+pv -f "mnt/$file" | md5sum
 # expect e221f43f4fdd409250908fc4305727d4
 sudo umount mnt
 wait || echo "wait returned" $?