linux.yml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. name: Linux
  2. on:
  3. push:
  4. branches:
  5. - main
  6. pull_request:
  7. branches:
  8. - '*'
  9. - 'release-branch/*'
  10. concurrency:
  11. group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }}
  12. cancel-in-progress: true
  13. jobs:
  14. build:
  15. runs-on: ubuntu-22.04
  16. if: "!contains(github.event.head_commit.message, '[ci skip]')"
  17. steps:
  18. - name: Check out code into the Go module directory
  19. uses: actions/checkout@v3
  20. - name: Set up Go
  21. uses: actions/setup-go@v3
  22. with:
  23. go-version-file: go.mod
  24. id: go
  25. - name: Basic build
  26. run: go build ./cmd/...
  27. - name: Build variants
  28. run: |
  29. go install --tags=ts_include_cli ./cmd/tailscaled
  30. go install --tags=ts_omit_aws ./cmd/tailscaled
  31. - name: Get QEMU
  32. run: |
  33. sudo apt-get -y update
  34. sudo apt-get -y install qemu-user
  35. - name: Run tests on linux
  36. run: go test -bench=. -benchtime=1x ./...
  37. - name: Check that no tracked files in the repo have been modified
  38. run: git diff --no-ext-diff --name-only --exit-code || (echo "Build/test modified the files above."; exit 1)
  39. - name: Check that no files have been added to the repo
  40. run: |
  41. # Note: The "error: pathspec..." you see below is normal!
  42. # In the success case in which there are no new untracked files,
  43. # git ls-files complains about the pathspec not matching anything.
  44. # That's OK. It's not worth the effort to suppress. Please ignore it.
  45. if git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- ':/*'
  46. then
  47. echo "Build/test created untracked files in the repo (file names above)."
  48. exit 1
  49. fi
  50. - uses: k0kubun/[email protected]
  51. with:
  52. payload: |
  53. {
  54. "attachments": [{
  55. "text": "${{ job.status }}: ${{ github.workflow }} <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ env.COMMIT_DATE }} #${{ env.COMMIT_NUMBER_OF_DAY }}> " +
  56. "(<https://github.com/${{ github.repository }}/commit/${{ github.sha }}|" + "${{ github.sha }}".substring(0, 10) + ">) " +
  57. "of ${{ github.repository }}@" + "${{ github.ref }}".split('/').reverse()[0] + " by ${{ github.event.head_commit.committer.name }}",
  58. "color": "danger"
  59. }]
  60. }
  61. env:
  62. SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
  63. if: failure() && github.event_name == 'push'