Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
ed97da0
Add personal note to README
Tigist-Keno Oct 28, 2025
bb4c76a
Update README with new name and description
Tigist-Keno Oct 28, 2025
d7ae4f0
Add CI workflow for pull request testing
Tigist-Keno Oct 28, 2025
958fbd0
Update CI workflow to check Go version
Tigist-Keno Oct 28, 2025
a6a86f8
Fix typo in CI workflow step name
Tigist-Keno Oct 28, 2025
9c0551f
Change CI workflow to run tests instead of version
Tigist-Keno Oct 28, 2025
146fb2b
Rename CI step to 'run tests'
Tigist-Keno Oct 28, 2025
851372a
Add test coverage reporting to CI workflow
Tigist-Keno Oct 28, 2025
25ab73b
Rename test step to include coverage
Tigist-Keno Oct 28, 2025
197a8d2
Add CI Status badge to README
Tigist-Keno Oct 28, 2025
26f1382
Fix formatting of main function declaration
Tigist-Keno Oct 28, 2025
042aa85
Update ci.yml
Tigist-Keno Oct 28, 2025
9b2c09e
Update GitHub Actions to use latest versions
Tigist-Keno Oct 28, 2025
41e8db7
Update CI workflow to use latest actions versions
Tigist-Keno Oct 28, 2025
e03e615
Update CI workflow for Go formatting check
Tigist-Keno Oct 29, 2025
a9ab995
remove style job
Tigist-Keno Oct 29, 2025
7b66aba
install dependencies
Tigist-Keno Oct 29, 2025
2f21ad6
Add style check job to CI workflow
Tigist-Keno Oct 29, 2025
7d56b3c
Fix formatting check command in CI workflow
Tigist-Keno Oct 29, 2025
fdfb16d
add unused function to test staticcheck
Tigist-Keno Oct 29, 2025
f7e1d0a
Add staticcheck to CI and unused function to test linting
Tigist-Keno Oct 30, 2025
f571e30
Remove unused function to fix linting
Tigist-Keno Oct 30, 2025
e2f7fbc
Add gosec and staticcheck to CI pipeline
Tigist-Keno Oct 30, 2025
f246997
fix indentation
Tigist-Keno Oct 30, 2025
d570af8
resolve conflict
Tigist-Keno Oct 30, 2025
cff60fc
Fix gosec issues: add ReadHeaderTimeout and handle write error
Tigist-Keno Oct 30, 2025
d62b98f
Fix missing time import in main.go
Tigist-Keno Oct 30, 2025
01a650c
add CD workflow to build on the push main
Tigist-Keno Oct 31, 2025
5ee18c3
Merge pull request #3 from Tigist-Keno/add-cd-workflow
Tigist-Keno Oct 31, 2025
86cca98
Add .env to .gitignore
Tigist-Keno Nov 1, 2025
b441f10
Add .env to .gitignore
Tigist-Keno Nov 1, 2025
6bf2f2b
Add migration step to CD pipeline
Tigist-Keno Nov 1, 2025
723b72a
Save local changes before pulling remote main
Tigist-Keno Nov 1, 2025
d2b5c43
Save local changes before pulling remote main
Tigist-Keno Nov 1, 2025
8e76b35
Fix Go formatting issues
Tigist-Keno Nov 1, 2025
14dea0a
Add deploy workflow
Tigist-Keno Nov 3, 2025
259503e
Update GitHub Actions workflow
Tigist-Keno Nov 3, 2025
7290a53
update simple check handler
Tigist-Keno Nov 3, 2025
6860759
Update deploy.yml workflow for Cloud Run
Tigist-Keno Nov 3, 2025
5c25521
Add Cloud Run deployment step to deploy.yml
Tigist-Keno Nov 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
34 changes: 34 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

name: CD Pipeline

on:
push:
branches: [main]

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest

env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: Build Notely binary
run: go build -o notely .

- name: Run migrations
run: |
GOOSE_DRIVER=turso GOOSE_DBSTRING="${{ secrets.DATABASE_URL }}" goose -dir migrations up

- name: Deploy app
run: echo

37 changes: 37 additions & 0 deletions .github/workflows/cd.yml#
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CD Pipeline

on:
push:
branches: [main]

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest

env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: Build Notely binary
run: go build -o notely .

- name: Install Goose
run: go install github.com/pressly/goose/v3/cmd/goose@latest

- name: Run database migrations
run: ./scripts/migrateup.sh

- name: Deploy Notely
run: |
echo "🚀 Deploying Notely app..."
# Add your actual deploy command here later (e.g., docker push or upload to server)

46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI

on:
pull_request:
branches: [main]

jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Run tests
run: go test ./...
- name: Install gosec
run: go install github.com/securego/gosec/v2/cmd/gosec@latest

- name: Run gosec
run: gosec ./...

style:
name: Style
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Check formatting
run: test -z "$(go fmt ./...)"
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest

- name: Run staticcheck
run: staticcheck ./...
36 changes: 36 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and Deploy to Google Cloud Run

on:
push:
branches:
- main # or whatever branch you deploy from

jobs:
build-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

# 🧱 Install gcloud CLI
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: notely-12345
service_account_key: ${{ secrets.GCP_CREDENTIALS }}
export_default_credentials: true

# 🐳 Build and Push Docker image to Artifact Registry
- name: Build and Push Docker image
run: |
gcloud builds submit --tag us-central1-docker.pkg.dev/notely-12345/notely-repo/notely:latest .

# 🚀 Deploy to Cloud Run
- name: Deploy to Cloud Run
run: |
gcloud run deploy notely \
--image us-central1-docker.pkg.dev/notely-12345/notely-repo/notely:latest \
--region us-central1 \
--platform managed \
--allow-unauthenticated
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ out
.env
learn-cicd-starter
notely
.env
16 changes: 16 additions & 0 deletions 00001_init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- +goose Up
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT
);

-- +goose Down
DROP TABLE users;



CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT
);

9 changes: 9 additions & 0 deletions 20251101175410_init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
SELECT 'up SQL query';
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
SELECT 'down SQL query';
-- +goose StatementEnd
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
![CI Status](https://github.com/Tigist-Keno/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).
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!

# Replace my name
Tigist's version of Boot.dev's Notely app.
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/E
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
Expand All @@ -37,6 +39,7 @@ github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw=
github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4=
Expand All @@ -46,8 +49,10 @@ github.com/libsql/sqlite-antlr4-parser v0.0.0-20230802215326-5cb5bb604475 h1:6Pf
github.com/libsql/sqlite-antlr4-parser v0.0.0-20230802215326-5cb5bb604475/go.mod h1:20nXSmcf0nAscrzqsXeC2/tA3KkV2eCiJqYuyAgl+ss=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand All @@ -64,14 +69,17 @@ golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfU
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g=
nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
1 change: 1 addition & 0 deletions google-cloud-sdk/.install/bq-nix.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin/bq
44 changes: 44 additions & 0 deletions google-cloud-sdk/.install/bq-nix.snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"components": [
{
"data": {
"contents_checksum": "0a2bf62530849e8882a1cf4c7699078f44e1ca965c2dd9d90d18d3452d1d8d1b",
"source": "",
"type": "tar"
},
"dependencies": [
"bq",
"core"
],
"details": {
"description": "Provides the bq tool for interacting with the BigQuery service.",
"display_name": "BigQuery Command Line Tool (Platform Specific)"
},
"gdu_only": false,
"id": "bq-nix",
"is_configuration": false,
"is_hidden": true,
"is_required": false,
"platform": {
"operating_systems": [
"CYGWIN",
"LINUX",
"MACOSX",
"MSYS"
]
},
"platform_required": false,
"version": {
"build_number": 20251024121634,
"version_string": "2.1.25"
}
}
],
"revision": 20251024121634,
"schema_version": {
"no_update": false,
"url": "https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz",
"version": 3
},
"version": "545.0.0"
}
Loading