build: Bump bagop and hydrun support, drop unsupported Windows builds

This commit is contained in:
Felicitas Pojtinger
2023-09-12 23:57:48 +02:00
parent c97bc8ecfe
commit e78f1f1b6f
11 changed files with 64 additions and 82 deletions

View File

@@ -6,6 +6,9 @@ on:
schedule: schedule:
- cron: "0 0 * * 0" - cron: "0 0 * * 0"
permissions:
contents: write
jobs: jobs:
build-linux: build-linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -14,27 +17,21 @@ jobs:
target: target:
- id: test - id: test
src: . src: .
os: golang:1.18beta1-bullseye # 1.18 is required due to `GroupIds` requiring CGo on older versions os: golang:bookworm
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
flags: "" flags: ""
cmd: ./Hydrunfile go cmd: go test ./...
dst: out/* dst: out/*
- id: gccgo - id: go-stfs
src: .
os: golang:bookworm
flags: ""
cmd: ./Hydrunfile go stfs
dst: out/*
- id: gccgo-stfs
src: . src: .
os: ghcr.io/pojntfx/bagccgop-base-sid os: ghcr.io/pojntfx/bagccgop-base-sid
flags: -e '--privileged' flags: -e '--privileged'
cmd: ./Hydrunfile gccgo cmd: ./Hydrunfile gccgo stfs
dst: out/*
- id: windows-386
src: .
os: fedora:rawhide
flags: -e '--privileged'
cmd: ./Hydrunfile windows 386
dst: out/* dst: out/*
steps: steps:
@@ -63,6 +60,7 @@ jobs:
with: with:
name: ${{ matrix.target.id }} name: ${{ matrix.target.id }}
path: ${{ matrix.target.dst }} path: ${{ matrix.target.dst }}
publish-linux: publish-linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build-linux needs: build-linux
@@ -74,12 +72,15 @@ jobs:
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
with: with:
path: /tmp/out 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 - name: Publish pre-release to GitHub releases
if: ${{ github.ref == 'refs/heads/main' }} if: ${{ github.ref == 'refs/heads/main' }}
uses: marvinpinto/action-automatic-releases@latest uses: marvinpinto/action-automatic-releases@latest
with: with:
repo_token: "${{ secrets.GITHUB_TOKEN }}" repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: unstable automatic_release_tag: release-${{ steps.extract_branch.outputs.branch }}
prerelease: true prerelease: true
files: | files: |
/tmp/out/*/* /tmp/out/*/*

View File

@@ -4,6 +4,9 @@ set -e
# Test # Test
if [ "$1" = "test" ]; then if [ "$1" = "test" ]; then
# Configure Git
git config --global --add safe.directory '*'
# Generate dependencies # Generate dependencies
make depend 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)" curl -L -o /tmp/bagop "https://github.com/pojntfx/bagop/releases/latest/download/bagop.linux-$(uname -m)"
install /tmp/bagop /usr/local/bin install /tmp/bagop /usr/local/bin
# Configure Git
git config --global --add safe.directory '*'
# Generate dependencies # Generate dependencies
make depend make depend
# Build # 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 exit 0
fi 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)" curl -L -o /tmp/bagccgop "https://github.com/pojntfx/bagccgop/releases/latest/download/bagccgop.linux-$(uname -m)"
install /tmp/bagccgop /usr/local/bin install /tmp/bagccgop /usr/local/bin
# Configure Git
git config --global --add safe.directory '*'
# Generate dependencies
make depend
# Build # 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 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
# 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
exit 0 exit 0
fi fi

View File

@@ -50,4 +50,5 @@ depend:
go install github.com/volatiletech/sqlboiler-sqlite3@latest go install github.com/volatiletech/sqlboiler-sqlite3@latest
go install github.com/jteeuwen/go-bindata/go-bindata@latest go install github.com/jteeuwen/go-bindata/go-bindata@latest
sql-migrate up -env="production" -config configs/sql-migrate/metadata.yaml sql-migrate up -env="production" -config configs/sql-migrate/metadata.yaml
go generate ./... go generate ./...

View File

@@ -40,12 +40,6 @@ $ curl -L -o /tmp/stfs "https://github.com/pojntfx/stfs/releases/latest/download
$ sudo install /tmp/stfs /usr/local/bin $ 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). You can find binaries for more operating systems and architectures on [GitHub releases](https://github.com/pojntfx/stfs/releases).
## Usage ## 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. - [ProtonMail/gopenpgp](github.com/ProtonMail/gopenpgp) provides the PGP signature and encryption implementation.
- [fclairamb/ftpserverlib](github.com/fclairamb/ftpserverlib) provides the FTP server 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. - [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 ## Contributing
@@ -621,6 +614,6 @@ Have any questions or need help? Chat with us [on Matrix](https://matrix.to/#/#s
## License ## License
STFS (c) 2022 Felicitas Pojtinger and contributors STFS (c) 2023 Felicitas Pojtinger and contributors
SPDX-License-Identifier: AGPL-3.0 SPDX-License-Identifier: AGPL-3.0

View File

@@ -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. // This file is meant to be re-generated in place and/or deleted at any time.
package models package models
import ( import (
"regexp"
"github.com/volatiletech/sqlboiler/v4/drivers" "github.com/volatiletech/sqlboiler/v4/drivers"
"github.com/volatiletech/sqlboiler/v4/queries" "github.com/volatiletech/sqlboiler/v4/queries"
"github.com/volatiletech/sqlboiler/v4/queries/qm" "github.com/volatiletech/sqlboiler/v4/queries/qm"
@@ -23,6 +25,9 @@ var dialect = drivers.Dialect{
UseCaseWhenExistsClause: false, UseCaseWhenExistsClause: false,
} }
// This is a dummy variable to prevent unused regexp import error
var _ = &regexp.Regexp{}
// NewQuery initializes a new Query using the passed in QueryMods // NewQuery initializes a new Query using the passed in QueryMods
func NewQuery(mods ...qm.QueryMod) *queries.Query { func NewQuery(mods ...qm.QueryMod) *queries.Query {
q := &queries.Query{} q := &queries.Query{}

View File

@@ -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. // This file is meant to be re-generated in place and/or deleted at any time.
package models package models

View File

@@ -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. // This file is meant to be re-generated in place and/or deleted at any time.
package models package models

View File

@@ -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. // This file is meant to be re-generated in place and/or deleted at any time.
package models package models

View File

@@ -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. // This file is meant to be re-generated in place and/or deleted at any time.
package models package models
@@ -57,6 +57,8 @@ func (w whereHelperstring) LT(x string) qm.QueryMod { return qmhelper.Where(w.f
func (w whereHelperstring) LTE(x string) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.LTE, 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) 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) 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 { func (w whereHelperstring) IN(slice []string) qm.QueryMod {
values := make([]interface{}, 0, len(slice)) values := make([]interface{}, 0, len(slice))
for _, value := range slice { for _, value := range slice {
@@ -821,6 +823,11 @@ func GorpMigrationExists(ctx context.Context, exec boil.ContextExecutor, iD stri
return exists, nil 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. // 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. // 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 { func (o *GorpMigration) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {

View File

@@ -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. // This file is meant to be re-generated in place and/or deleted at any time.
package models package models
@@ -950,6 +950,11 @@ func HeaderExists(ctx context.Context, exec boil.ContextExecutor, name string, l
return exists, nil 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. // 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. // 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 { func (o *Header) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {

View File

@@ -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. // This file is meant to be re-generated in place and/or deleted at any time.
package models package models