Skip to content

Commit

Permalink
🧰 Replace Makefile by Taskfile
Browse files Browse the repository at this point in the history
Closes #40
  • Loading branch information
tgotwig committed Nov 28, 2023
1 parent 38b84ac commit 2d80527
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 83 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
unzip ffmpeg.zip
- name: 🕵️ Run tests
run: make test
run: task test
Ubuntu:
runs-on: ubuntu-latest
name: 🐧 Ubuntu
Expand All @@ -51,7 +51,7 @@ jobs:
run: sudo apt install -y ffmpeg

- name: 🕵️ Run tests
run: make test
run: task test
Windows:
runs-on: self-hosted
name: 🏳️‍🌈 Windows
Expand All @@ -63,8 +63,8 @@ jobs:
uses: crazy-max/ghaction-chocolatey@v1
with:
args: -h
- name: ⬇️ Install nmake
uses: ilammy/msvc-dev-cmd@v1
- name: ⬇️ Install task # TODO - test this
uses: ilammy/ghaction-task@v1

- name: ⬇️ Install yt-dlp
run: choco install yt-dlp
Expand All @@ -73,4 +73,4 @@ jobs:
run: choco install ffmpeg

- name: 🕵️ Run tests
run: nmake test
run: task test
70 changes: 0 additions & 70 deletions Makefile

This file was deleted.

16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,16 @@ Rust and some listed Crates inside of [Cargo.toml](Cargo.toml) under _dependenci
- [Rust 2021](https://www.rust-lang.org/tools/install)
- [yt-dlp](https://github.com/yt-dlp/yt-dlp/wiki/Installation)
- [ffmpeg](https://ffmpeg.org/download.html)
- If you are on Windows and want to have the `make` command: [Windows Subsystem for Linux with Ubuntu](https://www.microsoft.com/de-de/p/ubuntu-2004-lts/9n6svws3rx71?activetab=pivot:overviewtab)
- [task](https://taskfile.dev/#/installation)

### Setting up Dev

Once you are done with installing the prerequisites, you should run `make` to see if everything runs smooth:
Once you are done with installing the prerequisites, you should run `task` to see if everything runs smooth:

```shell
git clone [email protected]:TGotwig/vidmerger.git
cd vidmerger
make
task
```

Also click on _fork_ from the top right corner of this repository and run:
Expand All @@ -109,7 +109,7 @@ git remote add <your-github-name> [email protected]:<your-github-name>/vidmerger.gi

### Building

Run `make build` to build for Mac, Linux and Windows. You can find the compressed Mac & Linux .tar.gz-archives for Github under _target/tars_, the .exe file for Windows under _tools_.
Run `task build` to build for Mac, Linux and Windows. You can find the compressed Mac & Linux .tar.gz-archives for Github under _target/tars_, the .exe file for Windows under _tools_.

### Deploying / Publishing

Expand All @@ -120,18 +120,18 @@ Run `make build` to build for Mac, Linux and Windows. You can find the compresse

#### Manual steps

Increasing all versions by _find and replace_, then after `make build`:
Increasing all versions by _find and replace_, then after `task build`:

- Dockerhub: Run `make publish_dockerhub`.
- Dockerhub: Run `task publish_dockerhub`.

## 📦 Versioning

We use [SemVer](http://semver.org/) for versioning.

## 🧪 Tests

- For major tests: `make test` (requires `yt-dlp` and `ffmpeg` to be installed)
- For linting tests: `make lint`
- For major tests: `task test` (requires `yt-dlp` and `ffmpeg` to be installed)
- For linting tests: `task lint`

## 🌟 Style guide

Expand Down
79 changes: 79 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
version: '3'

tasks:
default:
deps: [install, test]

install:
cmds:
- cargo install cross
- rustup component add clippy

run:
cmds:
- cargo run -- data

# TODO - fix this
run_docker:
deps: [build_linux_x64]
cmds:
- docker build -t vidmerger .
- docker container run -it --rm -v `pwd`/data:/data vidmerger

test:
cmds:
- cargo test -- --exact --nocapture $(name)

test_units:
cmds:
- cargo test --bins -- --exact --nocapture $(name)

lint:
cmds:
- cargo clippy

# TODO - fix this
build:
deps: [build_linux_x64, build_mac_x64, build_win_x64, shasum]

# TODO - fix this
build_linux_x64:
cmds:
- echo 'Building for Linux... 🐧'
- cross build --release --target=x86_64-unknown-linux-musl
- mkdir -p target/release-archives && tar -C target/x86_64-unknown-linux-musl/release -czf target/release-archives/vidmerger-linux.tar.gz vidmerger

# TODO - fix this
build_mac_x64:
cmds:
- echo 'Building for MacOS... 🍏'
- cross build --release --target=x86_64-apple-darwin
- mkdir -p target/release-archives && tar -C target/x86_64-apple-darwin/release -czf target/release-archives/vidmerger-mac.tar.gz vidmerger

build_win_x64:
cmds:
- echo 'Building for Windows... 🏳️‍🌈'
- cross build --release --target x86_64-pc-windows-gnu
- cd target/x86_64-pc-windows-gnu/release && mv vidmerger.exe ../../../tools

shasum:
cmds:
- shasum -a 256 target/release-archives/vidmerger*
- shasum -a 256 tools/vidmerger.exe

# TODO - test this
publish_choco:
cmds:
- choco pack
- Get-ChildItem *.nupkg | ren -NewName vidmerger.nupkg
- choco push vidmerger.nupkg --source https://push.chocolatey.org
- Remove-Item vidmerger.nupkg

# TODO - test this, automate versioning
publish_dockerhub:
cmds:
- docker build --no-cache -t vidmerger .
- docker tag vidmerger tgotwig/vidmerger:0.3.1
- docker push tgotwig/vidmerger:0.3.1
- docker tag vidmerger tgotwig/vidmerger
- docker push tgotwig/vidmerger

0 comments on commit 2d80527

Please sign in to comment.