From 125d7f0e905898c84345ee10de1ce775fa0c905f Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 7 Jun 2021 12:44:51 +1000 Subject: [PATCH] Create go.yml (#497) * 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 | 46 ++++++++++++++++++++++++++++++++++++++++ fs/test.sh | 4 ++-- 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 00000000..d6f788fb --- /dev/null +++ b/.github/workflows/go.yml @@ -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 diff --git a/fs/test.sh b/fs/test.sh index 08d303fc..c7e85835 100755 --- a/fs/test.sh +++ b/fs/test.sh @@ -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" $? -- 2.44.0