-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from naminodarie/release/v1.0.0
Release/v1.0.0
- Loading branch information
Showing
15 changed files
with
250 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
name: Build-Release-Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+*" | ||
env: | ||
DOTNET_CLI_TELEMETRY_OPTOUT: true | ||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | ||
DOTNET_NOLOGO: true | ||
NUGET_XMLDOC_MODE: skip | ||
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | ||
WORKFLOW_VERSION_PROJ: AtCoderLibrary/AtCoderLibrary.csproj | ||
WORKFLOW_BUILD_SLN: AtCoderLibrary.sln | ||
GIT_COMMIT: ${{ github.sha }} | ||
|
||
jobs: | ||
get-version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.get-version.outputs.version }} | ||
is-new: ${{ steps.is-new-version.outputs.is-new }} | ||
is-prerelease: ${{ steps.is-new-version.outputs.is-prerelease }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Get version | ||
uses: naminodarie/get-net-sdk-project-versions-action@v1 | ||
id: get-version | ||
with: | ||
proj-path: ${{ env.WORKFLOW_VERSION_PROJ }} | ||
- name: Check tag | ||
uses: mukunku/tag-exists-action@v1.0.0 | ||
id: check-tag | ||
with: | ||
tag: v${{ steps.get-version.outputs.version }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: is new version? | ||
id: is-new-version | ||
run: | | ||
IS_PRE=false | ||
IS_NEW=false | ||
if [ "${{ steps.get-version.outputs.version }}" = "${GITHUB_REF#refs/tags/v}" ]; then | ||
echo "create version tag event: $GITHUB_REF" | ||
if [ "${{ steps.get-version.outputs.version-suffix }}" != "" ]; then | ||
IS_PRE=true | ||
fi | ||
IS_NEW=true | ||
elif [ "${{ steps.check-tag.outputs.exists }}" = "false" ]; then | ||
if [ "${{ steps.get-version.outputs.version-suffix }}" = "" ]; then | ||
echo "new version tag project: ${{ steps.get-version.outputs.version }}" | ||
IS_NEW=true | ||
fi | ||
fi | ||
echo "::set-output name=is-new::$IS_NEW" | ||
echo "::set-output name=is-prerelease::$IS_PRE" | ||
new-version-only: | ||
runs-on: ubuntu-latest | ||
needs: [get-version] | ||
if: ${{ needs.get-version.outputs.is-new == 'true' }} | ||
steps: | ||
- run: echo "new-version" | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: [new-version-only] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup .NET Core SDK 3.1 | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 3.1.x | ||
- name: Setup .NET SDK | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 5.0.x | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ${{ github.workspace }}/.nuget/packages | ||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-nuget- | ||
- name: Install dependencies | ||
run: dotnet restore ${{ env.WORKFLOW_BUILD_SLN }} | ||
- name: Build | ||
run: dotnet build ${{ env.WORKFLOW_BUILD_SLN }} --no-restore -c Release | ||
- name: Test | ||
run: dotnet test ${{ env.WORKFLOW_BUILD_SLN }} --no-restore --verbosity normal -c Release | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: dist | ||
path: bin/Packages/Release | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: [get-version, build] | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: dist | ||
path: dist | ||
- name: Push tag | ||
id: tag-version | ||
uses: mathieudutour/github-tag-action@v5 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
custom_tag: ${{ needs.get-version.outputs.version }} | ||
tag_prefix: "v" | ||
- name: Create release | ||
uses: ncipollo/release-action@v1 | ||
id: create-release | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ steps.tag-version.outputs.new_tag }} | ||
name: Version ${{ needs.get-version.outputs.version }} | ||
body: ${{ steps.tag_version.outputs.changelog }} | ||
artifacts: "./dist/*.nupkg" | ||
prerelease: ${{ needs.get-version.outputs.is-prerelease }} | ||
publish: | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: dist | ||
path: dist | ||
- name: Upload nuget | ||
run: dotnet nuget push "./dist/*.nupkg" --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.IO.Compression; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Text.Json; | ||
using FluentAssertions; | ||
using Kzrnm.Convert.Base32768; | ||
using Xunit; | ||
|
||
namespace AtCoder.Embedding | ||
{ | ||
public class SourceExpanderTest | ||
{ | ||
private readonly Dictionary<string, string> assemblyMetadata | ||
= typeof(IntFenwickTree).Assembly | ||
.GetCustomAttributes<AssemblyMetadataAttribute>() | ||
.ToDictionary(attr => attr.Key, attr => attr.Value); | ||
|
||
[Fact] | ||
public void LanguageVersion() | ||
=> assemblyMetadata.Should().ContainKey("SourceExpander.EmbeddedLanguageVersion") | ||
.WhichValue.Should().Be("8.0"); | ||
|
||
[Fact] | ||
public async void EmbeddedSource() | ||
{ | ||
var embeddedSourceGZipJson = Base32768.Decode(assemblyMetadata.Should().ContainKey("SourceExpander.EmbeddedSourceCode.GZipBase32768").WhichValue); | ||
using var msIn = new MemoryStream(embeddedSourceGZipJson); | ||
using var gzipStream = new GZipStream(msIn, CompressionMode.Decompress); | ||
var embeddedSource = await JsonSerializer.DeserializeAsync<SourceFileInfo[]>(gzipStream); | ||
embeddedSource.Select(s => s.FileName) | ||
.Should() | ||
.OnlyContain(name => name.StartsWith("AtCoderLibrary>")); | ||
embeddedSource.SelectMany(s => s.TypeNames) | ||
.Should() | ||
.Contain(new[] { | ||
"AtCoder.IArithmeticOperator<T>", | ||
"AtCoder.FenwickTree<TValue, TOp>", | ||
}); | ||
} | ||
|
||
private class SourceFileInfo | ||
{ | ||
public string FileName { get; set; } | ||
public IEnumerable<string> TypeNames { get; set; } | ||
//public IEnumerable<string> Usings { get; set; } | ||
//public IEnumerable<string> Dependencies { get; set; } | ||
//public string CodeBody { get; set; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.