Daily Archives: 11.08.2021
Set github actions for you repo
If you want to run tests/linters against you golang project, place something like the example below in .github/workflows/somename.yml to your project:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
name: ci-cd on: push: branches: - '**' env: GONOSUMDB: "github.com/<your-organization>" GOPRIVATE: "github.com/<your-organization>" jobs: ci-cd: strategy: matrix: go-version: [ 1.16.x ] runs-on: ubuntu-latest steps: - name: Install Go uses: actions/setup-go@v2 with: go-version: ${{ matrix.go-version }} - name: Write .netrc for private go modules env: NETRC_USER: ${{ secrets.NETRC_USER }} NETRC_PASS: ${{ secrets.NETRC_PASS }} run: echo "machine github.com login ${{ secrets.NETRC_USER }} password ${{ secrets.NETRC_PASS }}" > $HOME/.netrc - name: Checkout the code uses: actions/checkout@master with: fetch-depth: 1 - name: Run Makefile::ci-cd-check run: make ci-cd-check |
Good article on that — https://github.com/mvdan/github-actions-golang