Skip to content

Commit 3aff00b

Browse files
committed
refactor: Update dependencies, modernize Hydrun build systems, CI/CD and README conventions
Signed-off-by: Felicitas Pojtinger <[email protected]>
1 parent f3fbd31 commit 3aff00b

File tree

14 files changed

+522
-553
lines changed

14 files changed

+522
-553
lines changed

.github/workflows/hydrun.yaml

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,31 @@ on:
66
schedule:
77
- cron: "0 0 * * 0"
88

9-
permissions:
10-
contents: write
11-
129
jobs:
1310
build-linux:
14-
runs-on: ubuntu-latest
11+
runs-on: ${{ matrix.target.runner }}
12+
permissions:
13+
contents: read
1514
strategy:
1615
matrix:
1716
target:
17+
# Tests
1818
- id: test
1919
src: .
2020
os: golang:bookworm
21-
flags: ""
21+
flags: -e '-v /tmp/ccache:/root/.cache/go-build'
2222
cmd: GOFLAGS="-short" ./Hydrunfile test
2323
dst: out/nonexistent
24-
- id: go-stfs
24+
runner: ubuntu-latest
25+
26+
# Binaries
27+
- id: go.stfs
2528
src: .
2629
os: golang:bookworm
27-
flags: ""
30+
flags: -e '-v /tmp/ccache:/root/.cache/go-build'
2831
cmd: ./Hydrunfile go stfs
2932
dst: out/*
30-
# Disabled until `gccgo` supports generics/Go 1.21: https://go.dev/doc/install/gccgo
31-
# - id: gccgo-stfs
32-
# src: .
33-
# os: ghcr.io/pojntfx/bagccgop-base-sid
34-
# flags: -e '--privileged'
35-
# cmd: ./Hydrunfile gccgo stfs
36-
# dst: out/*
33+
runner: ubuntu-latest
3734

3835
steps:
3936
- name: Maximize build space
@@ -42,11 +39,17 @@ jobs:
4239
sudo rm -rf /usr/local/lib/android
4340
sudo rm -rf /opt/ghc
4441
- name: Checkout
45-
uses: actions/checkout@v2
42+
uses: actions/checkout@v4
43+
- name: Restore ccache
44+
uses: actions/cache/restore@v4
45+
with:
46+
path: |
47+
/tmp/ccache
48+
key: cache-ccache-${{ matrix.target.id }}
4649
- name: Set up QEMU
47-
uses: docker/setup-qemu-action@v1
50+
uses: docker/setup-qemu-action@v3
4851
- name: Set up Docker Buildx
49-
uses: docker/setup-buildx-action@v1
52+
uses: docker/setup-buildx-action@v3
5053
- name: Set up hydrun
5154
run: |
5255
curl -L -o /tmp/hydrun "https://github.com/pojntfx/hydrun/releases/latest/download/hydrun.linux-$(uname -m)"
@@ -56,40 +59,46 @@ jobs:
5659
run: hydrun -o ${{ matrix.target.os }} ${{ matrix.target.flags }} "${{ matrix.target.cmd }}"
5760
- name: Fix permissions for output
5861
run: sudo chown -R $USER .
62+
- name: Save ccache
63+
uses: actions/cache/save@v4
64+
with:
65+
path: |
66+
/tmp/ccache
67+
key: cache-ccache-${{ matrix.target.id }}
5968
- name: Upload output
60-
uses: actions/upload-artifact@v2
69+
uses: actions/upload-artifact@v4
6170
with:
6271
name: ${{ matrix.target.id }}
6372
path: ${{ matrix.target.dst }}
6473

6574
publish-linux:
6675
runs-on: ubuntu-latest
76+
permissions:
77+
contents: write
6778
needs: build-linux
6879

6980
steps:
7081
- name: Checkout
71-
uses: actions/checkout@v2
82+
uses: actions/checkout@v4
7283
- name: Download output
73-
uses: actions/download-artifact@v2
84+
uses: actions/download-artifact@v4
7485
with:
7586
path: /tmp/out
7687
- name: Extract branch name
7788
id: extract_branch
7889
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
7990
- name: Publish pre-release to GitHub releases
8091
if: ${{ github.ref == 'refs/heads/main' }}
81-
uses: marvinpinto/action-automatic-releases@latest
92+
uses: softprops/action-gh-release@v2
8293
with:
83-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
84-
automatic_release_tag: release-${{ steps.extract_branch.outputs.branch }}
94+
tag_name: release-${{ steps.extract_branch.outputs.branch }}
8595
prerelease: true
8696
files: |
8797
/tmp/out/*/*
8898
- name: Publish release to GitHub releases
8999
if: startsWith(github.ref, 'refs/tags/v')
90-
uses: marvinpinto/action-automatic-releases@latest
100+
uses: softprops/action-gh-release@v2
91101
with:
92-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
93102
prerelease: false
94103
files: |
95104
/tmp/out/*/*

Hydrunfile

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,3 @@ if [ "$1" = "go" ]; then
3737

3838
exit 0
3939
fi
40-
41-
# gccgo
42-
if [ "$1" = "gccgo" ]; then
43-
# Install native dependencies
44-
apt update
45-
apt install -y curl git
46-
47-
# Install bagccgop
48-
curl -L -o /tmp/bagccgop "https://github.com/pojntfx/bagccgop/releases/latest/download/bagccgop.linux-$(uname -m)"
49-
install /tmp/bagccgop /usr/local/bin
50-
51-
# Configure Git
52-
git config --global --add safe.directory '*'
53-
54-
# Build
55-
GOFLAGS='-gccgoflags=-static' bagccgop -x '(linux/alpha|linux/mipsle|linux/arm$|linux/arm64|linux/386|linux/amd64|linux/s390x)' -j1 -b "$2" -n -r 'make depend' -s 'build-essential,automake' -m 'libsqlite3-dev' -p 'make build/stfs DST=$DST' -d out
56-
57-
exit 0
58-
fi

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22

33
Simple Tape File System (STFS), a file system for tapes and tar files.
44

5-
⚠️ STFS has not yet been audited! While we try to make it as secure as possible, it has not yet undergone a formal security audit by a third party. Please keep this in mind if you use it for security-critical applications. ⚠️
6-
75
[![hydrun CI](https://github.com/pojntfx/stfs/actions/workflows/hydrun.yaml/badge.svg)](https://github.com/pojntfx/stfs/actions/workflows/hydrun.yaml)
8-
![Go Version](https://img.shields.io/badge/go%20version-%3E=1.17-61CFDD.svg)
6+
![Go Version](https://img.shields.io/badge/go%20version-%3E=1.21-61CFDD.svg)
97
[![Go Reference](https://pkg.go.dev/badge/github.com/pojntfx/stfs.svg)](https://pkg.go.dev/github.com/pojntfx/stfs)
108
[![Matrix](https://img.shields.io/matrix/stfs:matrix.org)](https://matrix.to/#/#stfs:matrix.org?via=matrix.org)
119

1210
## Overview
1311

1412
STFS is a filesystem that brings tapes and tar files into the 21st century.
1513

16-
It enables you too ...
14+
It enables you to:
1715

1816
- **Use a tape or tar file like a regular disk**: STFS uses the robust `tar` format and tape technology to provide a fully features filesystem. This makes such storage solutions much for accessible and manageable, while also significantly increasing the performance of everyday operations such as listing and searching for files by using a SQLite-based on-disk index.
1917
- **Archive data securely**: The integrated transparent, asymmetrical encryption and signature support makes it possible to use almost any tape as a regulations compliant storage medium, while still being able to take advantage of all the benefits of tapes like reduced cost and increased reliability.
@@ -39,9 +37,17 @@ $ curl -L -o /tmp/stfs "https://github.com/pojntfx/stfs/releases/latest/download
3937
$ sudo install /tmp/stfs /usr/local/bin
4038
```
4139

40+
On Windows, the following should work (using PowerShell as administrator):
41+
42+
```shell
43+
PS> Invoke-WebRequest https://github.com/pojntfx/stfs/releases/latest/download/stfs.windows-x86_64.exe -OutFile \Windows\System32\stfs.exe
44+
```
45+
46+
Note that only the Linux version supports reading from tape drives; macOS and Windows are limited to operating on tar files.
47+
4248
You can find binaries for more operating systems and architectures on [GitHub releases](https://github.com/pojntfx/stfs/releases).
4349

44-
## Usage
50+
## Tutorial
4551

4652
> Please note that this is only a short overview and does not explain all configuration options. To get more info on available commands or options, use `--help`.
4753
@@ -613,6 +619,6 @@ Have any questions or need help? Chat with us [on Matrix](https://matrix.to/#/#s
613619
614620
## License
615621
616-
STFS (c) 2023 Felicitas Pojtinger and contributors
622+
STFS (c) 2024 Felicitas Pojtinger and contributors
617623
618624
SPDX-License-Identifier: AGPL-3.0

examples/logger.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ func (l Logger) Error(event string, keyvals ...interface{}) {
4141
l.log("ERROR", event, keyvals)
4242
}
4343

44+
func (l Logger) Panic(event string, keyvals ...interface{}) {
45+
l.log("PANIC", event, keyvals)
46+
}
47+
4448
func (l Logger) With(keyvals ...interface{}) golog.Logger {
4549
return l
4650
}

go.mod

Lines changed: 56 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,73 @@
11
module github.com/pojntfx/stfs
22

3-
go 1.17
3+
go 1.21
4+
5+
toolchain go1.22.5
46

57
require (
6-
aead.dev/minisign v0.2.0
7-
filippo.io/age v1.0.0
8-
github.com/ProtonMail/go-crypto v0.0.0-20211112122917-428f8eabeeb3
9-
github.com/ProtonMail/gopenpgp/v2 v2.3.1
10-
github.com/andybalholm/brotli v1.0.4
11-
github.com/cosnicolaou/pbzip2 v1.0.1
8+
aead.dev/minisign v0.3.0
9+
filippo.io/age v1.2.0
10+
github.com/ProtonMail/go-crypto v1.0.0
11+
github.com/ProtonMail/gopenpgp/v2 v2.7.5
12+
github.com/andybalholm/brotli v1.1.0
13+
github.com/cosnicolaou/pbzip2 v1.0.3
1214
github.com/dsnet/compress v0.0.1
13-
github.com/fclairamb/ftpserverlib v0.16.0
14-
github.com/fclairamb/go-log v0.1.0
15+
github.com/fclairamb/ftpserverlib v0.24.1
16+
github.com/fclairamb/go-log v0.5.0
1517
github.com/friendsofgo/errors v0.9.2
16-
github.com/klauspost/compress v1.13.6
17-
github.com/klauspost/pgzip v1.2.5
18+
github.com/klauspost/compress v1.17.9
19+
github.com/klauspost/pgzip v1.2.6
1820
github.com/mattetti/filebuffer v1.0.1
19-
github.com/mattn/go-sqlite3 v1.14.9
20-
github.com/pierrec/lz4/v4 v4.1.12
21-
github.com/rubenv/sql-migrate v0.0.0-20211023115951-9f02b1e13857
22-
github.com/spf13/afero v1.8.0
23-
github.com/spf13/cobra v1.3.0
24-
github.com/spf13/viper v1.10.1
21+
github.com/mattn/go-sqlite3 v1.14.22
22+
github.com/pierrec/lz4/v4 v4.1.21
23+
github.com/rubenv/sql-migrate v1.7.0
24+
github.com/spf13/afero v1.11.0
25+
github.com/spf13/cobra v1.8.1
26+
github.com/spf13/viper v1.19.0
2527
github.com/volatiletech/null/v8 v8.1.2
26-
github.com/volatiletech/sqlboiler/v4 v4.8.3
27-
github.com/volatiletech/strmangle v0.0.1
28-
modernc.org/sqlite v1.14.3
28+
github.com/volatiletech/sqlboiler/v4 v4.16.2
29+
github.com/volatiletech/strmangle v0.0.6
30+
modernc.org/sqlite v1.31.1
2931
)
3032

3133
require (
32-
github.com/ProtonMail/go-mime v0.0.0-20190923161245-9b5a4261663a // indirect
33-
github.com/fsnotify/fsnotify v1.5.1 // indirect
34-
github.com/gofrs/uuid v3.2.0+incompatible // indirect
35-
github.com/google/uuid v1.3.0 // indirect
34+
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f // indirect
35+
github.com/cloudflare/circl v1.3.9 // indirect
36+
github.com/dustin/go-humanize v1.0.1 // indirect
37+
github.com/fsnotify/fsnotify v1.7.0 // indirect
38+
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
39+
github.com/gofrs/uuid v4.4.0+incompatible // indirect
40+
github.com/google/uuid v1.6.0 // indirect
41+
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
3642
github.com/hashicorp/hcl v1.0.0 // indirect
37-
github.com/inconshreveable/mousetrap v1.0.0 // indirect
38-
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
39-
github.com/magiconair/properties v1.8.5 // indirect
40-
github.com/mattn/go-isatty v0.0.14 // indirect
41-
github.com/mitchellh/mapstructure v1.4.3 // indirect
42-
github.com/pelletier/go-toml v1.9.4 // indirect
43+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
44+
github.com/magiconair/properties v1.8.7 // indirect
45+
github.com/mattn/go-isatty v0.0.20 // indirect
46+
github.com/mitchellh/mapstructure v1.5.0 // indirect
47+
github.com/ncruces/go-strftime v0.1.9 // indirect
48+
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
4349
github.com/pkg/errors v0.9.1 // indirect
44-
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
45-
github.com/sirupsen/logrus v1.8.1 // indirect
46-
github.com/spf13/cast v1.4.1 // indirect
47-
github.com/spf13/jwalterweatherman v1.1.0 // indirect
50+
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
51+
github.com/sagikazarmark/locafero v0.6.0 // indirect
52+
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
53+
github.com/sourcegraph/conc v0.3.0 // indirect
54+
github.com/spf13/cast v1.6.0 // indirect
4855
github.com/spf13/pflag v1.0.5 // indirect
49-
github.com/subosito/gotenv v1.2.0 // indirect
56+
github.com/subosito/gotenv v1.6.0 // indirect
5057
github.com/volatiletech/inflect v0.0.1 // indirect
5158
github.com/volatiletech/randomize v0.0.1 // indirect
52-
github.com/ziutek/mymysql v1.5.4 // indirect
53-
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa // indirect
54-
golang.org/x/mod v0.5.0 // indirect
55-
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect
56-
golang.org/x/text v0.3.7 // indirect
57-
golang.org/x/tools v0.1.5 // indirect
58-
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
59-
gopkg.in/gorp.v1 v1.7.2 // indirect
60-
gopkg.in/ini.v1 v1.66.2 // indirect
61-
gopkg.in/yaml.v2 v2.4.0 // indirect
62-
lukechampine.com/uint128 v1.1.1 // indirect
63-
modernc.org/cc/v3 v3.35.18 // indirect
64-
modernc.org/ccgo/v3 v3.12.95 // indirect
65-
modernc.org/libc v1.11.104 // indirect
66-
modernc.org/mathutil v1.4.1 // indirect
67-
modernc.org/memory v1.0.5 // indirect
68-
modernc.org/opt v0.1.1 // indirect
69-
modernc.org/strutil v1.1.1 // indirect
70-
modernc.org/token v1.0.0 // indirect
59+
go.uber.org/multierr v1.11.0 // indirect
60+
golang.org/x/crypto v0.25.0 // indirect
61+
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
62+
golang.org/x/sys v0.22.0 // indirect
63+
golang.org/x/text v0.16.0 // indirect
64+
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect
65+
gopkg.in/ini.v1 v1.67.0 // indirect
66+
gopkg.in/yaml.v3 v3.0.1 // indirect
67+
modernc.org/gc/v3 v3.0.0-20240722195230-4a140ff9c08e // indirect
68+
modernc.org/libc v1.55.6 // indirect
69+
modernc.org/mathutil v1.6.0 // indirect
70+
modernc.org/memory v1.8.0 // indirect
71+
modernc.org/strutil v1.2.0 // indirect
72+
modernc.org/token v1.1.0 // indirect
7173
)

0 commit comments

Comments
 (0)