Compare commits

12 Commits
main ... build

Author SHA1 Message Date
0187d4031c Slightly cleaner error reporting.
Some checks failed
Fibonacci container test / Containerize (push) Failing after 30s
Fibonacci unit tests / Run-unit-tests (push) Successful in 44s
2025-08-25 13:16:43 +02:00
e5aced29a3 Signing policy added.
Some checks failed
Fibonacci unit tests / Containerize (push) Failing after 4s
Fibonacci unit tests / Run-unit-tests (push) Successful in 23s
2025-08-11 20:46:25 +02:00
8605f39f53 Merge pull request 'Changed things around. Should fix docker compilation' (#1) from daanselen/fibonacci:build into build
Some checks failed
Fibonacci unit tests / Containerize (push) Failing after 5s
Fibonacci unit tests / Run-unit-tests (push) Successful in 19s
Reviewed-on: #1
2025-08-11 14:54:39 +00:00
aa601454fd Changed things around. Should fix docker compilation 2025-08-11 16:35:16 +02:00
90bf0bcb73 Still not working
Some checks failed
Fibonacci unit tests / Containerize (push) Failing after 10s
Fibonacci unit tests / Run-unit-tests (push) Successful in 16s
2025-08-11 14:59:03 +02:00
2c70f0660e Updated go sums
Some checks failed
Fibonacci unit tests / Containerize (push) Failing after 5s
Fibonacci unit tests / Run-unit-tests (push) Successful in 16s
2025-08-11 09:56:52 +02:00
9f85187b21 Fix unit test workflow to work with new structure
Some checks failed
Fibonacci unit tests / Containerize (push) Failing after 6s
Fibonacci unit tests / Run-unit-tests (push) Failing after 18s
2025-08-11 09:04:50 +02:00
4df3116475 Merge branch 'build' of darjeeling:rhouben/fibonacci into build
Some checks failed
Fibonacci unit tests / Run-unit-tests (push) Failing after 24s
Fibonacci unit tests / Containerize (push) Failing after 31s
2025-08-11 09:01:43 +02:00
42bbe1fa21 Minor additions 2025-08-11 09:01:34 +02:00
7fc73921d3 First attempt at creating dockerfile
Some checks failed
Fibonacci unit tests / Containerize (push) Failing after 27s
Fibonacci unit tests / Run-unit-tests (push) Failing after 4s
2025-08-08 16:21:04 +02:00
e8d042b65e Moving go code to subdir. 2025-08-08 15:17:12 +02:00
853bee22db Mark the container workflow as in progress andfail it.
Some checks failed
Fibonacci unit tests / Containerize (push) Failing after 5s
Fibonacci unit tests / Run-unit-tests (push) Successful in 38s
2025-07-24 13:40:38 +02:00
14 changed files with 90 additions and 35 deletions

View File

@@ -1,5 +1,5 @@
name: Fibonacci unit tests name: Fibonacci container test
run-name: ${{ gitea.actor }} is testing Fibonacci run-name: ${{ gitea.actor }} is testing Fibonacci containerization
on: on:
push: push:
branches: branches:
@@ -18,5 +18,6 @@ jobs:
go-version: '1.24.4' go-version: '1.24.4'
check-latest: true check-latest: true
- name: Containerize app - name: Containerize app
run: exit 0 run: |
echo "Still needs to be implemented."
exit 1

View File

@@ -18,5 +18,7 @@ jobs:
check-latest: true check-latest: true
- name: Test functions module - name: Test functions module
run: go test ./functions -v run: go test ./functions -v
working-directory: ./code
- name: Test actual build - name: Test actual build
run: go build run: go build
working-directory: ./code

25
.gitignore vendored
View File

@@ -1,26 +1,3 @@
# Allowlisting gitignore template for GO projects prevents us
# from adding various unwanted local files, such as generated
# files, developer configurations or IDE-specific files etc.
#
# Recommended: Go.AllowList.gitignore
# Ignore everything
*
.env .env
# But not these files... .swp
!/.gitignore
!*.go
!go.sum
!go.mod
!README.md
!LICENSE
# !Makefile
# ...even if they are in subdirectories
!*/
!.gitea/*
!.gitea/workflows/*

17
code/.gitignore vendored Normal file
View File

@@ -0,0 +1,17 @@
# Allowlisting gitignore template for GO projects prevents us
# from adding various unwanted local files, such as generated
# files, developer configurations or IDE-specific files etc.
#
# Recommended: Go.AllowList.gitignore
# Ignore everything
*
.env
# But not these files...
!/.gitignore
!functions/*.go
!*.go
!go.sum
!go.mod

View File

@@ -1,7 +1,6 @@
package functions package functions
import( import (
"errors"
"fmt" "fmt"
) )
@@ -11,7 +10,7 @@ func MyFibonacci(count int) (fibonaccivalue int, error error) {
var prev_fibonacci int = 0 var prev_fibonacci int = 0
if count < 1 { if count < 1 {
return -1, errors.New(fmt.Sprintf("%d is not a positive integer.",count)) return -1, fmt.Errorf("%d is not a positive integer", count)
} }
for i := 1; i < count; i++ { for i := 1; i < count; i++ {
fibonaccivalue += prev_fibonacci fibonaccivalue += prev_fibonacci

View File

@@ -1,4 +1,5 @@
module darjeeling.systemec.nl/rhouben/fibonacci module darjeeling.systemec.nl/rhouben/fibonacci
replace darjeeling.systemec.nl/rhouben/fibonacci/functions => ./functions
go 1.24.4 go 1.24.4

View File

View File

@@ -1,11 +1,11 @@
package main package main
import ( import (
"flag"
"fmt" "fmt"
"net/http" "net/http"
"os" "os"
"strconv" "strconv"
"flag"
"github.com/joho/godotenv" "github.com/joho/godotenv"
@@ -24,7 +24,7 @@ func main() {
} }
port_arg := os.Getenv("FIB_PORT") port_arg := os.Getenv("FIB_PORT")
if port_arg != "" { if port_arg != "" {
fmt.Printf("Loaded port value '%s' from environment.\n",port_arg) fmt.Printf("Loaded port value '%s' from environment.\n", port_arg)
port_number, error = strconv.Atoi(port_arg) port_number, error = strconv.Atoi(port_arg)
if error != nil { if error != nil {
fmt.Printf("I had an error trying to parse '%s' into a number: %s\n", fmt.Printf("I had an error trying to parse '%s' into a number: %s\n",
@@ -33,9 +33,9 @@ func main() {
os.Exit(0) os.Exit(0)
} }
} }
flag.IntVar(&port, "port", 8098, flag.IntVar(&port, "port", 8098,
fmt.Sprintf("Port number to bind to, default %d", port_number)) fmt.Sprintf("Port number to bind to, default %d", port_number))
flag.IntVar(&seq, "number", 0, flag.IntVar(&seq, "number", 0,
"Fibonacci sequence value to calculate") "Fibonacci sequence value to calculate")
flag.Parse() flag.Parse()

19
docker/Dockerfile Normal file
View File

@@ -0,0 +1,19 @@
FROM golang:1.24-bookworm AS base
# /build is the working directory
WORKDIR /build
# Copy control files and pull in dependencies
COPY code/ ./
RUN go mod tidy \
&& go mod download
ENV port=8089
# Build the app
RUN go build -o fibonacci
EXPOSE ${port}
CMD ["build/fibonacci"]

39
openpgp-policy.toml Normal file
View File

@@ -0,0 +1,39 @@
version = 0
commit_goodlist = []
[authorization."Rens Houben <lpmhouben@gmail.com>"]
sign_commit = true
sign_tag = true
sign_archive = true
add_user = true
retire_user = true
audit = true
keyring = """
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: E440 6FB1 B3DE 72FC BB5A 31B6 B9BD 7068 7972 7348 DF96 C300 16E9 1615 C1CA 3244
Comment: <lpmhouben@gmail.com>
Comment: Rens Houben
xioGaJm15RsAAAAgaN/rppCWy2CMp+ptpgSv+PdNrRto2adth6QmlOwgZoPCrAYf
GwoAAAA9BYJombXlBYkFpI+9AwsJBwMVCggCmwECHgkiIQbkQG+xs95y/LtaMba5
vXBoeXJzSN+WwwAW6RYVwcoyRAAAAABf0iCRI80vGSLlZ05nqtSy1X9tkRrt9ZXH
F5RZlDdGUF00mfPBZnIYcHyNu7KQpfz5XS8O7vC27fDjx0EgY6s9b0Y5GPmTZEpk
jIs2ijl5teaaiwPPh6ow5Kg57v92EOFEUAfNFTxscG1ob3ViZW5AZ21haWwuY29t
PsKsBhMbCgAAAD0FgmiZteUFiQWkj70DCwkHAxUKCAKbAQIeCSIhBuRAb7Gz3nL8
u1oxtrm9cGh5cnNI35bDABbpFhXByjJEAAAAAJHaIFARgIT42hWyM6UPxr42sPKd
jlPALYaYHOYuVtDbb/CHA4LBgfwmSGdRimrf9Sq3+rAmb5JSLipYcd3mnrWBIjqc
wpdz0ClJC01ZzT9Rw4pnOoZueH90ApxVjOjPd0PBAc0LUmVucyBIb3ViZW7CrwYT
GwoAAABABYJombXlBYkFpI+9AwsJBwMVCggCmQECmwECHgkiIQbkQG+xs95y/Lta
Mba5vXBoeXJzSN+WwwAW6RYVwcoyRAAAAABhmSDBodFpCvgrvmxI5gPOArSU3BDX
4WXqK8uN08ppnKjno6jWPwVMh4mtQZZhVIuZnNvIpnb4fZIa3npwBVFGw/fK6phj
0TS9vSh2U9WKL1CE21dsSl16FqpA1qiJ7EyArQrOKgZombXlGwAAACAh7EFlctzR
Hn/V4RlbrHBt0nJcPjZPE8kg45MBPLu408LAewYYGwoAAADMBYJombXlBYkFpI+9
ApsCmaAGGRsKAAAAKQWCaJm15SIhBtz66d8XPr0tPfjKlTJSSk/BlB82V2PMYb4x
rFo3auRxAAAAAOQxIII9+VkI23cNclHhcwYDjNm7VdQpyfQMpX4dFTsHr60ERqHz
LGvExM6iFiB85hy7D82H7HPOI9LDbfMdjlhfZQbC1ZmzBVqyJE2DwQQqdm4JDlGJ
T8M4wf9JN7JJ0VRKAiIhBuRAb7Gz3nL8u1oxtrm9cGh5cnNI35bDABbpFhXByjJE
AAAAAMqZIGLwh64mdeHOsLRPaB3UvyXonaaSnr2XqunoiOdPVT1u4Kgg7MaKggxk
RPis16dnrwiKgBh7AMT4l22ZDlGE5FJcYu0PT5YAsLQrdJAw4+HCdga0sd2vefUT
SsuNjA9rDw==
-----END PGP PUBLIC KEY BLOCK-----
"""