Skip to content

Workflow updates to build backends simultaneously #92

Workflow updates to build backends simultaneously

Workflow updates to build backends simultaneously #92

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
branches:
- develop
- sourcerarr
paths-ignore:
- 'src/Prowlarr.Api.*/openapi.json'
pull_request:
branches:
- develop
paths-ignore:
- 'src/NzbDrone.Core/Localization/Core/**'
- 'src/Prowlarr.Api.*/openapi.json'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
FRAMEWORK: net6.0
RAW_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
PROWLARR_MAJOR_VERSION: 0
VERSION: 0.1.0
jobs:
backend-variables:
runs-on: ubuntu-latest
outputs:
framework: ${{ env.FRAMEWORK }}
major_version: ${{ env.PROWLARR_MAJOR_VERSION }}
version: ${{ env.VERSION }}
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Set Variables
id: variables
shell: bash
run: |
# Add 800 to the build number because GitHub won't let us pick an arbitrary starting point
PROWLARR_VERSION="${{ env.VERSION }}.$((${{ github.run_number }}+800))"
DOTNET_VERSION=$(jq -r '.sdk.version' global.json)
echo "SDK_PATH=${{ env.DOTNET_ROOT }}/sdk/${DOTNET_VERSION}" >> "$GITHUB_ENV"
echo "PROWLARR_VERSION=$PROWLARR_VERSION" >> "$GITHUB_ENV"
echo "BRANCH=${RAW_BRANCH_NAME/\//-}" >> "$GITHUB_ENV"
echo "framework=${{ env.FRAMEWORK }}" >> "$GITHUB_OUTPUT"
echo "major_version=${{ env.PROWLARR_MAJOR_VERSION }}" >> "$GITHUB_OUTPUT"
echo "version=$PROWLARR_VERSION" >> "$GITHUB_OUTPUT"
backend:
strategy:
matrix:
platform: [freebsd, linux] #[freebsd, linux, macos, windows]
include:
- platform: freebsd
os: ubuntu-latest
rid: freebsd-x64
- platform: linux
os: ubuntu-latest
rid: linux-x64
- platform: linux
os: ubuntu-latest
rid: linux-musl-x64
runs-on: ${{ matrix.os }}
steps:
- name: Check out
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Enable Extra Platforms In SDK
shell: bash
run: ./build.sh --enable-extra-platforms-in-sdk
- name: Build Backend
shell: bash
env:
FRAMEWORK: ${{ env.FRAMEWORK }}
RID: ${{ matrix.rid }}
run: ./build.sh --backend --packages
- name: Publish linux-x64 Test Artifact
uses: ./.github/actions/publish-test-artifact
with:
framework: ${{ env.FRAMEWORK }}
runtime: ${{ matrix.rid }}
- name: Publish Linux Artifact
uses: actions/upload-artifact@v4
with:
name: build_linux
path: _artifacts/${{ matrix.rid }}/**/*
# Test Artifacts
# - name: Publish win-x64 Test Artifact
# uses: ./.github/actions/publish-test-artifact
# with:
# framework: ${{ env.FRAMEWORK }}
# runtime: win-x64
# - name: Publish linux-x64 Test Artifact
# uses: ./.github/actions/publish-test-artifact
# with:
# framework: ${{ env.FRAMEWORK }}
# runtime: linux-x64
# - name: Publish osx-x64 Test Artifact
# uses: ./.github/actions/publish-test-artifact
# with:
# framework: ${{ env.FRAMEWORK }}
# runtime: osx-x64
# Build Artifacts (grouped by OS)
# - name: Publish FreeBSD Artifact
# uses: actions/upload-artifact@v4
# with:
# name: build_freebsd
# path: _artifacts/freebsd-*/**/*
# - name: Publish Linux Artifact
# uses: actions/upload-artifact@v4
# with:
# name: build_linux
# path: _artifacts/linux-*/**/*
# - name: Publish macOS Artifact
# uses: actions/upload-artifact@v4
# with:
# name: build_macos
# path: _artifacts/osx-*/**/*
# - name: Publish Windows Artifact
# uses: actions/upload-artifact@v4
# with:
# name: build_windows
# path: _artifacts/win-*/**/*
frontend:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- name: Volta
uses: volta-cli/action@v4
- name: Yarn Install
run: yarn install
- name: Lint
run: yarn lint
- name: Stylelint
run: yarn stylelint -f github
- name: Build
run: yarn build --env production
- name: Publish UI Artifact
uses: actions/upload-artifact@v4
with:
name: build_ui
path: _output/UI/**/*
# unit_test:
# needs: backend
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
# include:
# - os: ubuntu-latest
# artifact: tests-linux-x64
# filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory!=IntegrationTest&TestCategory!=AutomationTest
# - os: macos-latest
# artifact: tests-osx-x64
# filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory!=IntegrationTest&TestCategory!=AutomationTest
# - os: windows-latest
# artifact: tests-win-x64
# filter: TestCategory!=ManualTest&TestCategory!=LINUX&TestCategory!=IntegrationTest&TestCategory!=AutomationTest
# runs-on: ${{ matrix.os }}
# steps:
# - name: Check out
# uses: actions/checkout@v4
# - name: Test
# uses: ./.github/actions/test
# with:
# os: ${{ matrix.os }}
# artifact: ${{ matrix.artifact }}
# pattern: Prowlarr.*.Test.dll
# filter: ${{ matrix.filter }}
# unit_test_postgres:
# needs: backend
# runs-on: ubuntu-latest
# steps:
# - name: Check out
# uses: actions/checkout@v4
# - name: Test
# uses: ./.github/actions/test
# with:
# os: ubuntu-latest
# artifact: tests-linux-x64
# pattern: Prowlarr.*.Test.dll
# filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory!=IntegrationTest&TestCategory!=AutomationTest
# use_postgres: true
# integration_test:
# needs: backend
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
# include:
# - os: ubuntu-latest
# artifact: tests-linux-x64
# filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory=IntegrationTest
# binary_artifact: build_linux
# binary_path: linux-x64/${{ needs.backend.outputs.framework }}/Prowlarr
# - os: macos-latest
# artifact: tests-osx-x64
# filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory=IntegrationTest
# binary_artifact: build_macos
# binary_path: osx-x64/${{ needs.backend.outputs.framework }}/Prowlarr
# - os: windows-latest
# artifact: tests-win-x64
# filter: TestCategory!=ManualTest&TestCategory!=LINUX&TestCategory=IntegrationTest
# binary_artifact: build_windows
# binary_path: win-x64/${{ needs.backend.outputs.framework }}/Prowlarr
# runs-on: ${{ matrix.os }}
# steps:
# - name: Check out
# uses: actions/checkout@v4
# - name: Test
# uses: ./.github/actions/test
# with:
# os: ${{ matrix.os }}
# artifact: ${{ matrix.artifact }}
# pattern: Prowlarr.*.Test.dll
# filter: ${{ matrix.filter }}
# integration_tests: true
# binary_artifact: ${{ matrix.binary_artifact }}
# binary_path: ${{ matrix.binary_path }}
deploy:
if: ${{ github.ref_name == 'develop' || github.ref_name == 'sourcerarr' }}
# needs: [backend, frontend, unit_test, unit_test_postgres, integration_test]
needs: [backend-variables, backend, frontend]
secrets: inherit
uses: ./.github/workflows/deploy.yml
with:
framework: ${{ needs.backend-variables.outputs.framework }}
branch: ${{ github.ref_name }}
major_version: ${{ needs.backend-variables.outputs.major_version }}
version: ${{ needs.backend-variables.outputs.version }}
notify:
name: Discord Notification
# needs: [backend, frontend, unit_test, unit_test_postgres, integration_test, deploy]
needs: [backend-variables, backend, frontend, deploy]
if: ${{ !cancelled() && (github.ref_name == 'develop' || github.ref_name == 'sourcerarr') }}
env:
STATUS: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
runs-on: ubuntu-latest
steps:
- name: Notify
uses: tsickert/[email protected]
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
username: 'GitHub Actions'
avatar-url: 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'
embed-title: "${{ github.workflow }}: ${{ env.STATUS == 'success' && 'Success' || 'Failure' }}"
embed-url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
embed-description: |
**Branch** ${{ github.ref }}
**Build** ${{ needs.backend-variables.outputs.version }}
embed-color: ${{ env.STATUS == 'success' && '3066993' || '15158332' }}