init repo
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
name: Go Checks
|
||||
run-name: Go Checks
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
checks:
|
||||
name: checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
check-latest: true
|
||||
cache: true
|
||||
|
||||
- name: Install govulncheck
|
||||
run: go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||
|
||||
- name: Go Tidy
|
||||
run: go mod tidy && git diff --exit-code
|
||||
- name: Go Mod
|
||||
run: go mod download
|
||||
- name: Go Mod Verify
|
||||
run: go mod verify
|
||||
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
|
||||
- name: Run govulncheck
|
||||
run: govulncheck -test ./...
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
# Editor Files
|
||||
.idea
|
||||
.fleet
|
||||
.vscode
|
||||
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Go workspace file
|
||||
go.work
|
||||
go.work.sum
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
FROM golang:1.22
|
||||
|
||||
WORKDIR /app
|
||||
COPY main.go ./
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o /hello-world
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
# Run
|
||||
CMD ["/hello-world"]
|
||||
@@ -0,0 +1,12 @@
|
||||
# Hello World
|
||||
## A small project used in our series ("Self-hosting Git with CI/CD, using Gitea, Actions and its Container registry")[https://thehomelabber.com/guides/self-hosted-git-ci-cd]
|
||||
|
||||
To use this, clone the repository locally and change the remote origin to your new repository:
|
||||
```bash
|
||||
git clone git@github.com:TheHomelabber/self-hosted-git-hello-world.git -o hello-world
|
||||
cd hello-world
|
||||
git remote remove git@github.com:TheHomelabber/self-hosted-git-hello-world.git
|
||||
|
||||
# Change the origin to your repository.
|
||||
git remote add origin git@git.example.com:Example/self-hosted-git-hello-world.git
|
||||
```
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Hello {{.}}!</title>
|
||||
</head>
|
||||
<body>
|
||||
<style>
|
||||
html {
|
||||
background-color: #fcf2e9;
|
||||
color: #1c1c30;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 4rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>Hello, {{.}}!</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", handler)
|
||||
log.Fatal(http.ListenAndServe(":8080", nil))
|
||||
}
|
||||
|
||||
func handler(w http.ResponseWriter, r *http.Request) {
|
||||
name := strings.Replace(r.URL.Path, "/", "", 1)
|
||||
if name == "" {
|
||||
name = "World"
|
||||
}
|
||||
|
||||
t, err := template.ParseFiles("index.html")
|
||||
if err != nil {
|
||||
log.Fatal("error parsing template: ", err)
|
||||
}
|
||||
|
||||
err = t.Execute(w, name)
|
||||
if err != nil {
|
||||
log.Fatal("error executing template: ", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user