Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -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

27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
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: Run tests
run: go test -cover ./...

- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Run staticcheck
run: staticcheck ./...
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 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
Expand All @@ -21,3 +22,6 @@ 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.

25 changes: 25 additions & 0 deletions internal/auth/get_api_key_test.go
Original file line number Diff line number Diff line change
@@ -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)
}

}


1 change: 0 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (

_ "github.com/tursodatabase/libsql-client-go/libsql"
)

type apiConfig struct {
DB *database.Queries
}
Expand Down