From e78f1f1b6f86fe2991718d261907b039f05a9f6d Mon Sep 17 00:00:00 2001 From: Felicitas Pojtinger Date: Tue, 12 Sep 2023 23:57:48 +0200 Subject: [PATCH] build: Bump bagop and hydrun support, drop unsupported Windows builds --- .github/workflows/hydrun.yaml | 35 +++++------ Hydrunfile | 58 +++++-------------- Makefile | 1 + README.md | 9 +-- .../db/sqlite/models/metadata/boil_queries.go | 7 ++- .../models/metadata/boil_table_names.go | 2 +- .../db/sqlite/models/metadata/boil_types.go | 2 +- .../sqlite/models/metadata/boil_view_names.go | 2 +- .../sqlite/models/metadata/gorp_migrations.go | 21 ++++--- internal/db/sqlite/models/metadata/headers.go | 7 ++- .../sqlite/models/metadata/sqlite_upsert.go | 2 +- 11 files changed, 64 insertions(+), 82 deletions(-) diff --git a/.github/workflows/hydrun.yaml b/.github/workflows/hydrun.yaml index a422dcf..7543a96 100644 --- a/.github/workflows/hydrun.yaml +++ b/.github/workflows/hydrun.yaml @@ -6,6 +6,9 @@ on: schedule: - cron: "0 0 * * 0" +permissions: + contents: write + jobs: build-linux: runs-on: ubuntu-latest @@ -14,27 +17,21 @@ jobs: target: - id: test src: . - os: golang:1.18beta1-bullseye # 1.18 is required due to `GroupIds` requiring CGo on older versions - flags: "-e '--ulimit nofile=262144:262144'" # Parallel tests require a lot of open files - cmd: GOFLAGS="-short" ./Hydrunfile test - dst: out/* - - id: go - src: . - os: golang:1.18beta1-bullseye # 1.18 is required due to `GroupIds` requiring CGo on older versions + os: golang:bookworm flags: "" - cmd: ./Hydrunfile go + cmd: go test ./... dst: out/* - - id: gccgo + - id: go-stfs + src: . + os: golang:bookworm + flags: "" + cmd: ./Hydrunfile go stfs + dst: out/* + - id: gccgo-stfs src: . os: ghcr.io/pojntfx/bagccgop-base-sid flags: -e '--privileged' - cmd: ./Hydrunfile gccgo - dst: out/* - - id: windows-386 - src: . - os: fedora:rawhide - flags: -e '--privileged' - cmd: ./Hydrunfile windows 386 + cmd: ./Hydrunfile gccgo stfs dst: out/* steps: @@ -63,6 +60,7 @@ jobs: with: name: ${{ matrix.target.id }} path: ${{ matrix.target.dst }} + publish-linux: runs-on: ubuntu-latest needs: build-linux @@ -74,12 +72,15 @@ jobs: uses: actions/download-artifact@v2 with: path: /tmp/out + - name: Extract branch name + id: extract_branch + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - name: Publish pre-release to GitHub releases if: ${{ github.ref == 'refs/heads/main' }} uses: marvinpinto/action-automatic-releases@latest with: repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: unstable + automatic_release_tag: release-${{ steps.extract_branch.outputs.branch }} prerelease: true files: | /tmp/out/*/* diff --git a/Hydrunfile b/Hydrunfile index ec044b0..d30524c 100755 --- a/Hydrunfile +++ b/Hydrunfile @@ -4,6 +4,9 @@ set -e # Test if [ "$1" = "test" ]; then + # Configure Git + git config --global --add safe.directory '*' + # Generate dependencies make depend @@ -23,11 +26,14 @@ if [ "$1" = "go" ]; then curl -L -o /tmp/bagop "https://github.com/pojntfx/bagop/releases/latest/download/bagop.linux-$(uname -m)" install /tmp/bagop /usr/local/bin + # Configure Git + git config --global --add safe.directory '*' + # Generate dependencies make depend # Build - CGO_ENABLED=0 bagop -j "$(nproc)" -b stfs -x '(android/*|ios/*|aix/*|plan9/*|illumos/*|dragonfly/*|netbsd/*|openbsd/*|solaris/*|freebsd/(386|arm)|js/wasm|linux/(mips|ppc64|riscv64)|windows/(arm|386))' -p 'make build/stfs DST=$DST' -d out + CGO_ENABLED=0 bagop -j "$(nproc)" -b "$2" -x '(android/*|ios/*|aix/*|plan9/*|illumos/*|dragonfly/*|netbsd/*|openbsd/*|solaris/*|freebsd/(386|arm|riscv64)|js/wasm|linux/(mips|ppc64|riscv64|loong64)|windows/(arm|386)|wasip1/wasm)' -p 'make build/stfs DST=$DST' -d out exit 0 fi @@ -42,50 +48,14 @@ if [ "$1" = "gccgo" ]; then curl -L -o /tmp/bagccgop "https://github.com/pojntfx/bagccgop/releases/latest/download/bagccgop.linux-$(uname -m)" install /tmp/bagccgop /usr/local/bin + # Configure Git + git config --global --add safe.directory '*' + + # Generate dependencies + make depend + # Build - GOFLAGS='-gccgoflags=-static' bagccgop -x '(linux/alpha|linux/mipsle|linux/arm$|linux/arm64|linux/386|linux/amd64|linux/s390x)' -j1 -b stfs -n -r 'make depend' -s 'build-essential,automake' -m 'libsqlite3-dev' -p 'make build/stfs DST=$DST' -d out - - exit 0 -fi - -# Windows -if [ "$1" = "windows" ]; then - # Install native dependencies - dnf update -y - dnf install -y curl wine - - # Install MSYS2 - curl -L -o /tmp/msys2.exe 'https://github.com/msys2/msys2-installer/releases/download/2021-11-30/msys2-base-x86_64-20211130.sfx.exe' - wine64 /tmp/msys2.exe x -y -oC:/ - - # Fix MSYS2 - sed -i ~/.wine/drive_c/msys64/etc/pacman.conf -e 's/SigLevel = Required/SigLevel = Never/g' - cat /etc/pki/tls/certs/ca-bundle.crt >~/.wine/drive_c/msys64/usr/ssl/certs/ca-bundle.crt - cat /etc/pki/tls/certs/ca-bundle.trust.crt >~/.wine/drive_c/msys64/usr/ssl/certs/ca-bundle.trust.crt - export WINEPATH='c:\msys64\usr\bin' - - # Copy source code to directory on C drive - mkdir -p ~/.wine/drive_c/users/root/Documents/stfs - cp -rf . ~/.wine/drive_c/users/root/Documents/stfs - mkdir -p ~/.wine/drive_c/users/root/go - - if [ "$2" = "386" ]; then - # Install GCC and Go - wine64 bash.exe -c 'pacman --verbose --debug --noconfirm --ignore pacman --needed -S base-devel mingw-w64-i686-gcc mingw-w64-i686-go' - - # Build - wine64 bash.exe -c 'export PATH="$PATH:/mingw32/bin" && cd /c/users/root/Documents/stfs && export GOPATH="/c/users/root/go" && export GOROOT="/mingw32/lib/go" && export GOARCH=386 && go build -o out/stfs.windows-i686.exe ./cmd/stfs' - else - # Install GCC and Go - wine64 bash.exe -c 'pacman --verbose --debug --noconfirm --ignore pacman --needed -S base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-go' - - # Build - wine64 bash.exe -c 'export PATH="$PATH:/mingw64/bin" && cd /c/users/root/Documents/stfs && export GOPATH="/c/users/root/go" && export GOROOT="/mingw64/lib/go" export GOARCH=amd64 && go build -o out/stfs.windows-x86_64.exe ./cmd/stfs' - fi - - # Copy binaries to staging directory - mkdir -p out - yes | cp -f ~/.wine/drive_c/users/root/Documents/stfs/out/* out + GOFLAGS='-gccgoflags=-static' bagccgop -x '(linux/alpha|linux/mipsle|linux/arm$|linux/arm64|linux/386|linux/amd64|linux/s390x)' -j1 -b "$1" -n -r 'make depend' -s 'build-essential,automake' -m 'libsqlite3-dev' -p 'make build/stfs DST=$DST' -d out exit 0 fi diff --git a/Makefile b/Makefile index 150ec1c..3df01be 100644 --- a/Makefile +++ b/Makefile @@ -50,4 +50,5 @@ depend: go install github.com/volatiletech/sqlboiler-sqlite3@latest go install github.com/jteeuwen/go-bindata/go-bindata@latest sql-migrate up -env="production" -config configs/sql-migrate/metadata.yaml + go generate ./... \ No newline at end of file diff --git a/README.md b/README.md index b1a6e06..d353c63 100644 --- a/README.md +++ b/README.md @@ -40,12 +40,6 @@ $ curl -L -o /tmp/stfs "https://github.com/pojntfx/stfs/releases/latest/download $ sudo install /tmp/stfs /usr/local/bin ``` -On Windows, the following should work (using PowerShell as administrator): - -```shell -PS> Invoke-WebRequest https://github.com/pojntfx/stfs/releases/latest/download/stfs.windows-x86_64.exe -OutFile \Windows\System32\stfs.exe -``` - You can find binaries for more operating systems and architectures on [GitHub releases](https://github.com/pojntfx/stfs/releases). ## Usage @@ -601,7 +595,6 @@ All command line arguments described above can also be set using environment var - [ProtonMail/gopenpgp](github.com/ProtonMail/gopenpgp) provides the PGP signature and encryption implementation. - [fclairamb/ftpserverlib](github.com/fclairamb/ftpserverlib) provides the FTP server implementation. - [spf13/afero](https://github.com/spf13/afero) provides the file system abstraction layer implementation. -- All the rest of the authors who worked on the dependencies used! Thanks a lot! ## Contributing @@ -621,6 +614,6 @@ Have any questions or need help? Chat with us [on Matrix](https://matrix.to/#/#s ## License -STFS (c) 2022 Felicitas Pojtinger and contributors +STFS (c) 2023 Felicitas Pojtinger and contributors SPDX-License-Identifier: AGPL-3.0 diff --git a/internal/db/sqlite/models/metadata/boil_queries.go b/internal/db/sqlite/models/metadata/boil_queries.go index c438e9d..c83b05a 100644 --- a/internal/db/sqlite/models/metadata/boil_queries.go +++ b/internal/db/sqlite/models/metadata/boil_queries.go @@ -1,9 +1,11 @@ -// Code generated by SQLBoiler 4.11.0 (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. +// Code generated by SQLBoiler 4.15.0 (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( + "regexp" + "github.com/volatiletech/sqlboiler/v4/drivers" "github.com/volatiletech/sqlboiler/v4/queries" "github.com/volatiletech/sqlboiler/v4/queries/qm" @@ -23,6 +25,9 @@ var dialect = drivers.Dialect{ UseCaseWhenExistsClause: false, } +// This is a dummy variable to prevent unused regexp import error +var _ = ®exp.Regexp{} + // NewQuery initializes a new Query using the passed in QueryMods func NewQuery(mods ...qm.QueryMod) *queries.Query { q := &queries.Query{} diff --git a/internal/db/sqlite/models/metadata/boil_table_names.go b/internal/db/sqlite/models/metadata/boil_table_names.go index 6d8b6f5..3db12fd 100644 --- a/internal/db/sqlite/models/metadata/boil_table_names.go +++ b/internal/db/sqlite/models/metadata/boil_table_names.go @@ -1,4 +1,4 @@ -// Code generated by SQLBoiler 4.11.0 (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. +// Code generated by SQLBoiler 4.15.0 (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models diff --git a/internal/db/sqlite/models/metadata/boil_types.go b/internal/db/sqlite/models/metadata/boil_types.go index 3d1f76d..23ad5ac 100644 --- a/internal/db/sqlite/models/metadata/boil_types.go +++ b/internal/db/sqlite/models/metadata/boil_types.go @@ -1,4 +1,4 @@ -// Code generated by SQLBoiler 4.11.0 (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. +// Code generated by SQLBoiler 4.15.0 (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models diff --git a/internal/db/sqlite/models/metadata/boil_view_names.go b/internal/db/sqlite/models/metadata/boil_view_names.go index 8ae6405..9f42d9e 100644 --- a/internal/db/sqlite/models/metadata/boil_view_names.go +++ b/internal/db/sqlite/models/metadata/boil_view_names.go @@ -1,4 +1,4 @@ -// Code generated by SQLBoiler 4.11.0 (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. +// Code generated by SQLBoiler 4.15.0 (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models diff --git a/internal/db/sqlite/models/metadata/gorp_migrations.go b/internal/db/sqlite/models/metadata/gorp_migrations.go index 64eaa3c..5259f7e 100644 --- a/internal/db/sqlite/models/metadata/gorp_migrations.go +++ b/internal/db/sqlite/models/metadata/gorp_migrations.go @@ -1,4 +1,4 @@ -// Code generated by SQLBoiler 4.11.0 (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. +// Code generated by SQLBoiler 4.15.0 (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models @@ -51,12 +51,14 @@ var GorpMigrationTableColumns = struct { type whereHelperstring struct{ field string } -func (w whereHelperstring) EQ(x string) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.EQ, x) } -func (w whereHelperstring) NEQ(x string) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.NEQ, x) } -func (w whereHelperstring) LT(x string) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.LT, x) } -func (w whereHelperstring) LTE(x string) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.LTE, x) } -func (w whereHelperstring) GT(x string) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.GT, x) } -func (w whereHelperstring) GTE(x string) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.GTE, x) } +func (w whereHelperstring) EQ(x string) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.EQ, x) } +func (w whereHelperstring) NEQ(x string) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.NEQ, x) } +func (w whereHelperstring) LT(x string) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.LT, x) } +func (w whereHelperstring) LTE(x string) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.LTE, x) } +func (w whereHelperstring) GT(x string) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.GT, x) } +func (w whereHelperstring) GTE(x string) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.GTE, x) } +func (w whereHelperstring) LIKE(x string) qm.QueryMod { return qm.Where(w.field+" LIKE ?", x) } +func (w whereHelperstring) NLIKE(x string) qm.QueryMod { return qm.Where(w.field+" NOT LIKE ?", x) } func (w whereHelperstring) IN(slice []string) qm.QueryMod { values := make([]interface{}, 0, len(slice)) for _, value := range slice { @@ -821,6 +823,11 @@ func GorpMigrationExists(ctx context.Context, exec boil.ContextExecutor, iD stri return exists, nil } +// Exists checks if the GorpMigration row exists. +func (o *GorpMigration) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) { + return GorpMigrationExists(ctx, exec, o.ID) +} + // Upsert attempts an insert using an executor, and does an update or ignore on conflict. // See boil.Columns documentation for how to properly use updateColumns and insertColumns. func (o *GorpMigration) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error { diff --git a/internal/db/sqlite/models/metadata/headers.go b/internal/db/sqlite/models/metadata/headers.go index e5d0b0c..2b37bc2 100644 --- a/internal/db/sqlite/models/metadata/headers.go +++ b/internal/db/sqlite/models/metadata/headers.go @@ -1,4 +1,4 @@ -// Code generated by SQLBoiler 4.11.0 (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. +// Code generated by SQLBoiler 4.15.0 (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models @@ -950,6 +950,11 @@ func HeaderExists(ctx context.Context, exec boil.ContextExecutor, name string, l return exists, nil } +// Exists checks if the Header row exists. +func (o *Header) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) { + return HeaderExists(ctx, exec, o.Name, o.Linkname) +} + // Upsert attempts an insert using an executor, and does an update or ignore on conflict. // See boil.Columns documentation for how to properly use updateColumns and insertColumns. func (o *Header) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error { diff --git a/internal/db/sqlite/models/metadata/sqlite_upsert.go b/internal/db/sqlite/models/metadata/sqlite_upsert.go index b6b65e6..0c050d4 100644 --- a/internal/db/sqlite/models/metadata/sqlite_upsert.go +++ b/internal/db/sqlite/models/metadata/sqlite_upsert.go @@ -1,4 +1,4 @@ -// Code generated by SQLBoiler 4.11.0 (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. +// Code generated by SQLBoiler 4.15.0 (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models