diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 1bed45d..5c70f3e 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -10,35 +10,49 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - uses: cachix/install-nix-action@v20 + - uses: cachix/cachix-action@v12 with: - go-version: "1.20" + name: devenv + - name: Install devenv.sh + run: nix profile install github:cachix/devenv/latest + shell: sh + - run: devenv ci + - run: devenv shell task lint - - name: Run golangci-lint - uses: golangci/golangci-lint-action@v3.5.0 + check: + name: Check file format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v20 + - uses: cachix/cachix-action@v12 + with: + name: devenv + - name: Install devenv.sh + run: nix profile install github:cachix/devenv/latest + shell: sh + - run: devenv ci + - run: devenv shell task fmt:check + - run: devenv shell task go-imports tests: name: Run tests strategy: matrix: - go-version: [1.16.x] os: [macos-latest, ubuntu-latest] - runs-on: ${{ matrix.os }} + runs-on: "${{ matrix.os }}" steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - uses: cachix/install-nix-action@v20 + - uses: cachix/cachix-action@v12 with: - go-version: "1.20" - - name: Install Taskfile - uses: arduino/setup-task@v1 - with: - version: '3.x' - repo-token: ${{ secrets.GITHUB_TOKEN }} - - - name: run tests - run: "task tests:coverage" - + name: devenv + - name: Install devenv.sh + run: nix profile install github:cachix/devenv/latest + shell: sh + - run: devenv ci + - run: devenv shell task tests:coverage - uses: codecov/codecov-action@v2 with: verbose: true - diff --git a/Taskfile.yml b/Taskfile.yml index 1a2a066..b985654 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -47,6 +47,7 @@ tasks: cmds: - task: deps - task: go-imports + - task: fmt:check - task: lint - task: tests @@ -69,6 +70,16 @@ tasks: cmds: - goimports -w -local {{.PACKAGE}} *.go cmd internal plugins test + fmt: + desc: Format go code + cmds: + - go fmt ./... + + fmt:check: + desc: Check that all go files are properly formatted + cmds: + - test -z $(gofmt -l .) + lint: desc: Lint go code cmds: