From ea5d48dded531a3c9c056a55a9b90f333ed91537 Mon Sep 17 00:00:00 2001 From: Tom Date: Thu, 2 Mar 2023 22:36:24 +0400 Subject: [PATCH 1/5] ci: run tests on Windows --- .github/workflows/go.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 9e6b4f2..00624df 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -8,18 +8,22 @@ on: jobs: test: - runs-on: ubuntu-latest + strategy: + matrix: + go: [ oldstable, stable ] + os: [ ubuntu-latest, macos-latest, windows-latest ] + runs-on: ${{ matrix.os }} steps: - name: Checkout code uses: actions/checkout@v3 - - name: Set up Go + - name: Set up Go ${{ matrix.go }} uses: actions/setup-go@v3 with: - go-version-file: go.mod + go-version: ${{ matrix.go }} - name: Run tests - run: go test -race -coverprofile=coverage.out ./... + run: go test -race -shuffle=on -coverprofile=coverage.out ./... - name: Upload coverage uses: codecov/codecov-action@v3 From b3085a594d3cadd3299dea248093f8f533dce623 Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 11 Mar 2023 07:45:16 +0400 Subject: [PATCH 2/5] ci: fix go tool usage on Windows --- .github/workflows/go.yml | 4 +++- musttag_test.go | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 00624df..39149f0 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -23,7 +23,9 @@ jobs: go-version: ${{ matrix.go }} - name: Run tests - run: go test -race -shuffle=on -coverprofile=coverage.out ./... + # do not use `=` to join flags and values, it won't work on Windows; + # see https://github.com/PowerShell/PowerShell/issues/6291 for details. + run: go test -v -race -shuffle on -coverprofile coverage.out ./... - name: Upload coverage uses: codecov/codecov-action@v3 diff --git a/musttag_test.go b/musttag_test.go index c7ad37f..cbcf43b 100644 --- a/musttag_test.go +++ b/musttag_test.go @@ -12,9 +12,9 @@ import ( ) func TestAnalyzer(t *testing.T) { - // NOTE(junk1tm): analysistest does not yet support modules - // (see https://github.com/golang/go/issues/37054 for details). - // So, to be able to run tests with external dependencies, + // NOTE(junk1tm): analysistest does not yet support modules; + // see https://github.com/golang/go/issues/37054 for details. + // To be able to run tests with external dependencies, // we first need to write a GOPATH-like tree of stubs. prepareTestFiles(t) testPackages = []string{"tests", "builtins"} From 573474375720fbc19ad5055edadf4298aadc1d57 Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 11 Mar 2023 08:19:35 +0400 Subject: [PATCH 3/5] test: fix expected path separator on Windows --- testdata/builtins.go | 56 ++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/testdata/builtins.go b/testdata/builtins.go index 98c8fae..b62be95 100644 --- a/testdata/builtins.go +++ b/testdata/builtins.go @@ -12,39 +12,39 @@ import ( ) type User struct { /* want - "`User` should be annotated with the `json` tag as it is passed to `json.Marshal` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `json` tag as it is passed to `json.MarshalIndent` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `json` tag as it is passed to `json.Unmarshal` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `json` tag as it is passed to `json.Encoder.Encode` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `json` tag as it is passed to `json.Decoder.Decode` at testdata/src/builtins/builtins.go" + "`User` should be annotated with the `json` tag as it is passed to `json.Marshal` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `json` tag as it is passed to `json.MarshalIndent` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `json` tag as it is passed to `json.Unmarshal` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `json` tag as it is passed to `json.Encoder.Encode` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `json` tag as it is passed to `json.Decoder.Decode` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" - "`User` should be annotated with the `xml` tag as it is passed to `xml.Marshal` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `xml` tag as it is passed to `xml.MarshalIndent` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `xml` tag as it is passed to `xml.Unmarshal` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `xml` tag as it is passed to `xml.Encoder.Encode` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `xml` tag as it is passed to `xml.Decoder.Decode` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `xml` tag as it is passed to `xml.Encoder.EncodeElement` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `xml` tag as it is passed to `xml.Decoder.DecodeElement` at testdata/src/builtins/builtins.go" + "`User` should be annotated with the `xml` tag as it is passed to `xml.Marshal` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `xml` tag as it is passed to `xml.MarshalIndent` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `xml` tag as it is passed to `xml.Unmarshal` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `xml` tag as it is passed to `xml.Encoder.Encode` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `xml` tag as it is passed to `xml.Decoder.Decode` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `xml` tag as it is passed to `xml.Encoder.EncodeElement` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `xml` tag as it is passed to `xml.Decoder.DecodeElement` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" - "`User` should be annotated with the `yaml` tag as it is passed to `yaml.v3.Marshal` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `yaml` tag as it is passed to `yaml.v3.Unmarshal` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `yaml` tag as it is passed to `yaml.v3.Encoder.Encode` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `yaml` tag as it is passed to `yaml.v3.Decoder.Decode` at testdata/src/builtins/builtins.go" + "`User` should be annotated with the `yaml` tag as it is passed to `yaml.v3.Marshal` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `yaml` tag as it is passed to `yaml.v3.Unmarshal` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `yaml` tag as it is passed to `yaml.v3.Encoder.Encode` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `yaml` tag as it is passed to `yaml.v3.Decoder.Decode` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" - "`User` should be annotated with the `toml` tag as it is passed to `toml.Unmarshal` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `toml` tag as it is passed to `toml.Decode` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `toml` tag as it is passed to `toml.DecodeFS` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `toml` tag as it is passed to `toml.DecodeFile` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `toml` tag as it is passed to `toml.Encoder.Encode` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `toml` tag as it is passed to `toml.Decoder.Decode` at testdata/src/builtins/builtins.go" + "`User` should be annotated with the `toml` tag as it is passed to `toml.Unmarshal` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `toml` tag as it is passed to `toml.Decode` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `toml` tag as it is passed to `toml.DecodeFS` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `toml` tag as it is passed to `toml.DecodeFile` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `toml` tag as it is passed to `toml.Encoder.Encode` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `toml` tag as it is passed to `toml.Decoder.Decode` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" - "`User` should be annotated with the `mapstructure` tag as it is passed to `mapstructure.Decode` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `mapstructure` tag as it is passed to `mapstructure.DecodeMetadata` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `mapstructure` tag as it is passed to `mapstructure.WeakDecode` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `mapstructure` tag as it is passed to `mapstructure.WeakDecodeMetadata` at testdata/src/builtins/builtins.go" + "`User` should be annotated with the `mapstructure` tag as it is passed to `mapstructure.Decode` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `mapstructure` tag as it is passed to `mapstructure.DecodeMetadata` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `mapstructure` tag as it is passed to `mapstructure.WeakDecode` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `mapstructure` tag as it is passed to `mapstructure.WeakDecodeMetadata` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" - "`User` should be annotated with the `custom` tag as it is passed to `custom.Marshal` at testdata/src/builtins/builtins.go" - "`User` should be annotated with the `custom` tag as it is passed to `custom.Unmarshal` at testdata/src/builtins/builtins.go" + "`User` should be annotated with the `custom` tag as it is passed to `custom.Marshal` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" + "`User` should be annotated with the `custom` tag as it is passed to `custom.Unmarshal` at testdata(/|\\\\)src(/|\\\\)builtins(/|\\\\)builtins.go" */ Name string Email string `json:"email" xml:"email" yaml:"email" toml:"email" mapstructure:"email" custom:"email"` From 86290e63a989ff423fafafd6edf225e7735b602d Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 11 Mar 2023 09:34:33 +0400 Subject: [PATCH 4/5] ci: run on schedule and manually --- .github/workflows/go.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 39149f0..23cac1b 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -5,6 +5,9 @@ on: branches: [ main ] pull_request: branches: [ main ] + schedule: + - cron: "0 0 * * MON" + workflow_dispatch: jobs: test: From 0451ec3f3bff2d71050e7bd1c4522b7039a91fbb Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 11 Mar 2023 09:40:00 +0400 Subject: [PATCH 5/5] ci: run dependabot on github-actions --- .github/dependabot.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3938344..2fccaad 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,6 +1,10 @@ version: 2 updates: - - package-ecosystem: "gomod" - directory: "/" + - package-ecosystem: gomod + directory: / schedule: - interval: "daily" + interval: daily + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily