website/.forgejo/workflows/build.yaml

76 lines
No EOL
2.4 KiB
YAML

name: dotnet build
on:
push:
branches:
- main
paths:
- 'src/**'
- 'tests/**'
- 'targets/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'tailwind.config.ts'
- 'tsconfig.json'
- '*.props'
- '*.targets'
jobs:
build:
runs-on: docker
container:
image: nseguin42/forgejo-runner:ubuntu
steps:
- uses: actions/checkout@v4
- name: install pnpm
run: npm install -g pnpm
- name: get npm cache directory
id: pnpm-cache-dir
shell: bash
run: pnpm config set store-dir .pnpm-store
- uses: actions/cache@v3
id: pnpm-cache
name: restore pnpm cache
with:
path: .pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: pnpm install
run: pnpm install --prefer-offline --frozen-lockfile
- uses: actions/cache/save@v3
name: save pnpm cache
if: steps.pnpm-cache.outputs.cache-hit != 'true'
with:
path: .pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- uses: actions/cache@v3
id: nuget-cache
name: restore nuget cache
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: dotnet tool restore
run: dotnet tool restore
if: steps.nuget-cache.outputs.cache-hit != 'true'
- name: dotnet restore
run: dotnet restore -p:Configuration=Release --configfile nuget.config --locked-mode
if: steps.nuget-cache.outputs.cache-hit != 'true'
- name: dotnet workload restore
run: dotnet workload restore
if: steps.nuget-cache.outputs.cache-hit != 'true'
- name: dotnet workload install wasm-tools
run: dotnet workload install wasm-tools
if: steps.nuget-cache.outputs.cache-hit != 'true'
- name: save nuget cache
uses: actions/cache/save@v3
if: steps.nuget-cache.outputs.cache-hit != 'true'
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
- name: dotnet build
run: dotnet build --no-restore --configuration Release
- name: dotnet test
run: dotnet test