Update all dependencies #434
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
name: build | |
on: | |
pull_request: | |
push: | |
branches: [ main ] | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Java 19 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: corretto | |
java-version: 19 | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build | |
run: ./gradlew projects clean build --no-daemon --refresh-dependencies | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3.1.4 | |
with: | |
flags: unit-tests-${{ matrix.os }} | |
fail_ci_if_error: true | |
integration-test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Java 19 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: corretto | |
java-version: 19 | |
- name: Setup HandBrake (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt install handbrake-cli | |
- name: Setup HandBrake (Windows) | |
if: matrix.os == 'windows-latest' | |
run: choco install handbrake-cli | |
- name: Setup HandBrake (Mac) | |
if: matrix.os == 'macos-latest' | |
run: brew install handbrake | |
# 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: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Integration Test | |
# use retry cause the integration tests can be flaky. E.g. HandBrake crashing on the agent. | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 10 | |
max_attempts: 10 | |
command: ./gradlew projects clean integrationTest --no-daemon --refresh-dependencies | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3.1.4 | |
with: | |
flags: integration-tests-${{ matrix.os }} | |
fail_ci_if_error: true | |
release: | |
needs: [ build, integration-test ] | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Java 19 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: corretto | |
java-version: 19 | |
- name: Bump version | |
id: version | |
uses: paulhatch/semantic-version@v5.2.1 | |
- name: Build base image | |
run: docker build -t handbrake-java-base -f base.Dockerfile . | |
- name: Login to ghcr | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push docker images | |
run: ./gradlew jib -Djib.to.tags=${{ steps.version.outputs.version }} | |
- name: Create GitHub tag and release | |
uses: softprops/action-gh-release@v0.1.15 | |
with: | |
tag_name: ${{ steps.version.outputs.version_tag }} | |
generate_release_notes: true |