ChineseSubFinder / ChineseSubFinder

自动化中文字幕下载。字幕网站支持 shooter、xunlei、arrst、a4k、SubtitleBest 。支持 Emby、Jellyfin、Plex、Sonarr、Radarr、TMM
MIT License
3.52k stars 246 forks source link

[feat] CI workflows for better testing across platform #144

Open wyq977 opened 2 years ago

wyq977 commented 2 years ago

Right now, there are some problems with testing

  1. A lot of the test file path are fixed, either for Linux or Windows, need to account for both with relative path, filepath.FromSlash should be enough
  2. No standard test files have been created
    • No good example media files (mkv,srt,pcm,ass) for testing, often requires local files, maybe can be generated with ffmpeg
    • Need example metadata for many cases
  3. With 1, 2 solved or ongoing, CI like circle CI or github actions are better suited for automating build/tests

Example files:

metadata

2 movies at least: 1 latest (aired time < 3 months, 1 older) 2 tvshow at least: 1 latest 1 old

might need hidden file check/ or no need for that

$ tree -a movies/
movies/
├── .DS_Store
└── A Bad Moms Christmas (2017) [imdbid-tt6359956]
    ├── .DS_Store
    ├── ._A Bad Moms Christmas (2017).en.srt
    ├── ._A Bad Moms Christmas (2017).mp4
    ├── ._A Bad Moms Christmas (2017).nfo
    ├── ._A Bad Moms Christmas (2017).txt
    ├── ._fanart.jpg
    ├── ._poster.jpg
    ├── A Bad Moms Christmas (2017).en.srt
    ├── A Bad Moms Christmas (2017).mp4
    ├── A Bad Moms Christmas (2017).nfo
    ├── A Bad Moms Christmas (2017).txt
    ├── A Bad Moms Christmas (2017).zh.srt
    ├── fanart.jpg
    └── poster.jpg

1 directory, 15 files

# tv

$ tree -a tv
tv
├── .DS_Store
├── ._tvshow.nfo
├── American Crime Story (2016) [imdbid-tt2788432]
│   ├── .DS_Store
│   ├── Season 03
│   │   ├── .DS_Store
│   │   ├── ._American Crime Story (2016) - s03e01-thumb.jpg
│   │   ├── ._American Crime Story (2016) - s03e01.chi.ass
│   │   ├── ._American Crime Story (2016) - s03e01.mkv
│   │   ├── ._American Crime Story (2016) - s03e01.nfo
│   │   ├── American Crime Story (2016) - s03e01-thumb.jpg
│   │   ├── American Crime Story (2016) - s03e01.chi.ass
│   │   ├── American Crime Story (2016) - s03e01.mkv
│   │   └── American Crime Story (2016) - s03e01.nfo
│   ├── banner.jpg
│   ├── fanart.jpg
│   ├── poster.jpg
│   ├── season01-banner.jpg
│   ├── season01-poster.jpg
│   ├── season02-banner.jpg
│   ├── season02-poster.jpg
│   ├── season03-banner.jpg
│   ├── season03-poster.jpg
│   ├── theme.mp3
│   └── tvshow.nfo
├── BONDiNG (2019)
│   ├── .DS_Store
│   ├── Season 01
│   │   ├── .DS_Store
│   │   ├── ._BONDiNG (2019) - s01e01-thumb.jpg
│   │   ├── ._BONDiNG (2019) - s01e01.chi.ass
│   │   ├── ._BONDiNG (2019) - s01e01.mkv
│   │   ├── ._BONDiNG (2019) - s01e01.nfo
│   │   ├── ._BONDiNG (2019) - s01e01.sh
│   │   ├── ._BONDiNG (2019) - s01e02.mkv
│   │   ├── BONDiNG (2019) - s01e01-thumb.jpg
│   │   ├── BONDiNG (2019) - s01e01.mkv
│   │   ├── BONDiNG (2019) - s01e01.nfo
│   │   ├── BONDiNG (2019) - s01e01.sh
│   │   └── BONDiNG (2019) - s01e01.zh.ass
│   ├── fanart.jpg
│   ├── season01-poster.jpg
│   └── tvshow.nfo
├── Dexter - New Blood (2021) [imdbid-tt14164730]
│   ├── .DS_Store
│   ├── Season 01
│   │   ├── .DS_Store
│   │   ├── ._Dexter - New Blood (2021) - s01e03-thumb.jpg
│   │   ├── ._Dexter - New Blood (2021) - s01e03.mkv
│   │   ├── ._Dexter - New Blood (2021) - s01e03.nfo
│   │   ├── Dexter - New Blood (2021) - s01e03-thumb.jpg
│   │   ├── Dexter - New Blood (2021) - s01e03.mkv
│   │   ├── Dexter - New Blood (2021) - s01e03.nfo
│   │   ├── Dexter - New Blood (2021) - s01e03.zh.ass
│   │   └── Dexter - New Blood (2021) - s01e03.zh.srt
│   ├── banner.jpg
│   ├── fanart.jpg
│   ├── poster.jpg
│   ├── season01-poster.jpg
│   └── tvshow.nfo
└── tvshow.nfo
wyq977 commented 2 years ago

https://dev.to/gopher/build-ci-cd-pipelines-in-go-with-github-actions-and-dockers-1ko7

https://github.com/mvdan/github-actions-golang

https://github.com/actions/setup-go

wyq977 commented 2 years ago

Just realized that some movies are in iso or BDMV folder so that might be another test case

allanpk716 commented 2 years ago

It seems like a good idea to separate the test data files into a separate project and gradually refine the test cases I wrote on the fly. This should take some time. It should be a little late.

wyq977 commented 2 years ago

It seems like a good idea to separate the test data files into a separate project and gradually refine the test cases I wrote on the fly. This should take some time. It should be a little late.

Do you have a good idea of what the minimum files we need to run a comprehensive test to hit all the functionality. I am not familar with the HTTP/ downloading part but I can start with a basic media files needed for all import/export. Backup part ihasnt check.

I suggests make a media/tv media/movie folder for example movies, put all the files for use case/test case would be good. Is this project personal, i.e. community cant edit?

Listing all the suggested files here in one issue will spam your email inbox and pretty ez to lost

allanpk716 commented 2 years ago

给你加入这个 project 的 collaborators

allanpk716 commented 2 years ago

给你加了。本次重构后,可以基于现有的结构再次调整。