From 0403353dfa3b9f711708a5ca748bbc5fbfabc879 Mon Sep 17 00:00:00 2001 From: fujiwara Date: Thu, 2 Feb 2023 12:38:46 +0900 Subject: [PATCH 1/3] test on go 1.20 --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a396440..7bcc120 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -5,8 +5,8 @@ jobs: strategy: matrix: go: - - 1.18 - - 1.19 + - "1.19" + - "1.20" name: Build runs-on: ubuntu-latest From 94d461c7c4806d0336824feb376d4648cf956633 Mon Sep 17 00:00:00 2001 From: fujiwara Date: Thu, 2 Feb 2023 12:53:36 +0900 Subject: [PATCH 2/3] Add test of --src specify an outside dir. --- archive_test.go | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/archive_test.go b/archive_test.go index 21e3a78..c6dfebd 100644 --- a/archive_test.go +++ b/archive_test.go @@ -2,6 +2,7 @@ package lambroll_test import ( "archive/zip" + "fmt" "os" "testing" "time" @@ -9,11 +10,37 @@ import ( "github.com/fujiwara/lambroll" ) +type zipTestSuite struct { + WorkingDir string + SrcDir string +} + +func (s zipTestSuite) String() string { + return fmt.Sprintf("%s_src_%s", s.WorkingDir, s.SrcDir) +} + +var createZipArchives = []zipTestSuite{ + {".", "test/src"}, + {"test/src/dir", "../"}, +} + func TestCreateZipArchive(t *testing.T) { + for _, s := range createZipArchives { + t.Run(s.String(), func(t *testing.T) { + testCreateZipArchive(t, s) + }) + } +} + +func testCreateZipArchive(t *testing.T, s zipTestSuite) { + cwd, _ := os.Getwd() + os.Chdir(s.WorkingDir) + defer os.Chdir(cwd) + excludes := []string{} excludes = append(excludes, lambroll.DefaultExcludes...) excludes = append(excludes, []string{"*.bin", "skip/*"}...) - r, info, err := lambroll.CreateZipArchive("test/src", excludes) + r, info, err := lambroll.CreateZipArchive(s.SrcDir, excludes) if err != nil { t.Error("faile to CreateZipArchive", err) } From 099d2cc4705febee135e0203514d416b82ba9a10 Mon Sep 17 00:00:00 2001 From: fujiwara Date: Thu, 2 Feb 2023 12:58:49 +0900 Subject: [PATCH 3/3] Release build by Go 1.20 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ff4bdab..2e606f8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: "1.20" check-latest: true - name: Check out code into the Go module directory