myWebLog/.github/workflows/ci.yml

100 lines
3.0 KiB
YAML
Raw Normal View History

2024-03-23 22:50:33 +00:00
name: Continuous Integration
on:
push:
2024-03-24 01:06:49 +00:00
branches:
- main
2024-03-23 22:50:33 +00:00
pull_request:
2024-03-24 01:06:49 +00:00
branches:
- main
2024-03-23 22:50:33 +00:00
workflow_dispatch:
2024-03-23 23:01:35 +00:00
env:
MWL_TEST_RETHINK_URI: rethinkdb://localhost/mwl_test
2024-03-23 22:50:33 +00:00
jobs:
build_and_test:
name: Build / Test
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version:
2024-03-24 01:06:49 +00:00
- "6.0"
- "7.0"
- "8.0"
2024-03-23 22:50:33 +00:00
services:
postgres:
image: postgres:latest
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
rethink:
image: rethinkdb:latest
ports:
2024-03-24 01:06:49 +00:00
- 28015:28015
2024-03-23 22:50:33 +00:00
steps:
2024-03-24 01:06:49 +00:00
- name: Check Out Code
uses: actions/checkout@v4
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 8.x
- name: Restore dependencies
run: dotnet restore src/MyWebLog.sln
- name: Build (${{ matrix.dotnet-version }})
run: dotnet build src/MyWebLog.sln -f net${{ matrix.dotnet-version }}
- name: Test (${{ matrix.dotnet-version }})
run: cd src/MyWebLog.Tests; dotnet run -f net${{ matrix.dotnet-version }}
2024-03-23 23:36:22 +00:00
publish:
2024-03-24 00:32:07 +00:00
name: Publish Packages
2024-03-23 23:36:22 +00:00
runs-on: ubuntu-latest
needs: build_and_test
2024-03-24 00:32:07 +00:00
strategy:
matrix:
ver:
- "net6.0"
- "net7.0"
- "net8.0"
os:
- "linux-x64"
- "win-x64"
include:
- os: "linux-x64"
bz2: true
- os: "win-x64"
zip: true
2024-03-23 23:36:22 +00:00
steps:
2024-03-24 00:32:07 +00:00
- name: Check Out Code
uses: actions/checkout@v4
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 8.x
- name: Publish (Release)
run: dotnet publish -c Release -f ${{ matrix.ver }} -r ${{ matrix.os }} src/MyWebLog/MyWebLog.fsproj
- name: Zip Admin Theme
run: cd src/admin-theme; zip -r ../MyWebLog/bin/Release/${{ matrix.ver }}/${{ matrix.os }}/publish/admin-theme.zip *; cd ../..
- name: Zip Default Theme
run: cd src/default-theme; zip -r ../MyWebLog/bin/Release/${{ matrix.ver }}/${{ matrix.os }}/publish/default-theme.zip *; cd ../..
- if: ${{ matrix.bz2 }}
name: Create .tar.bz2 Archive
run: tar cfj myWebLog-${{ matrix.ver }}-${{ matrix.os }}.tar.bz2 -C src/MyWebLog/bin/Release/${{ matrix.ver }}/${{ matrix.os }}/publish .
- if: ${{ matrix.zip }}
name: Create .zip Archive
run: cd src/MyWebLog/bin/Release/${{ matrix.ver }}/${{ matrix.os }}/publish; zip -r myWebLog-${{ matrix.ver }}-${{ matrix.os }}.zip *; cp myWeb*.zip ../../../../../../..; cd ../../../../../../..
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
2024-03-24 00:46:47 +00:00
name: package-${{ matrix.ver }}-${{ matrix.os }}
2024-03-24 00:35:28 +00:00
path: |
*x64.zip
*.bz2