Skip to content
Merged
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
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: ci

on:
pull_request:
paths:
- 'learn-cicd/**'
branches: [main]

jobs:
tests:
name: Tests
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./learn-cicd

steps:
- name: Check out code
uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: "1.27.1"

- name: Run unit tests
run: go test ./... -cover
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ A collection of projects completed as part of my coursework on [Boot.dev](https:

## Projects

| Project | Description |
| --- | --- |
| [`chirpy`](./chirpy) | HTTP web server built from scratch in Go, including routing, JSON handling, and a REST API backed by a database. |
| [`pokedexcli`](./pokedexcli) | A CLI Pokedex in Go that consumes the PokeAPI REST API, with caching and a REPL-style interface. |
| [`gator`](./gator) | RSS feed aggregator CLI in Go with persistent storage (PostgreSQL) and scheduled feed fetching. |
| [`http-from-tcp`](./http-from-tcp) | Implements an HTTP server from raw TCP sockets in Go, without using the standard `net/http` package, to understand the protocol at a low level. |
| [`learn-pub-sub`](./learn-pub-sub) | Pub/sub messaging system in Go using RabbitMQ, built around a multiplayer game simulation. |
| [`kubernetes`](./kubernetes) | Deploying and orchestrating an application with Kubernetes. |
| [`static-site-generator`](./static-site-generator) | A static site generator written in Python that converts Markdown files into HTML pages. |
| [`asteroids`](./asteroids) | A recreation of the classic Asteroids arcade game in Python using Pygame. |
| [`bookbot`](./bookbot) | A Python CLI tool that analyzes text files and reports word counts and character frequency statistics. |
| [`ai-agent`](./ai-agent) | A toy AI coding agent in Python that uses an LLM (via function calling) to read, write, and execute files in a sandboxed directory. |
| Project | CI | Description |
| --- | --- | --- |
| [`chirpy`](./chirpy) | | HTTP web server built from scratch in Go, including routing, JSON handling, and a REST API backed by a database. |
| [`pokedexcli`](./pokedexcli) | | A CLI Pokedex in Go that consumes the PokeAPI REST API, with caching and a REPL-style interface. |
| [`gator`](./gator) | | RSS feed aggregator CLI in Go with persistent storage (PostgreSQL) and scheduled feed fetching. |
| [`http-from-tcp`](./http-from-tcp) | | Implements an HTTP server from raw TCP sockets in Go, without using the standard `net/http` package, to understand the protocol at a low level. |
| [`learn-pub-sub`](./learn-pub-sub) | | Pub/sub messaging system in Go using RabbitMQ, built around a multiplayer game simulation. |
| [`kubernetes`](./kubernetes) | | Deploying and orchestrating an application with Kubernetes. |
| [`static-site-generator`](./static-site-generator) | | A static site generator written in Python that converts Markdown files into HTML pages. |
| [`asteroids`](./asteroids) | | A recreation of the classic Asteroids arcade game in Python using Pygame. |
| [`bookbot`](./bookbot) | | A Python CLI tool that analyzes text files and reports word counts and character frequency statistics. |
| [`ai-agent`](./ai-agent) | | A toy AI coding agent in Python that uses an LLM (via function calling) to read, write, and execute files in a sandboxed directory. |
| [`learn-cicd`](./learn-cicd) | ![learn-cicd](https://github.com/lennago/bootdev/actions/workflows/ci.yml/badge.svg) | Notely — a Go web server covering building, testing, and deploying with GitHub Actions and Google Cloud Run. |

## About

Expand Down
2 changes: 2 additions & 0 deletions learn-cicd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ 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!

lennago's version of Boot.dev's Notely app.
62 changes: 62 additions & 0 deletions learn-cicd/internal/auth/get_api_key_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package auth

import (
"fmt"
"net/http"
"strings"
"testing"
)

func TestGetAPIKey(t *testing.T) {
tests := []struct {
key string
value string
expect string
expectErr string
}{
{
expectErr: "no authorization header",
},
{
key: "Authorization",
expectErr: "no authorization header",
},
{
key: "Authorization",
value: "-",
expectErr: "malformed authorization header",
},
{
key: "Authorization",
value: "Bearer xxxxxx",
expectErr: "malformed authorization header",
},
{
key: "Authorization",
value: "ApiKey xxxxxx",
expect: "xxxxxx",
expectErr: "not expecting an error",
},
}

for i, test := range tests {
t.Run(fmt.Sprintf("TestGetAPIKey Case #%v:", i), func(t *testing.T) {
header := http.Header{}
header.Add(test.key, test.value)

output, err := GetAPIKey(header)
if err != nil {
if strings.Contains(err.Error(), test.expectErr) {
return
}
t.Errorf("Unexpected: TestGetAPIKey:%v\n", err)
return
}

if output != test.expect {
t.Errorf("Unexpected: TestGetAPIKey:%s", output)
return
}
})
}
}
Loading