tunasync.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. name: tunasync
  2. on: [push]
  3. jobs:
  4. build:
  5. name: Build
  6. runs-on: ubuntu-latest
  7. steps:
  8. - name: Set up Go 1.16
  9. uses: actions/setup-go@v1
  10. with:
  11. go-version: 1.16
  12. id: go
  13. - name: Check out code into the Go module directory
  14. uses: actions/checkout@v2
  15. - name: Get dependencies
  16. run: |
  17. go get -v -t -d ./cmd/tunasync
  18. go get -v -t -d ./cmd/tunasynctl
  19. - name: Build
  20. run: |
  21. make tunasync
  22. make tunasynctl
  23. - name: Keep artifacts
  24. uses: actions/upload-artifact@v1
  25. with:
  26. name: tunasync-bin
  27. path: build-linux-amd64/
  28. test:
  29. name: Test
  30. runs-on: ubuntu-latest
  31. steps:
  32. - name: Setup test dependencies
  33. run: |
  34. sudo apt-get update
  35. sudo apt-get install -y cgroup-tools
  36. docker pull alpine:3.8
  37. lssubsys -am
  38. sudo cgcreate -a $USER -t $USER -g cpu:tunasync
  39. sudo cgcreate -a $USER -t $USER -g memory:tunasync
  40. - name: Set up Go 1.16
  41. uses: actions/setup-go@v1
  42. with:
  43. go-version: 1.16
  44. id: go
  45. - name: Check out code into the Go module directory
  46. uses: actions/checkout@v2
  47. - name: Run Unit tests.
  48. run: |
  49. go install github.com/wadey/gocovmerge@latest
  50. TERM=xterm-256color make test
  51. - name: Run Additional Unit tests.
  52. run: |
  53. make build-test-worker
  54. sudo cgexec -g "*:/" bash -c "echo 0 > /sys/fs/cgroup/systemd/tasks; exec sudo -u $USER env USECURCGROUP=1 TERM=xterm-256color cgexec -g cpu,memory:tunasync ./worker.test -test.v=true -test.coverprofile profile2.cov -test.run TestCgroup"
  55. - name: Combine coverage files
  56. run : |
  57. $HOME/go/bin/gocovmerge profile.cov profile2.cov > profile-all.cov
  58. - name: Convert coverage to lcov
  59. uses: jandelgado/gcov2lcov-action@v1.0.0
  60. with:
  61. infile: profile-all.cov
  62. outfile: coverage.lcov
  63. - name: Coveralls
  64. uses: coverallsapp/github-action@v1.0.1
  65. with:
  66. github-token: ${{ secrets.github_token }}
  67. path-to-lcov: coverage.lcov