Compare commits

..
Author SHA1 Message Date
Pierre Dubouilh b8bfc21902 mpr 2024-08-30 14:41:03 +02:00
Pierre Dubouilh cd6122b393 bump go to 1.23.0 & fixup build reproducibility 2024-08-30 14:40:50 +02:00
7 changed files with 75 additions and 31 deletions
+9 -4
View File
@@ -6,15 +6,20 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v1
with: with:
go-version: 1.23.0 go-version: 1.23.0
id: go id: go
- name: deps
run: npm i -g standard
- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
submodules: true
- name: Run - name: Run
run: make ci run: make ci
+17 -11
View File
@@ -10,25 +10,33 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v1
with:
submodules: true
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.23.0
id: go
- name: Set env - name: Set env
run: echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV run: echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v1.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1.6.0
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v3 uses: docker/login-action@v1.10.0
with: with:
username: ${{ secrets.DOCKER_USER }} username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and release on dockerhub - name: Build and release on dockerhub
uses: docker/build-push-action@v6 uses: docker/build-push-action@v2.7.0
with: with:
file: support/build.Dockerfile file: support/build.Dockerfile
push: true push: true
@@ -39,19 +47,17 @@ jobs:
run: make build-all run: make build-all
- name: "Release gh release versioned" - name: "Release gh release versioned"
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@58ae73b360456532aafd58ee170c045abbeaee37
with: with:
allowUpdates: true allowUpdates: true
artifacts: "builds/*" artifacts: "builds/*"
bodyFile: "builds/buildout"
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- name: "Release gh release latest" - name: "Release gh release latest"
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@58ae73b360456532aafd58ee170c045abbeaee37
with: with:
tag: latest tag: latest
name: Latest name: Latest
allowUpdates: true allowUpdates: true
artifacts: "builds/*" artifacts: "builds/*"
bodyFile: "builds/buildout"
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
+39
View File
@@ -0,0 +1,39 @@
name: rc
on:
push:
branches:
- 'rc/**'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.23.0
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
submodules: true
- name: Run
run: make ci
- name: Build all artifacts
run: make build-all
- name: "Release gh release prerelease"
uses: ncipollo/release-action@58ae73b360456532aafd58ee170c045abbeaee37
with:
allowUpdates: true
prerelease: true
tag: "rc"
artifacts: "builds/*"
token: ${{ secrets.GITHUB_TOKEN }}
+5 -2
View File
@@ -17,7 +17,10 @@ run-ro::
run-extra:: run-extra::
./gossa -verb=true -prefix="/fancy-path/" -k=false -symlinks=true test-fixture ./gossa -verb=true -prefix="/fancy-path/" -k=false -symlinks=true test-fixture
ci:: build-all test lint-js::
standard
ci:: build-all test lint-js
echo "done" echo "done"
test:: test::
@@ -63,7 +66,7 @@ build-all:: build
${NOCGO} GOOS=darwin GOARCH=amd64 go build ${FLAGS} -o builds/gossa-mac-x64 ${NOCGO} GOOS=darwin GOARCH=amd64 go build ${FLAGS} -o builds/gossa-mac-x64
${NOCGO} GOOS=darwin GOARCH=arm64 go build ${FLAGS} -o builds/gossa-mac-arm64 ${NOCGO} GOOS=darwin GOARCH=arm64 go build ${FLAGS} -o builds/gossa-mac-arm64
${NOCGO} GOOS=windows GOARCH=amd64 go build ${FLAGS} -o builds/gossa-windows.exe ${NOCGO} GOOS=windows GOARCH=amd64 go build ${FLAGS} -o builds/gossa-windows.exe
sha256sum builds/* | tee builds/buildout sha256sum builds/*
clean:: clean::
rm -f gossa rm -f gossa
+4 -5
View File
@@ -100,9 +100,8 @@ func replyList(w http.ResponseWriter, r *http.Request, fullPath string, path str
p.Title = template.HTML(html.EscapeString(title)) p.Title = template.HTML(html.EscapeString(title))
for _, el := range files { for _, el := range files {
info, errInfo := el.Info() info, err := el.Info()
el, err := os.Stat(fullPath + "/" + el.Name()) if err != nil {
if err != nil || errInfo != nil {
log.Println("error - cant stat a file", err) log.Println("error - cant stat a file", err)
continue continue
} }
@@ -110,7 +109,7 @@ func replyList(w http.ResponseWriter, r *http.Request, fullPath string, path str
if *skipHidden && strings.HasPrefix(el.Name(), ".") { if *skipHidden && strings.HasPrefix(el.Name(), ".") {
continue // dont print hidden files if we're not allowed continue // dont print hidden files if we're not allowed
} }
if !*symlinks && info.Mode()&os.ModeSymlink != 0 { if *symlinks && info.Mode()&os.ModeSymlink != 0 {
continue // dont follow symlinks if we're not allowed continue // dont follow symlinks if we're not allowed
} }
@@ -127,7 +126,7 @@ func replyList(w http.ResponseWriter, r *http.Request, fullPath string, path str
} else { } else {
sl := strings.Split(name, ".") sl := strings.Split(name, ".")
ext := strings.ToLower(sl[len(sl)-1]) ext := strings.ToLower(sl[len(sl)-1])
row := rowTemplate{name, template.URL(href), humanize(el.Size()), ext} row := rowTemplate{name, template.URL(href), humanize(info.Size()), ext}
p.RowsFiles = append(p.RowsFiles, row) p.RowsFiles = append(p.RowsFiles, row)
} }
} }
-7
View File
@@ -238,8 +238,6 @@ func doTestRegular(t *testing.T, url string, testExtra bool) {
hasListing := strings.Contains(body0, `readme.md`) hasListing := strings.Contains(body0, `readme.md`)
body1 = get(t, url+"/support/readme.md") body1 = get(t, url+"/support/readme.md")
hasReadme := strings.Contains(body1, `the master branch is automatically built and pushed`) hasReadme := strings.Contains(body1, `the master branch is automatically built and pushed`)
body2 = get(t, url)
hasMainListing := strings.Contains(body2, `href="support">support/</a>`)
if !testExtra && hasReadme { if !testExtra && hasReadme {
t.Fatal("error symlink file reached where illegal") t.Fatal("error symlink file reached where illegal")
@@ -251,11 +249,6 @@ func doTestRegular(t *testing.T, url string, testExtra bool) {
} else if testExtra && !hasListing { } else if testExtra && !hasListing {
t.Fatal("error symlink folder unreachable") t.Fatal("error symlink folder unreachable")
} }
if !testExtra && hasMainListing {
t.Fatal("error symlink folder where illegal")
} else if testExtra && !hasMainListing {
t.Fatal("error symlink folder unreachable")
}
if testExtra { if testExtra {
fmt.Println("\r\n~~~~~~~~~~ test symlink mkdir & cleanup") fmt.Println("\r\n~~~~~~~~~~ test symlink mkdir & cleanup")
+1 -2
View File
@@ -1,5 +1,4 @@
FROM docker.io/library/golang:1.23.0-alpine AS builder FROM golang:1.23.0 as builder
RUN apk add --no-cache make
WORKDIR /gossaSrc WORKDIR /gossaSrc
COPY . /gossaSrc COPY . /gossaSrc
RUN make RUN make