Skip to content

Commit

Permalink
Add Github Actions for build.
Browse files Browse the repository at this point in the history
Remove integration with AppVeyor.
  • Loading branch information
MichalBrylka committed Dec 18, 2023
1 parent a4cfeee commit 9940656
Show file tree
Hide file tree
Showing 57 changed files with 715 additions and 595 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,109 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: 'CI'
on:
workflow_dispatch:
push:
branches:
- 'main'
pull_request:
branches:
- '*'
release:
types:
- published

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NuGetDirectory: ${{ github.workspace}}/nuget

defaults:
run:
shell: pwsh

jobs:
create_nuget:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer

- name: Setup .NET # Install the .NET SDK indicated in the global.json file
uses: actions/setup-dotnet@v3


- name: Release Pack (update release notes)
if: github.event_name == 'release'
env:
RELEASE_NAME: ${{ github.event.release.name }}
RELEASE_BODY: ${{ github.event.release.body }}
run: |
$name = $env:RELEASE_NAME
$body = $env:RELEASE_BODY
$releaseNotes = "# Release ${{ github.event.release.tag_name }}"
if($name){
$releaseNotes = $releaseNotes + " - " + $name
}
if($body){
$releaseNotes = $releaseNotes + "`r`n`r`n" + $body
}
Write-Host "`tSetting release notes to '$releaseNotes'"
dotnet pack --configuration Release --output ${{ env.NuGetDirectory }} -p:PackageReleaseNotes=$releaseNotes
- name: Non-release Pack
if: github.event_name != 'release'
run: dotnet pack --configuration Release --output ${{ env.NuGetDirectory }}

- uses: actions/upload-artifact@v3
with:
name: nuget
if-no-files-found: error
retention-days: 7
path: ${{ env.NuGetDirectory }}/*.nupkg

run_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
- name: Run tests
run: dotnet test --configuration Release --logger "trx;LogFilePrefix=T"
- name: Upload test results
uses: actions/upload-artifact@v3
if: success() || failure() # run this step even if previous step failed
with:
name: TestResult
if-no-files-found: error
retention-days: 7
path: "**/*.trx"

deploy:
if: github.event_name == 'release' || (github.event_name == 'push' && github.ref_name == 'main')
runs-on: ubuntu-latest
needs: [ create_nuget, run_test ]
steps:
- uses: actions/download-artifact@v3
with:
name: nuget
path: ${{ env.NuGetDirectory }}

- name: Setup .NET Core
uses: actions/setup-dotnet@v3

- name: Publish NuGet package
env:
EVENT_NAME: ${{ github.event_name }}
run: |
$key = ($env:EVENT_NAME -eq 'release') ? "${{ secrets.NUGET_API_KEY }}" : "${{ secrets.GH_PACKAGE_REGISTRY_API_KEY }}"
$source = ($env:EVENT_NAME -eq 'release') ? "https://api.nuget.org/v3/index.json" : "https://nuget.pkg.github.com/MichalBrylka/index.json"
foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) {
dotnet nuget push $file --api-key "$key" --source "$source" --skip-duplicate
}
56 changes: 14 additions & 42 deletions .github/workflows/codeql-analysis.yml
@@ -1,24 +1,13 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
workflow_dispatch:
pull_request:
branches: [ main ]
schedule:
- cron: '40 18 * * 0'
- cron: '40 16 * * 0'

run-name: "QL"

jobs:
analyze:
Expand All @@ -28,40 +17,23 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
language: [ 'csharp' ] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
languages: ${{ matrix.language }}

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
- name: Setup .NET
uses: actions/setup-dotnet@v3

#- run: |
# make bootstrap
# make release
- run: dotnet build --configuration Release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
27 changes: 27 additions & 0 deletions .github/workflows/license-scanning.yml
@@ -0,0 +1,27 @@
name: License Scanning

on:
workflow_dispatch:
pull_request:
branches:
- '*'

defaults:
run:
shell: pwsh


jobs:
scan:
runs-on: ubuntu-latest

steps:
- name: Checkout tree
uses: actions/checkout@v4



- name: Run FOSSA scan and upload build data
uses: fossa-contrib/fossa-action@v3
with:
fossa-api-key: ${{ secrets.FOSSA_API_KEY }}
21 changes: 21 additions & 0 deletions .github/workflows/test-report.yml
@@ -0,0 +1,21 @@
name: 'Test Report'
on:
workflow_run:
workflows: ['CI']
types:
- completed

run-name: "Test for '${{ github.event.workflow_run.head_commit.message }}'"

jobs:
report:
runs-on: ubuntu-latest
steps:
- uses: dorny/test-reporter@v1
with:
artifact: 'TestResult'
name: "Tests results"
reporter: dotnet-trx
path: "**/*.trx"
fail-on-error: 'true'
fail-on-empty: 'true'
3 changes: 1 addition & 2 deletions Benchmarks/AggressionBasedBench.cs
@@ -1,5 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes;

// ReSharper disable CommentTypo

Expand Down
5 changes: 1 addition & 4 deletions Benchmarks/ArrayParserBench.cs
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes;
using Nemesis.TextParsers;

// ReSharper disable CommentTypo
Expand Down
4 changes: 1 addition & 3 deletions Benchmarks/BenchmarkInput.cs
@@ -1,7 +1,5 @@
using System;
using System.Collections;
using System.Collections;
using System.Globalization;
using System.Linq;

namespace Benchmarks
{
Expand Down
3 changes: 1 addition & 2 deletions Benchmarks/CollectionParserBench.cs
@@ -1,5 +1,4 @@
using System;
using System.Buffers;
using System.Buffers;
using System.ComponentModel;
using BenchmarkDotNet.Attributes;
using Nemesis.TextParsers;
Expand Down
7 changes: 1 addition & 6 deletions Benchmarks/CollectionSerializerSlow.cs
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using System.ComponentModel;

namespace Benchmarks
{
Expand Down
4 changes: 1 addition & 3 deletions Benchmarks/DeconstructablesBench.cs
@@ -1,7 +1,5 @@
using System;
using System.ComponentModel;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using BenchmarkDotNet.Attributes;
using Nemesis.TextParsers;
using Nemesis.TextParsers.Utils;
Expand Down
4 changes: 1 addition & 3 deletions Benchmarks/DynamicMethodGenerator.cs
@@ -1,6 +1,4 @@
using System;
using System.Linq;
using System.Reflection.Emit;
using System.Reflection.Emit;

namespace Benchmarks
{
Expand Down
7 changes: 1 addition & 6 deletions Benchmarks/EnumBench.cs
@@ -1,9 +1,4 @@
using System;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
Expand Down
2 changes: 0 additions & 2 deletions Benchmarks/LinqBench/Linq_Count_Vs_Any.cs
@@ -1,6 +1,4 @@
using System.Buffers;
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
Expand Down
2 changes: 0 additions & 2 deletions Benchmarks/LinqBench/Linq_WhereAndFirst_Vs_First.cs
@@ -1,6 +1,4 @@
using System.Buffers;
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
Expand Down
6 changes: 1 addition & 5 deletions Benchmarks/MultiKeyDictionaryBench.cs
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
// ReSharper disable UseDeconstruction
// ReSharper disable SuggestVarOrType_SimpleTypes
Expand Down
5 changes: 1 addition & 4 deletions Benchmarks/ParserBench.cs
@@ -1,7 +1,4 @@
using System;
using System.IO;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes;
using Nemesis.TextParsers;
using Newtonsoft.Json;

Expand Down
4 changes: 1 addition & 3 deletions Benchmarks/StructureOfArraysBench.cs
@@ -1,6 +1,4 @@
using System.Linq;

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Diagnosers;

// ReSharper disable MemberCanBePrivate.Local
Expand Down
26 changes: 17 additions & 9 deletions Directory.Build.props
@@ -1,19 +1,13 @@
<Project>
<PropertyGroup>
<!--This will get replaced by Build System-->
<Version>1.0.0</Version>
<Version>0.0.1</Version>

<LangVersion>12.0</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>

<!--TODO <Nullable>enable</Nullable>-->

<Authors>Michał Bryłka, Leszek Kowalski</Authors>
<PackageLicenseExpression>MIT OR Apache-2.0</PackageLicenseExpression>
<Copyright>Copyright (c) Michał Bryłka. Icon by http://www.iconka.com </Copyright>
<!--TODO <Nullable>enable</Nullable>-->
<IsPackable>false</IsPackable>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageProjectUrl>https://github.com/nemesissoft/Nemesis.TextParsers</PackageProjectUrl>

<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
Expand All @@ -25,6 +19,20 @@
<AssemblyOriginatorKeyFile>..\Nemesis.TextParsers.Public.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<None Include="..\images\icon.png" Pack="true" PackagePath="properties">
<Link>properties\icon.png</Link>
</None>

<None Include="..\README.md" Pack="true" PackagePath="properties">
<Link>properties\README.md</Link>
</None>
</ItemGroup>

<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
</ItemGroup>

<ItemGroup>
<Using Include="System.Linq.Expressions" />
<Using Include="System.Text" />
Expand Down

0 comments on commit 9940656

Please sign in to comment.