Skip to content

Commit

Permalink
Update meta stuff (#8)
Browse files Browse the repository at this point in the history
* Update meta stuff
* update workflow files
* Disable cache
* build linux binary
* switch to a different action
* switch to goreleaser
* add flag
* remove release workflow.
  • Loading branch information
la3mmchen committed Apr 1, 2024
1 parent e55e4be commit f989430
Show file tree
Hide file tree
Showing 14 changed files with 85 additions and 209 deletions.
35 changes: 22 additions & 13 deletions .github/workflows/release-devel.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: release-devel
on: [push]
on:
- push

env:
GO_VERSION: 1.21.0
Expand All @@ -11,17 +12,25 @@ permissions:

jobs:

test-version-darwin-arm64:
needs: tests
name: release-darwin-arm64
release-snapshot-workflow:
name: release-workflow
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: wangyoucao577/go-release-action
with:
github_token: ${{ secrets.PUSHTOKEN }}
goos: darwin
goarch: arm64
project_path: ./milbi
overwrite: true
release_tag: devel
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean --snapshot
workdir: milbi
env:
GITHUB_TOKEN: ${{ secrets.PUSHTOKEN }}
30 changes: 0 additions & 30 deletions .github/workflows/release.yaml

This file was deleted.

10 changes: 6 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ jobs:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: build
run: |
sudo snap install task --classic
Expand All @@ -28,10 +29,11 @@ jobs:
needs:
- go-build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: install restic
run: |
sudo apt-get install -y wget bzip2 rsync
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ milbi/tests/files/resticrepo-copy/*
!milbi/tests/files/resticrepo-copy/.gitkeep
milbi/tests/files/resticrepo-copy-2/*
!milbi/tests/files/resticrepo-copy-2/.gitkeep
dist/
37 changes: 37 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 1

before:
hooks:
- go mod tidy
- go generate ./...

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
dir: milbi

archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
23 changes: 0 additions & 23 deletions .readthedocs.yml

This file was deleted.

17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# changelog

## 0.1

- first version that might run on other notebooks than mine.

## 1.0

- releases via PyPi

## 2.0

The release replaces Python with Golang.

### Major changes

Switched to a new config format from a single custom yaml file to a config that borrows its format from Kubernetes manifests.
8 changes: 0 additions & 8 deletions CHANGELOG.rst

This file was deleted.

5 changes: 0 additions & 5 deletions CONTRIBUTING.rst

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2023 la3mmchen
Copyright (c) 2024 la3mmchen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 0 additions & 8 deletions README.rst

This file was deleted.

Empty file removed TODO.md
Empty file.
118 changes: 1 addition & 117 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,123 +44,7 @@ processed 2 files, 1 B in 0:00
snapshot 5e9a299a saved
```

Milbi works with [restic](https://restic.net/) at the moment. but it should work with [borg](https://borgbackup.readthedocs.io/) as well - at least in theory.

## features

### backup

at the moment, mibli can be configured to do backups with the following technologies:

- backups with [restic](https://restic.readthedocs.io/)
- backups with [borg](https://borgbackup.readthedocs.io/)

### synchronization

additionally, milbi can:

- copy stuff with rsync
- sync to backblaze b2 with [b2 cli](https://www.backblaze.com/b2/docs/quick_command_line.html)

### verification

```bash
$ ./milbi.py check
doing my-repo
using temporary cache in /var/folders/vz/ct7cy2591p58dkbxflsgh18dgxl8xl/T/restic-check-cache-4190130004
create exclusive lock for repository
load indexes
check all packs
check snapshots, trees and blobs
[0:10] 100.00% 1 / 1 snapshots

no errors were found
```

in addition to running checks on the repositories, milbi can randomly fuzz through the files that should be backuped and search them in the backup repository.

```bash
/milbi.py --config ./tests/files/clitest-config.yaml fuzz --count 1 --verify

fuzzing around in configured backups..
preseeding files for ./tests/files/randomfiles. this might take a while..
...by checking for file file2.txt [repo [./tests/files/resticrepo] / target [./tests/files/randomfiles]]
restoring <Snapshot ac2c866a of [~/milbi/tests/files/randomfiles] at 2022-09-22 17:04:46.711727 +0200 CEST by user@test0r> to ~/milbi/./tests/files/resticrepo-restore/restic
verifying files in ~/milbi/./tests/files/resticrepo-restore/restic
finished verifying 1 files in ~/milbi/./tests/files/resticrepo-restore/restic (took 4ms)

```
## configuration
milbi understands yaml. run `milbi config --explain` to get a config explanation.
```yaml
---
borgbackup:
bin: Path to borg binary to use.
enabled: 'A trigger to activate the backup with borgbackup. (Options: True / False).'
repos:
- excludes: A pattern for files to be excluded from the repository; e.g. *github*
keep: 'For prune actions: How many days to keep in the repository; e.g. 2 for 2 days'
passphrase: Passphrase for the repository
repo: Path to the existing borg repository.
(...)
```
see [config example](https://github.com/la3mmchen/milbi/blob/main/example-config.yaml) for a full example.
## flows
milbi supports the invocation of multiple subcommands via the flows config.
an example can look like this. with this milbi first creates a backup, prunes, then checks the config, and afterwards executes the configured syncs.
```yaml
(...)
flows:
- name: default
tasks:
- backup
- prune
- check
- sync
```
start the flow via `flows` subcommand:
```
milbi --config tests/files/clitest-config.yaml flows --flow=default
(...)
flow [default]: backup > check > prune > sync
```
## run it
you can find a pypi package at https://pypi.org/project/milbi/
```bash
$ pip3 install milbi
$ milbi --help
```
### prepare repos
milbi does not handle repository creation of any kind. just make sure to create the repo for the tool you want to use before.
#### restic
initialize a restic repo and create a secret key if you want to have one.
```bash
restic init --repo <local path>
```
#### borbackup
to be described
Milbi works with [restic](https://restic.net/) at the moment.

## development stuff

Expand Down

0 comments on commit f989430

Please sign in to comment.