Skip to content

添加自动登录、自动更新cookie的回答到issue模板 #617

添加自动登录、自动更新cookie的回答到issue模板

添加自动登录、自动更新cookie的回答到issue模板 #617

Workflow file for this run

name: Build and Test
on:
push:
branches:
- "**"
pull_request:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- uses: actions/setup-dotnet@v3
- name: Make sure webui can be built
if: "${{ matrix.os == 'windows-latest' }}"
run: ./webui/build.ps1
- name: Make sure webui can be built
if: "${{ matrix.os == 'ubuntu-latest' }}"
run: ./webui/build.sh
- name: Run Tests - Debug
run: dotnet test -v m -c Debug
- name: Run Tests - Release
run: dotnet test -v m -c Release
build_wpf:
# Tests can be run parallelly for debug builds to save time
# needs: test
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Restore Packages
run: msbuild -t:restore /v:m BililiveRecorder.WPF/BililiveRecorder.WPF.csproj
- name: Build WPF - Debug
run: msbuild /nologo /v:m /p:Configuration="Debug" BililiveRecorder.WPF/BililiveRecorder.WPF.csproj
- name: Build WPF - Release
run: msbuild /nologo /v:m /p:Configuration="Release" BililiveRecorder.WPF/BililiveRecorder.WPF.csproj
- name: Upload Artifacts - Debug
uses: actions/upload-artifact@v3
with:
name: WPF-Debug
path: BililiveRecorder.WPF/bin/Debug
- name: Upload Artifacts - Release
uses: actions/upload-artifact@v3
with:
name: WPF-Release
path: BililiveRecorder.WPF/bin/Release
build_cli:
# Tests can be run parallelly for debug builds to save time
# needs: test
strategy:
matrix:
rid: [any, linux-arm, linux-arm64, linux-x64, osx-x64, osx-arm64, win-x64]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- uses: actions/setup-dotnet@v3
- name: Build WebUI
run: ./webui/build.sh
- name: Build CLI - Debug
if: ${{ matrix.rid == 'any' }}
run: dotnet publish -c Debug BililiveRecorder.Cli/BililiveRecorder.Cli.csproj
- name: Build CLI - Release
if: ${{ matrix.rid == 'any' }}
run: dotnet publish -c Release BililiveRecorder.Cli/BililiveRecorder.Cli.csproj
- name: Build CLI - Debug
if: ${{ matrix.rid != 'any' }}
run: dotnet publish -c Debug -r ${{ matrix.rid }} BililiveRecorder.Cli/BililiveRecorder.Cli.csproj
- name: Build CLI - Release
if: ${{ matrix.rid != 'any' }}
run: dotnet publish -c Release -r ${{ matrix.rid }} BililiveRecorder.Cli/BililiveRecorder.Cli.csproj
- name: Upload Artifacts - Debug
uses: actions/upload-artifact@v3
with:
name: CLI-${{ matrix.rid }}-Debug
path: BililiveRecorder.Cli/publish/${{ matrix.rid }}/Debug
- name: Upload Artifacts - Release
uses: actions/upload-artifact@v3
with:
name: CLI-${{ matrix.rid }}-Release
path: BililiveRecorder.Cli/publish/${{ matrix.rid }}/Release
build_docker:
# Tests can be run parallelly for debug builds to save time
# needs: test
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=edge
type=ref,event=branch
type=ref,event=pr
- name: Build WebUI
run: ./webui/build.sh
- name: Build CLI
run: dotnet build -c Release -o ./BililiveRecorder.Cli/bin/docker_out BililiveRecorder.Cli/BililiveRecorder.Cli.csproj
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.GitHubActions
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}