Add Dockerfile and test/build action.
Some checks failed
build / build (push) Failing after 8m24s
test / test (push) Successful in 36s

Fix indentation.

Use patched upload-artifact action.

Update git URL in module.

Divide workflows and give them order, add badges.

Apparently workflow_run isn't supported yet...

Update build to build container and push to registry.

Fix some docker registry things.

Use internal IPv4 for registry.

Missed a spot.

I think this order makes a difference.

force HTTP use in login

this?

Use GITHUB_TOKEN instead.

idk man i'm just gonna rebase this to clean the log

Use a PAT.

Copy files over correctly.

blah
This commit is contained in:
Seraphim R. Pardee 2024-09-19 23:52:20 -04:00
parent dfc8ff001e
commit 10259ca924
7 changed files with 65 additions and 3 deletions

View File

@ -0,0 +1,29 @@
name: build
run-name: ${{ gitea.actor }} is building.
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: docker buildx setup
uses: docker/setup-buildx-action@v3
- name: login to container registry
uses: docker/login-action@v3
with:
registry: git.hl.srp.life
username: ${{ gitea.repository_owner }}
password: ${{ secrets.ACTIONS_KEY }}
- name: checkout code
uses: actions/checkout@v4
- name: build and push to registry
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: |
linux/amd64
linux/arm64
push: true
tags: |
${{ gitea.repository }}:dev

View File

@ -0,0 +1,22 @@
name: test
run-name: ${{ gitea.actor }} is testing.
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
- name: setup go 1.23.1 and fetch deps
uses: actions/setup-go@v5
with:
go-version: '1.23.1'
cache-dependency-path: go.sum
- name: do the actual test thing
run: go test -json > testresults-1.23.1.json
- name: upload test results
uses: christopherhx/gitea-upload-artifact@v4
with:
name: go-results-1.23.1
path: testresults-1.23.1.json

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
FROM golang:1.23
WORKDIR /app
COPY . ./
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -o /bingo
EXPOSE 3005
CMD [ "/bingo", "run" ]

View File

@ -1,5 +1,6 @@
# bingo
A lightweight {paste,file}bin alternative written in Golang.
![test status](https://git.hl.srp.life/srp/bingo/actions/workflows/test.yaml/badge.svg) ![build status](https://git.hl.srp.life/srp/bingo/actions/workflows/build.yaml/badge.svg)
Overall goal is to create a service that works well as a single-user self-hosted instance, which can trivially upload files/text.

View File

@ -22,7 +22,7 @@ import (
"log"
"time"
"git.sr.ht/~seraphimrp/bingo/routes"
"git.hl.srp.life/srp/bingo/routes"
"github.com/briandowns/spinner"
"github.com/dgraph-io/badger/v4"
"github.com/gofiber/fiber/v2"

2
go.mod
View File

@ -1,4 +1,4 @@
module git.sr.ht/~seraphimrp/bingo
module git.hl.srp.life/srp/bingo
go 1.23.1

View File

@ -16,7 +16,7 @@
package main
import "git.sr.ht/~seraphimrp/bingo/cmd"
import "git.hl.srp.life/srp/bingo/cmd"
func main() {
cmd.Execute()