Add GitHub actions to the xhash project written in Go
As this is the first time I am adding GitHub Actions to a project written in Go I got a bit luck as this one had a Dockerfile and a Makefile. Thus it was quite obvious how to run the tests.
make make test
I also looked at a more popular Golang project to see what they have and based on that I got the following config file that I saved as .github/workflows/ci.yml. Besides a small typo I got it right and now the CI runs and tests the code on 6 different platforms.
examples/xhash-ci.yml
name: CI on: push: pull_request: jobs: test: strategy: fail-fast: false matrix: runner: [ubuntu-latest, macos-latest, windows-latest] go: [ '1.18', '1.19' ] runs-on: ${{matrix.runner}} name: OS ${{matrix.runner}} Go ${{matrix.go}} steps: - uses: actions/checkout@v2 - name: Install Go uses: actions/setup-go@v3 with: go-version: ${{ matrix.go }} check-latest: true - name: Show Go Version and environment run: | go version go env - name: Install dependencies run: | make - name: Run tests run: | make test
Published on 2022-10-11