From bfc5358d53b33f8988b0132e50f4e8353878ecf3 Mon Sep 17 00:00:00 2001 From: Archit Dewan <108434204+ArchitDewan@users.noreply.github.com> Date: Thu, 6 Aug 2026 21:15:39 -0400 Subject: [PATCH 01/14] update read me --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c2bec0368b..c7bbe6f536 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,4 @@ go build -o notely && ./notely *This starts the server in non-database mode.* It will serve a simple webpage at `http://localhost:8080`. You do *not* need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course! +Archit Dewans's version of Boot.dev's Notely app. From 58ad21e950d836b4b2936f8925253e1b27c68b31 Mon Sep 17 00:00:00 2001 From: Archit Dewan <108434204+ArchitDewan@users.noreply.github.com> Date: Thu, 6 Aug 2026 21:33:16 -0400 Subject: [PATCH 02/14] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c2bec0368b..e05ea2d821 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,4 @@ go build -o notely && ./notely *This starts the server in non-database mode.* It will serve a simple webpage at `http://localhost:8080`. You do *not* need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course! +Archit Dewan's version of Boot.dev's Notely app From 5ea355039b4bc7f273f4a802f62983deb0f76b70 Mon Sep 17 00:00:00 2001 From: Archit Dewan <108434204+ArchitDewan@users.noreply.github.com> Date: Thu, 6 Aug 2026 22:42:16 -0400 Subject: [PATCH 03/14] added ci workflow --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..664032071d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: ci + +on: + pull_request: + branches: [main] + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "1.26.0" + + - name: Force Failure + run: (exit 1) \ No newline at end of file From 41c8ab398d238e1b3f4d139ae7b12d3b9ef449b4 Mon Sep 17 00:00:00 2001 From: Archit Dewan <108434204+ArchitDewan@users.noreply.github.com> Date: Thu, 6 Aug 2026 23:02:25 -0400 Subject: [PATCH 04/14] replace force failure step with version check in CI workflow --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 664032071d..44f58e6620 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,5 +18,5 @@ jobs: with: go-version: "1.26.0" - - name: Force Failure - run: (exit 1) \ No newline at end of file + - name: Check version + run: go version \ No newline at end of file From bde80a34dd6e78cf2869567816a5df7096c4c637 Mon Sep 17 00:00:00 2001 From: Archit Dewan <108434204+ArchitDewan@users.noreply.github.com> Date: Fri, 7 Aug 2026 12:57:11 -0400 Subject: [PATCH 05/14] added tests in actions workflow should fail --- .github/workflows/ci.yml | 4 ++-- internal/auth/auth.go | 2 +- internal/auth/get_api_key_test.go | 25 +++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 internal/auth/get_api_key_test.go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44f58e6620..c6ac79c0a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,5 +18,5 @@ jobs: with: go-version: "1.26.0" - - name: Check version - run: go version \ No newline at end of file + - name: Run tests + run: go test ./... \ No newline at end of file diff --git a/internal/auth/auth.go b/internal/auth/auth.go index f969aacf63..117eec6645 100644 --- a/internal/auth/auth.go +++ b/internal/auth/auth.go @@ -19,5 +19,5 @@ func GetAPIKey(headers http.Header) (string, error) { return "", errors.New("malformed authorization header") } - return splitAuth[1], nil + return splitAuth[0], nil } diff --git a/internal/auth/get_api_key_test.go b/internal/auth/get_api_key_test.go new file mode 100644 index 0000000000..d8c6a09921 --- /dev/null +++ b/internal/auth/get_api_key_test.go @@ -0,0 +1,25 @@ +package auth + +import ( + "reflect" + "net/http" + "testing" +) + +func TestGetApiKey(t *testing.T) { + header := http.Header{} + header.Set("Authorization", "ApiKey your-api-key-here") + got, err := GetAPIKey(header) + + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + want := "your-api-key-here" + + if !reflect.DeepEqual(want, got) { + t.Fatalf("expected %q, got: %q",want, got) + } + +} + + From b25d17545f237eaa295c6e0bbda7bf26f82d78e9 Mon Sep 17 00:00:00 2001 From: Archit Dewan <108434204+ArchitDewan@users.noreply.github.com> Date: Fri, 7 Aug 2026 12:59:38 -0400 Subject: [PATCH 06/14] fix getapi --- internal/auth/auth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/auth/auth.go b/internal/auth/auth.go index 117eec6645..f969aacf63 100644 --- a/internal/auth/auth.go +++ b/internal/auth/auth.go @@ -19,5 +19,5 @@ func GetAPIKey(headers http.Header) (string, error) { return "", errors.New("malformed authorization header") } - return splitAuth[0], nil + return splitAuth[1], nil } From c325cd99a650fe8668772617a37d88bcd6ad0e94 Mon Sep 17 00:00:00 2001 From: Archit Dewan <108434204+ArchitDewan@users.noreply.github.com> Date: Fri, 7 Aug 2026 19:59:34 -0400 Subject: [PATCH 07/14] a --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6ac79c0a4..12897706b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Run tests - run: go test ./... \ No newline at end of file + run: go test -cover ./... \ No newline at end of file From c83777954defb3355d253c1e4c0ff18dccfda012 Mon Sep 17 00:00:00 2001 From: Archit Dewan <108434204+ArchitDewan@users.noreply.github.com> Date: Sat, 8 Aug 2026 21:22:24 -0400 Subject: [PATCH 08/14] update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 43ffbf6855..249de10618 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +https://github.com/ArchitDewan/learn-cicd-starter/actions/workflows/ci.yml/badge.svg # learn-cicd-starter (Notely) This repo contains the starter code for the "Notely" application for the "Learn CICD" course on [Boot.dev](https://boot.dev). From 535fde34e25440570910c1cd8d978ec0a13648e0 Mon Sep 17 00:00:00 2001 From: Archit Dewan <108434204+ArchitDewan@users.noreply.github.com> Date: Sat, 8 Aug 2026 21:23:22 -0400 Subject: [PATCH 09/14] Reorder CI badge and title in README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 249de10618..3de3561c12 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -https://github.com/ArchitDewan/learn-cicd-starter/actions/workflows/ci.yml/badge.svg -# learn-cicd-starter (Notely) +# learn-cicd-starter (Notely) +https://github.com/ArchitDewan/learn-cicd-starter/actions/workflows/ci.yml/badge.svg This repo contains the starter code for the "Notely" application for the "Learn CICD" course on [Boot.dev](https://boot.dev). ## Local Development From ce66af2d36eece6e905169c4b0612d7059173d91 Mon Sep 17 00:00:00 2001 From: Archit Dewan <108434204+ArchitDewan@users.noreply.github.com> Date: Sat, 8 Aug 2026 22:04:01 -0400 Subject: [PATCH 10/14] run failed static check --- .github/workflows/ci.yml | 7 ++++++- main.go | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12897706b9..5b3b8da2bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,9 @@ jobs: go-version: "1.26.0" - name: Run tests - run: go test -cover ./... \ No newline at end of file + run: go test -cover ./... + + - name: Install staticcheck + run: go install honnef.co/go/tools/cmd/staticcheck@latest + - name: Run staticcheck + run: staticcheck ./... \ No newline at end of file diff --git a/main.go b/main.go index 19d7366c5f..218068ccf2 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,10 @@ import ( _ "github.com/tursodatabase/libsql-client-go/libsql" ) - +func unused() { + // this function does nothing + // and is called nowhere +} type apiConfig struct { DB *database.Queries } From c6b4f73e9290bd96ae166403c8c9f18f94935ed4 Mon Sep 17 00:00:00 2001 From: Archit Dewan <108434204+ArchitDewan@users.noreply.github.com> Date: Sat, 8 Aug 2026 22:07:54 -0400 Subject: [PATCH 11/14] fix --- main.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/main.go b/main.go index 218068ccf2..32a3c1d0c5 100644 --- a/main.go +++ b/main.go @@ -16,10 +16,6 @@ import ( _ "github.com/tursodatabase/libsql-client-go/libsql" ) -func unused() { - // this function does nothing - // and is called nowhere -} type apiConfig struct { DB *database.Queries } From 4f916e05d4fed462d8394e5b531ec5a67c9d8799 Mon Sep 17 00:00:00 2001 From: Archit Dewan <108434204+ArchitDewan@users.noreply.github.com> Date: Sun, 9 Aug 2026 12:31:19 -0400 Subject: [PATCH 12/14] 1 --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b3b8da2bd..708002c523 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,4 +24,8 @@ jobs: - name: Install staticcheck run: go install honnef.co/go/tools/cmd/staticcheck@latest - name: Run staticcheck - run: staticcheck ./... \ No newline at end of file + run: staticcheck ./... + - name: Install gosec + run: go install github.com/securego/gosec/v2/cmd/gosec@latest + - name: Run gosec + run: gosec ./... \ No newline at end of file From b5d12cd2c18acba4b54d57b88fb2770e4b0c0333 Mon Sep 17 00:00:00 2001 From: Archit Dewan <108434204+ArchitDewan@users.noreply.github.com> Date: Sun, 9 Aug 2026 17:25:41 -0400 Subject: [PATCH 13/14] ci/cd --- .github/workflows/cd.yml | 20 ++++++++++++++++++++ .github/workflows/ci.yml | 4 ---- 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000000..4539187c58 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,20 @@ +on: + push: + branches: [main] + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "1.26.0" + + - name: Build app + run: ./scripts/buildprod.sh + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 708002c523..f1f129df05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,3 @@ jobs: run: go install honnef.co/go/tools/cmd/staticcheck@latest - name: Run staticcheck run: staticcheck ./... - - name: Install gosec - run: go install github.com/securego/gosec/v2/cmd/gosec@latest - - name: Run gosec - run: gosec ./... \ No newline at end of file From 62c7affbe20c75d137a94597de865653152b2300 Mon Sep 17 00:00:00 2001 From: Archit Dewan <108434204+ArchitDewan@users.noreply.github.com> Date: Sun, 9 Aug 2026 17:30:23 -0400 Subject: [PATCH 14/14] fix --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 4539187c58..48062ac333 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -16,5 +16,5 @@ jobs: go-version: "1.26.0" - name: Build app - run: ./scripts/buildprod.sh + run: ./scripts/buildprod.sh