I am working on the MIT Distributed System class Spring 2020 6.824.

Building a distributed system is hard, CI can help to prevent the regression which allows me to mange complexity. I have decided to use github actions to achieve this.

The Script

# https://github.com/mvdan/github-actions-golang
name: Unittest
on: [push, pull_request]

jobs:
  test:
    strategy:
      matrix:
        go-version: ["1.13.8"]
        os: [ubuntu-latest, macos-latest, windows-latest] 
    runs-on: ${{matrix.os}}

    steps: 
      - name: Install Go
        uses: actions/setup-go@v2
        with:
          go-version: ${{matrix.go-version}}
      
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Test2A
        run: go test -run 2A -race
        working-directory: src/raft

End Result

With the change, unittest will run for every PR. image

Notes

  • Place the above unittest.yaml file in the root .github/workflow directory.
  • working-directory is used to specify the working directory the test script runs from.