Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the Library #11

Merged
merged 15 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build

on:
workflow_call:
inputs:
dotnet-version:
required: true
type: string
description: 'The version of .NET to use for the build'
default: '8.0.x'
os:
required: true
type: string
description: 'The operating system to use for the build'
default: 'ubuntu-latest'

jobs:
build:
runs-on: ${{ inputs.os }}

steps:
- uses: actions/checkout@v4

- name: Emit .NET 6.0 Framework Version (Ubuntu or MacOS)
if: ${{ inputs.dotnet-version == '6.0.x' && (startsWith(inputs.os, 'ubuntu-') || startsWith(inputs.os, 'macos-')) }}
run: echo "DOTNET_FX_VERSION=net6.0" >> $GITHUB_ENV

- name: Emit .NET 6.0 Framework Version (Windows)
if: ${{ inputs.dotnet-version == '6.0.x' && startsWith(inputs.os, 'windows-') }}
run: echo "DOTNET_FX_VERSION=net6.0" >> $env:GITHUB_ENV

- name: Emit .NET 7.0 Framework Version (Ubuntu or MacOS)
if: ${{ inputs.dotnet-version == '7.0.x' && (startsWith(inputs.os, 'ubuntu-') || startsWith(inputs.os, 'macos-')) }}
run: echo "DOTNET_FX_VERSION=net7.0" >> $GITHUB_ENV

- name: Emit .NET 7.0 Framework Version (Windows)
if: ${{ inputs.dotnet-version == '7.0.x' && startsWith(inputs.os, 'windows-') }}
run: echo "DOTNET_FX_VERSION=net7.0" >> $env:GITHUB_ENV

- name: Emit .NET 8.0 Framework Version (Ubuntu or MacOS)
if: ${{ inputs.dotnet-version == '8.0.x' && (startsWith(inputs.os, 'ubuntu-') || startsWith(inputs.os, 'macos-')) }}
run: echo "DOTNET_FX_VERSION=net8.0" >> $GITHUB_ENV

- name: Emit .NET 8.0 Framework Version (Windows)
if: ${{ inputs.dotnet-version == '8.0.x' && startsWith(inputs.os, 'windows-') }}
run: echo "DOTNET_FX_VERSION=net8.0" >> $env:GITHUB_ENV

- name: Setup .NET ${{ inputs.dotnet-version }} Framework
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ inputs.dotnet-version }}

- name: Restore dependencies
run: dotnet restore

- name: Build (Ubuntu or MacOS)
run: dotnet build --no-restore -c Release -f ${{ env.DOTNET_FX_VERSION }}
if: ${{ startsWith(inputs.os, 'ubuntu-') || startsWith(inputs.os, 'macos-') }}

- name: Build (Windows)
run: dotnet build --no-restore -c Release -f $env:DOTNET_FX_VERSION
if: ${{ startsWith(inputs.os, 'windows-') }}

- name: Test (Ubuntu or MacOS)
run: dotnet test --no-build --verbosity normal -c Release -f ${{ env.DOTNET_FX_VERSION }}
if: ${{ startsWith(inputs.os, 'ubuntu-') || startsWith(inputs.os, 'macos-') }}

- name: Test (Windows)
run: dotnet test --no-build --verbosity normal -c Release -f $env:DOTNET_FX_VERSION
if: ${{ startsWith(inputs.os, 'windows-') }}
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Deveel.Math CI

permissions:
packages: write
contents: read

on:
push:
branches: [ master, main]

jobs:
build:
strategy:
fail-fast: false
matrix:
dotnet-version: [ 6.0.x, 7.0.x, 8.0.x]
os: [ubuntu-latest, windows-latest, macos-latest ]

uses: ./.github/workflows/build.yml
with:
os: ${{ matrix.os }}
dotnet-version: ${{ matrix.dotnet-version }}

coverage:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET 8.0 Framework
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Run Tests with Coverage
run: dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*.XUnit]*"

- name: Publish Coverage Report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup .NET 8.0 Framework
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Setup GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

- name: Determine Version
uses: gittools/actions/gitversion/[email protected]

- name: Build
run: dotnet build -c Release /p:Version="${{ env.GitVersion_SemVer }}" /p:AssemblyVersion="${{ env.GitVersion_AssemblySemVer }}" /p:FileVersion="${{ env.GitVersion_AssemblySemFileVer }}"

- name: Pack the Nuget Packages
run: dotnet pack -c Release --no-build --no-restore --include-symbols --include-source --output nupkgs /p:PackageVersion="${{ env.GitVersion_NuGetVersionV2 }}"

- name: Publish the Nuget Packages to the GitHub Package Registry
run: dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/deveel/index.json"

18 changes: 18 additions & 0 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: PR Build

on:
pull_request:
branches: [ main, master ]

jobs:
build:
strategy:
fail-fast: false
matrix:
dotnet-version: [ 6.0.x, 7.0.x, 8.0.x]
os: [ubuntu-latest, windows-latest, macos-latest ]

uses: ./.github/workflows/build.yml
with:
os: ${{ matrix.os }}
dotnet-version: ${{ matrix.dotnet-version }}
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release

permissions:
packages: write
contents: read

on:
release:
types: [published]

jobs:
build:
strategy:
fail-fast: false
matrix:
dotnet-version: [ 6.0.x, 7.0.x, 8.0.x]
os: [ubuntu-latest, windows-latest, macos-latest ]

uses: ./.github/workflows/build.yml
with:
os: ${{ matrix.os }}
dotnet-version: ${{ matrix.dotnet-version }}

publish:
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-dept: 0

- name: Setup .NET 8.0 Framework
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Setup GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

- name: Determine Version
uses: gittools/actions/gitversion/[email protected]

- name: Build
run: dotnet build -c Release /p:Version="${{ env.GitVersion_SemVer }}" /p:AssemblyVersion="${{ env.GitVersion_AssemblySemVer }}" /p:FileVersion="${{ env.GitVersion_AssemblySemFileVer }}"

- name: Pack the Nuget Packages
run: dotnet pack -c Release --no-build --no-restore --include-symbols --include-source --output nupkgs /p:PackageVersion="${{ env.GitVersion_NuGetVersionV2 }}"

- name: Publish the Nuget Packages to the GitHub Package Registry
run: dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/deveel/index.json"

- name: Publish the Nuget Packages to the Nuget Gallery
run: dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source "https://api.nuget.org/v3/index.json"
Loading