This repository has been archived by the owner on Oct 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update ci workflow * Updates to gitignore * Add dependabot configs workflow * Update github repo configs * refactor module * Add ci workflow for rust jobs * rename youtube-dl to ydl * Add download package * combine cgo with rust ffi capabilities
- Loading branch information
NY Anchor
authored
Dec 23, 2021
1 parent
208b9ca
commit b3de156
Showing
26 changed files
with
361 additions
and
369 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
* @ch3ck | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
name: Bug Report | ||
about: If something isn't working as its supposed to | ||
labels: bug, feature request, needs triage, won't fix | ||
assignees: ch3ck | ||
--- | ||
|
||
Please provide more details: | ||
|
||
* What are you trying to do | ||
* What happened | ||
* What was the expected behaviour | ||
|
||
Please share relevent code sample or [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## Proposed changes | ||
Describe the *big picture* reason for your PR. | ||
|
||
## Checklist | ||
|
||
Please review the following checklist before submitting a PR: | ||
|
||
- [ ] **CONSIDER** adding a unit test to demonstrate your PR resolves an issue | ||
- [ ] **DO** keep PRs small for easy review | ||
- [ ] **DO** make sure unit tests pass | ||
- [ ] **DO** ensure no compiler warnings are triggered | ||
- [ ] **AVOID** breaking the CI builds | ||
|
||
## Other comments | ||
Any other comments you might have. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,40 @@ | ||
name: Build | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
|
||
jobs: | ||
setup-build-test: | ||
name: Setup, Build, Test | ||
build-and-test-rust-library: | ||
name: Build and test rust library | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout source | ||
uses: actions/checkout@v2 | ||
- name: install latest nightly | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
override: true | ||
components: rustfmt, clippy | ||
- name: build and test | ||
working-directory: ./pkg/download | ||
run: | | ||
cargo build --tests --verbose && cargo test --verbose | ||
build-and-test-go-module: | ||
name: Build and test go source | ||
strategy: | ||
matrix: | ||
go-version: [1.13.x] | ||
platform: [macos-latest] | ||
runs-on: ${{ matrix.platform }} | ||
go-version: [1.16.x, 1.17.x, 1.18.x] | ||
platform: [macos-latest, ubuntu-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v1 | ||
- name: Install go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Checkout code | ||
uses: actions/checkout@v1 | ||
uses: actions/checkout@v2 | ||
- name: Test | ||
run: go test -v -coverage ./... | ||
- name: Build | ||
run: brew install ffmpeg && make build && make vet | ||
run: make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
# Maintain dependencies for Go | ||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
|
||
# Maintain dependencies for build tools | ||
- package-ecosystem: "gomod" | ||
directory: "/tools" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: release new binaries | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
reason: | ||
description: new release message | ||
required: true | ||
push: | ||
tags: | ||
- "*" | ||
|
||
permissions: | ||
contents: write | ||
|
||
|
||
jobs: | ||
publish-crate-on-new-release: | ||
name: "Publish crate on Release" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
- uses: katyo/publish-crates@v1 | ||
with: | ||
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
publish-go-package-on-release: | ||
name: Release go binaries | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# GoReleaser Pro key, for 'goreleaser-pro' distribution | ||
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Run security audit | ||
# Author: Nyah Check | ||
name: Run Security Audit | ||
|
||
on: | ||
push: | ||
paths: | ||
- '**/Cargo.toml' | ||
- '**/Cargo.lock' | ||
|
||
jobs: | ||
run-security-audit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions-rs/audit-check@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,57 @@ | ||
# Compiled Object files, Static and Dynamic libs (Shared Objects) | ||
*.o | ||
*.a | ||
*.so | ||
# MacOS DS_Store files | ||
.DS_Store | ||
|
||
# Ignore all downloaded video and audio files | ||
# Binaries for programs and plugins | ||
*.mp3 | ||
*.flv | ||
*.webm | ||
*.opus | ||
*.mp4 | ||
*.3gpp | ||
*.ogg | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.o | ||
*.a | ||
*.so | ||
*.dylib | ||
|
||
# Compiled binaries | ||
## Compiled binaries | ||
ytd | ||
youtube-dl | ||
ydl | ||
|
||
*.exe | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
*.prof | ||
|
||
# OSX | ||
.DS_Store | ||
|
||
# CODE coverage results | ||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
coverage.html | ||
coverage.txt | ||
profile.out | ||
|
||
# ENV files | ||
# Dependency directories (remove the comment below to include it) | ||
vendor/ | ||
|
||
# Output of GoReleaser | ||
dist/ | ||
|
||
# Visual Studio Code files | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
*.code-workspace | ||
|
||
# Local History for Visual Studio Code | ||
.history/ | ||
|
||
# GoLand and IntelliJ IDEA files | ||
.idea/ | ||
|
||
# env files that usually contain secrets or local config | ||
.env | ||
.envrc | ||
.idea |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,26 @@ | ||
# Setup package name variables | ||
NAME := ytd | ||
PKG := github.com/ch3ck/$(NAME) | ||
PREFIX?=$(shell pwd) | ||
BUILDTAGS= | ||
version=v1.1 | ||
|
||
.PHONY: clean all fmt vet build test install static | ||
.DEFAULT: default | ||
|
||
all: clean fmt vet build test install | ||
|
||
build: clean fmt | ||
@echo "+ $@" | ||
CGO_ENABLED=1 go build -tags "$(BUILDTAGS) cgo" . | ||
|
||
static: | ||
@echo "+ $@" | ||
CGO_ENABLED=1 go build -tags "$(BUILDTAGS) cgo static_build" -ldflags "-w -extldflags -static" -o ytd . | ||
|
||
fmt: | ||
@echo "+ $@" | ||
@gofmt -s -l -w . | tee /dev/stderr | ||
|
||
test: | ||
@echo "+ $@" | ||
@find . -name \*.mp3 -delete #clean previous test files. | ||
@go test -v -tags "$(BUILDTAGS) cgo" $(shell go list) | ||
@find . -name \*.mp3 -delete # clean previous test downloads | ||
@go test -bench=. $(shell go list) | ||
|
||
vet: | ||
@echo "+ $@" | ||
@go vet $(shell go list | grep -v vendor) | ||
|
||
.PHONY: build-all | ||
build-all: build-static | ||
|
||
.PHONY: run-all | ||
run-all: run-static | ||
|
||
.PHONY: build-static | ||
build-static: | ||
rustup toolchain install nightly | ||
cd pkg/download && cargo +nightly build --release | ||
cp pkg/download/target/release/libydl.a pkg/ | ||
go build -v ./... | ||
|
||
.PHONY: run-static | ||
run-static: | ||
RUST_LOG=trace ./ydl | ||
|
||
# test rust lib | ||
.PHONY: test-rs | ||
test-rs: | ||
cd pkg/download && RUST_LOG=trace cargo test -- --nocapture | ||
|
||
# clean all packages | ||
.PHONY: clean | ||
clean: | ||
@echo "+ $@" | ||
@rm -rf ytd | ||
@find . -name \*.mp3 -delete | ||
@find . -name \*.flv -delete | ||
|
||
install: | ||
@echo "+ $@" | ||
@docker build -t ch3ck/youtube-dl:$(version) . | ||
@go install . | ||
rm -rf main_static pkg/libydl.so pkg/libydl.a pkg/download/target |
Oops, something went wrong.