Ci and so on

This commit is contained in:
AB
2020-06-05 21:15:25 +03:00
parent 4a6847613f
commit 412c0e4720
6 changed files with 263 additions and 0 deletions

40
.github/workflows/PKGBUILD vendored Normal file
View File

@ -0,0 +1,40 @@
# Maintainer: AB <ab@hexor.ru>
pkgname=furumi
pkgver=1.0.0
pkgrel=1
pkgdesc="Furumi is a FUSE filesystem working over NGINX JSON autoindex."
url="https://github.com/house-of-vanity/furumi.git"
arch=($CARCH)
license=(WTFPL custom)
depends=(openssl fuse)
makedepends=(cargo git)
source=("git+https://github.com/house-of-vanity/$pkgname")
sha512sums=('SKIP')
backup=('etc/furumi.yml')
pkgver() {
cd "$srcdir/$pkgname"
git describe --long --tags | awk -F '-' '{print $1}'| sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare() {
cd "$srcdir/$pkgname"
cargo fetch --target $CARCH-unknown-linux-gnu
}
build() {
cd "$srcdir/$pkgname"
cargo build --release --frozen --all-targets
}
package() {
install=$pkgname.install
cd "$srcdir/$pkgname"
install -Dt "$pkgdir/usr/bin" target/release/$pkgname
install -Dt "$pkgdir/usr/share/doc/$pkgname" -m644 README.md
install -Dt "$pkgdir/usr/lib/systemd/system" assets/$pkgname.service
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
mkdir -p "$pkgdir/etc"
cp -n assets/$pkgname.yml "$pkgdir/etc/$pkgname.yml"
}

116
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,116 @@
name: Build and publish
on:
push:
tags:
- 'v*'
jobs:
make_bin:
name: Build binary
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Pre-build
run: sudo apt install -y libfuse-dev # pkg-config
- uses: actions/checkout@v2
- name: Build binary
run: cargo build --release
- name: Upload binary
uses: actions/upload-artifact@v1
with:
name: furumi
path: ./target/release/furumi
make_arch:
name: Make Arch Linux package
runs-on: ubuntu-latest
container:
image: archlinux
options: --privileged
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup
steps:
- uses: actions/checkout@v2
- name: Build Arch Linux package
uses: house-of-vanity/build-arch-package@master
with:
PKGBUILD: $GITHUB_WORKSPACE/.github/workflows/PKGBUILD
OUTDIR: $HOME/arch-packages
- run: mv $HOME/arch-packages/*pkg.tar.zst furumi-x86_64.pkg.tar.zst
- name: Upload Arch Package
uses: actions/upload-artifact@v1
with:
name: arch_linux_furumi-x86_64.pkg.tar.zst
path: ./furumi-x86_64.pkg.tar.zst
# make_deb:
# name: Make Deb package
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Pre-build
# run: sudo apt install -y libfuse-dev pkg-config && cargo install cargo-deb
# - uses: actions/checkout@v2
# - name: Build deb
# run: cargo deb --output ./target/debian/furumi_amd64.deb
# - name: Upload binary
# uses: actions/upload-artifact@v1
# with:
# name: furumi_amd64.deb
# path: ./target/debian/furumi_amd64.deb
publish:
name: Publish release
needs: [make_bin, make_arch]
runs-on: ubuntu-latest
steps:
- name: Get the version (git tag)
id: get_version
run: |
echo ${GITHUB_REF/refs\/tags\/v/}
echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
echo ::set-output name=FULL_TAG::${GITHUB_REF/refs\/tags\//}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Download binary
uses: actions/download-artifact@v1
with:
name: furumi
path: ./
- name: Download Arch Package
uses: actions/download-artifact@v1
with:
name: arch_linux_furumi-x86_64.pkg.tar.zst
path: ./
- name: Download Deb Package
uses: actions/download-artifact@v1
with:
name: furumi_amd64.deb
path: ./
- name: Upload binary assets
run: |
wget https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2
tar xjf linux-amd64-github-release.tar.bz2
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
./bin/linux/amd64/github-release upload -u house-of-vanity -r furumi --tag ${{ steps.get_version.outputs.FULL_TAG }} --name furumi_${{ steps.get_version.outputs.VERSION }}_amd64.deb --file ./furumi_amd64.deb
./bin/linux/amd64/github-release upload -u house-of-vanity -r furumi --tag ${{ steps.get_version.outputs.FULL_TAG }} --name arch_linux_furumi-${{ steps.get_version.outputs.VERSION }}-x86_64.pkg.tar.zst --file ./furumi-x86_64.pkg.tar.zst
./bin/linux/amd64/github-release upload -u house-of-vanity -r furumi --tag ${{ steps.get_version.outputs.FULL_TAG }} --name furumi-${{ steps.get_version.outputs.VERSION }} --file ./furumi
# # SCP to arch repo
# - name: Copy package to repository
# uses: appleboy/scp-action@master
# with:
# host: ${{ secrets.SSH_HOST }}
# username: github_deploy
# port: 22
# key: ${{ secrets.SSH_KEY }}
# source: "./furumi-x86_64.pkg.tar.zst"
# target: "/srv/arch-repo/"

15
.github/workflows/mus-fuse.install vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
post_install() {
srv_name=furumi
if systemctl | grep -Fq "$srv_name"; then
sudo systemctl stop $srv_name.service
fi
sudo useradd --system --user-group --no-create-home --home-dir /run/$srv_name $srv_name
mkdir -p /mnt/$srv_name
chown $srv_name:$srv_name /mnt/$srv_name
echo ":: !!!!!!!!!!!!!!!"
echo ":: You need to uncomment 'user_allow_other' in /etc/fuse.conf"
echo ":: !!!!!!!!!!!!!!!"
}

13
LICENSE Normal file
View File

@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@ -0,0 +1,72 @@
# Furumi
[![Build Status](https://github.com/house-of-vanity/furumi/workflows/Build%20and%20publish/badge.svg)](https://github.com/house-of-vanity/furumi/actions)
Furumi is a FUSE filesystem working over NGINX JSON autoindex. It's written in Rust stable.
# Features
- Using NGINX for indexing remote files.
- Security relies on HTTPS.
- Using cache.
## Usage
Here is a [binary release](https://github.com/house-of-vanity/furumi/releases/latest) or compile it yourself. Anyway mind about dependencies listed below. Also there is a systemd unit file for managing service. Place it into `~/.config/systemd/user/furumi.service`
```sh
# Compile binary
$ cargo build --release
# Create config
cat > furumi.ylm <<EOF
---
server: https://server
mountpoint: /mnt
# Basic auth creds
username: user
password: pass
# Run
$ ./target/release/furumi --config furumi.yml
```
## Dependencies
FUSE must be installed to build and run furumi. (i.e. kernel driver and libraries. Some platforms may also require userland utils like `fusermount`). A default installation of FUSE is usually sufficient.
!? To build fuse-rs or any program that depends on it, `pkg-config` needs to be installed as well.
### Linux
[FUSE for Linux][libfuse] is available in most Linux distributions and usually called `fuse`.
Install on Arch Linux:
```sh
sudo pacman -S fuse
```
Install on Debian based system:
```sh
sudo apt-get install fuse
```
Install on CentOS:
```sh
sudo yum install fuse
```
To build, FUSE libraries and headers are required. The package is usually called `libfuse-dev` or `fuse-devel`. Also `pkg-config` is required for locating libraries and headers.
```sh
sudo apt-get install libfuse-dev pkg-config
```
```sh
sudo yum install fuse-devel pkgconfig
```

7
assets/furumi.yml Normal file
View File

@ -0,0 +1,7 @@
---
server: https://server
mountpoint: /mnt
# Basic auth creds
username: user
password: pass