Skip to content

build by @renovate[bot] #808

build by @renovate[bot]

build by @renovate[bot] #808

Workflow file for this run

name: build
run-name: build by @${{ github.actor }}
on:
pull_request:
push:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 25
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Build and test
run: ./gradlew build --no-daemon
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7
with:
flags: unit-tests
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 25
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Setup HandBrake
run: |
sudo apt update
sudo apt install -y handbrake-cli
# Need to generate encoded files for the integration tests on the GitHub Actions agent.
# Can't simply use the ones stored in git.
# Guessing different hardware, OS, etc. results in slightly different output.
- name: Generate test data
run: |
HandBrakeCLI --preset "Production Standard" -i auto-handbrake-cfr/src/integrationTest/resources/Big_Buck_Bunny_360_10s_1MB.mp4 -o auto-handbrake-cfr/src/integrationTest/resources/Big_Buck_Bunny_360_10s_1MB.cfr.mp4
HandBrakeCLI --preset "Production Standard" -i auto-handbrake-cfr/src/integrationTest/resources/Big_Buck_Bunny_360_10s_2MB.mp4 -o auto-handbrake-cfr/src/integrationTest/resources/Big_Buck_Bunny_360_10s_2MB.cfr.mp4
- name: Integration test
# use retry cause the integration tests can be flaky. E.g. HandBrake crashing on the agent.
uses: nick-fields/retry@v4
with:
timeout_minutes: 10
max_attempts: 10
command: ./gradlew integrationTest --no-daemon
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7
with:
flags: integration-tests
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 25
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Docker build
run: |
docker build -t handbrake-java-base -f base.Dockerfile .
./gradlew jibBuildTar --no-daemon
- name: Upload docker tar
uses: actions/upload-artifact@v7
with:
name: docker-tar
path: auto-handbrake-cfr/build/jib-image.tar
retention-days: 1
if-no-files-found: error
smoke-test:
needs: [ docker ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Download docker tar
uses: actions/download-artifact@v8
with:
name: docker-tar
path: auto-handbrake-cfr/build
- name: Load docker image
run: docker load -i auto-handbrake-cfr/build/jib-image.tar
- name: Smoke test
run: |
mkdir -p test-input test-output test-archive
touch test-archive/.keep
cp auto-handbrake-cfr/src/integrationTest/resources/Big_Buck_Bunny_360_10s_1MB.mp4 test-input/
docker run --rm -v $(pwd)/test-input:/input -v $(pwd)/test-output:/output -v $(pwd)/test-archive:/archive ghcr.io/will-molloy/auto-handbrake-cfr
# Verify encoded file was created in output directory
ls test-output/*.cfr.mp4
# Verify original file was moved to archive directory
ls test-archive/*.mp4
# Verify input directory is now empty
[ -z "$(ls -A test-input)" ] || exit 1
release:
needs: [ build, docker, integration-test, smoke-test ]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0 # needed for version/tag/release
- name: Bump version
id: version
uses: paulhatch/semantic-version@v6.0.2
- name: Download docker tar
uses: actions/download-artifact@v8
with:
name: docker-tar
path: auto-handbrake-cfr/build
- name: Load docker image
run: docker load -i auto-handbrake-cfr/build/jib-image.tar
- name: Login to ghcr
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push docker image
run: |
for tag in "${{ steps.version.outputs.version }}" "latest"; do
docker tag ghcr.io/will-molloy/auto-handbrake-cfr ghcr.io/will-molloy/auto-handbrake-cfr:$tag
docker push ghcr.io/will-molloy/auto-handbrake-cfr:$tag
done
- name: Create GitHub tag and release
uses: softprops/action-gh-release@v3.0.0
with:
tag_name: ${{ steps.version.outputs.version_tag }}
generate_release_notes: true
cleanup:
needs: [ smoke-test, release ]
if: always()
concurrency:
group: cleanup-${{ github.run_id }}
cancel-in-progress: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Cleanup artifacts
uses: geekyeggo/delete-artifact@v6
with:
name: docker-tar