From 2d80527635c18f1e2205de27ca734d4ab25f5af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=99=A0=EF=B8=8F=20Thomas=20Gotwig=20=E2=99=A3=EF=B8=8F?= Date: Tue, 28 Nov 2023 20:32:43 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B0=20Replace=20Makefile=20by=20Taskfi?= =?UTF-8?q?le?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes https://github.com/tgotwig/vidmerger/issues/40 --- .github/workflows/rust.yml | 10 ++--- Makefile | 70 --------------------------------- README.md | 16 ++++---- Taskfile.yml | 79 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 92 insertions(+), 83 deletions(-) delete mode 100644 Makefile create mode 100644 Taskfile.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1a576d2..18b7e70 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -33,7 +33,7 @@ jobs: unzip ffmpeg.zip - name: ๐Ÿ•ต๏ธ Run tests - run: make test + run: task test Ubuntu: runs-on: ubuntu-latest name: ๐Ÿง Ubuntu @@ -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 @@ -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 @@ -73,4 +73,4 @@ jobs: run: choco install ffmpeg - name: ๐Ÿ•ต๏ธ Run tests - run: nmake test + run: task test diff --git a/Makefile b/Makefile deleted file mode 100644 index cf17b2f..0000000 --- a/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -all: install test -.PHONY: all - -install: - cargo install cross - rustup component add clippy - -run: - cargo run -- data - -run_docker: - make build-linux - docker build -t vidmerger . - docker container run -it --rm -v `pwd`/data:/data vidmerger - -# ---------------------------------------------------------------- - -test: - cargo test -- --exact --nocapture $(name) - -test_units: - cargo test --bins -- --exact --nocapture $(name) - -lint: - cargo clippy - -# ---------------------------------------------------------------- - -# TODO - fix this -build: - make build-linux - make build-mac - make build-win - make shasum - -# TODO - fix this -build_linux_x64: - @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: - @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: - @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: - shasum -a 256 target/release-archives/vidmerger* - shasum -a 256 tools/vidmerger.exe - -# ---------------------------------------------------------------- - -publish_choco: - choco pack - Get-ChildItem *.nupkg | ren -NewName vidmerger.nupkg - choco push vidmerger.nupkg --source https://push.chocolatey.org - Remove-Item vidmerger.nupkg - -publish_dockerhub: - 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 diff --git a/README.md b/README.md index f85c8cf..6f56fdd 100644 --- a/README.md +++ b/README.md @@ -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 git@github.com:TGotwig/vidmerger.git cd vidmerger -make +task ``` Also click on _fork_ from the top right corner of this repository and run: @@ -109,7 +109,7 @@ git remote add git@github.com:/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 @@ -120,9 +120,9 @@ 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 @@ -130,8 +130,8 @@ 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 diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..ebedaef --- /dev/null +++ b/Taskfile.yml @@ -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