Add precommit for license info (#31) #102
This file contains hidden or 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
| # Copyright 2025 Colton Loftus | |
| # SPDX-License-Identifier: AGPL-3.0-only | |
| name: Go Test | |
| on: | |
| push: | |
| # only trigger on branches, not on tags | |
| branches: '**' | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Set up Go | |
| uses: actions/setup-go@v2 | |
| with: | |
| go-version: '1.22' | |
| - name: Install Calibre and ffmpeg | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y calibre ffmpeg | |
| - name: Ensure ebook-convert is in PATH | |
| run: | | |
| echo "$(dirname $(which ebook-convert)) is in PATH" | |
| ebook-convert --version # This will fail if ebook-convert is not installed correctly | |
| - name: Ensure ffmpeg is in PATH | |
| run: | | |
| echo "$(dirname $(which ffmpeg)) is in PATH" | |
| ffmpeg -version | |
| # run with p 1 to prevent concurrent tests mutating the same file | |
| # unfortunately we have to do this since ebook-convert requires tmp files and not stdin/stdout | |
| - name: Run Go tests | |
| run: go test ./... -p 1 -count=1 | |
| - name: Run Dummy CLI E2E with config | |
| run: | | |
| # Create the Audiobook directory in the home directory | |
| # /home/runner is the home directory in GitHub Actions but we | |
| # don't appear to be able to use ~ for some reason | |
| mkdir -p /home/runner/Audiobooks | |
| go run . --config ./examples/config.yaml README.md | |
| if [ ! -f "/home/runner/Audiobooks/README.wav" ]; then | |
| echo "Error: README.wav was not generated!" | |
| exit 1 | |
| fi |