diff --git a/.github/workflows/ci-go.yml b/.github/workflows/ci-go.yml new file mode 100644 index 00000000..ace6e192 --- /dev/null +++ b/.github/workflows/ci-go.yml @@ -0,0 +1,46 @@ +name: CI + +on: + push: + branches: + - main + paths: + - '.github/workflows/ci-go.yml' + - '**.go' + - 'go.*' + - 'testdata/**' + pull_request: + paths: + - '.github/workflows/ci-go.yml' + - '**.go' + - 'go.*' + - 'testdata/**' + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + cache-dependency-path: 'go.sum' + - uses: davidB/rust-cargo-make@v1 + with: + # Keep same version as used in *.nix + version: '0.36.10' + # - run: go test + - run: makers test-race + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + cache-dependency-path: 'go.sum' + - name: check format + run: go fmt ./... && git add --intent-to-add . && git diff --exit-code + - run: go vet ./... diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3a452d84..2659f861 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -44,5 +44,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - # Keep same version as *.nix + # Keep same version as used in *.nix - uses: crate-ci/typos@v1.15.0 diff --git a/.gitignore b/.gitignore index 70192613..7293ae15 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ # Managed by home-manager .config/fish/conf.d/ .config/fish/config.fish + +dist/ diff --git a/Makefile.toml b/Makefile.toml index 1905f59b..7b77d7df 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -34,3 +34,14 @@ args = [ 'run', './cmd/print-deps', ] + +[tasks.test-race] +command = 'go' +args = [ + 'build', + '-v', + '-race', + '-o', + 'dist/print-deps', + './...', +] diff --git a/scripts/lint.bash b/scripts/lint.bash index 965c2100..9ec3e12e 100755 --- a/scripts/lint.bash +++ b/scripts/lint.bash @@ -10,3 +10,4 @@ shellcheck ./**/*.bash nixpkgs-fmt --check ./**/*.nix typos . .github .config .vscode gitleaks detect +go vet ./...