-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add python script to compute supported extensions
- Loading branch information
Showing
8 changed files
with
104 additions
and
66 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -62,6 +62,8 @@ jobs: | |
VERSION=${GITHUB_REF_NAME#v} | ||
echo Version: $VERSION | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
- run: sudo apt-get update -y && sudo apt-get install tree zip -y | ||
|
||
- name: Show directory tree before build | ||
run: tree | ||
|
@@ -71,24 +73,30 @@ jobs: | |
with: | ||
go-version: '1.21.5' | ||
|
||
- name: Test | ||
run: go test -v ./... | ||
|
||
- name: Create artifacts directory | ||
run: mkdir artifacts | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y musl-dev gcc | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Build for different platforms | ||
run: | | ||
PLATFORMS=($(go tool dist list | grep -E '^windows|^linux/(amd64|arm|386)|^darwin')) | ||
SUPPORTED_EXTENSIONS=$(python scripts/compute_supported_extensions.py) | ||
LDFLAGS="-X 'main.supported_extensions=$SUPPORTED_EXTENSIONS' -X 'main.version=$VERSION'" | ||
for PLATFORM in "${PLATFORMS[@]}" | ||
do | ||
arr=(${PLATFORM//\// }) | ||
echo "${arr[0]}/${arr[1]}" | ||
GOOS=${arr[0]} GOARCH=${arr[1]} bash -c '\ | ||
go build -o out/ -ldflags "-X main.version=${VERSION}" && | ||
GOOS=${arr[0]} GOARCH=${arr[1]} FLAGS=$LDFLAGS bash -c ' | ||
go build -o out/ -ldflags "$FLAGS" && | ||
echo "$LDFLAGS" && | ||
cp {LICENSE,README.md} out/ && | ||
zip -j artifacts/${{ github.event.repository.name }}_$GOOS-$GOARCH.zip out/* | ||
rm -rf out/*' | ||
|
@@ -97,9 +105,6 @@ jobs: | |
- name: Show directory tree after build | ||
run: tree | ||
|
||
- name: Test | ||
run: go test -v ./... | ||
|
||
- name: Upload Build Artifact | ||
uses: actions/[email protected] | ||
with: | ||
|
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
*.srt | ||
*.lrc | ||
*.mp3 | ||
*.exe | ||
.vscode/ | ||
.githubvars | ||
main | ||
|
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,4 +1,4 @@ | ||
# subtitle-to-lrc 0.1.1 | ||
# subtitle-to-lrc 0.1.0 | ||
|
||
[![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg)](https://opensource.org/licenses/) | ||
[![Build and release](https://github.com/shipurjan/subtitle-to-lrc/actions/workflows/go.yml/badge.svg)](https://github.com/shipurjan/subtitle-to-lrc/actions/workflows/go.yml) | ||
|
@@ -26,7 +26,7 @@ USAGE: | |
[output-file] - if not provided the program will use <input-file> filename with its extension replaced by .lrc | ||
VERSION: | ||
0.1.1 | ||
0.1.0 | ||
AUTHOR: | ||
Cyprian Zdebski <[email protected]> | ||
|
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Always call python scripts from the base repository directory |
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,26 @@ | ||
import glob | ||
import os | ||
from pathlib import Path | ||
import sys | ||
|
||
|
||
def error(msg=''): | ||
print(f'[ERROR] {msg}') | ||
sys.exit(1) | ||
|
||
|
||
def ok(msg=''): | ||
print(f'[OK] {msg}') | ||
sys.exit(0) | ||
|
||
|
||
def main(): | ||
supported_extensions = [ | ||
os.path.basename(Path(dir)) for dir in glob.glob('./converter/*/') | ||
if os.path.basename(Path(dir)) != 'shared' | ||
] | ||
print(', '.join(supported_extensions)) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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