Skip to content

Commit a5e0919

Browse files
Release v0.1.5 (#9)
Minor linter fixups + CI fixes + development docs. Signed-off-by: Philip Conrad <[email protected]>
1 parent f31e4cf commit a5e0919

11 files changed

+58
-18
lines changed

.github/workflows/01_build.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ on:
33
workflow_dispatch:
44
pull_request:
55

6+
env:
7+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
8+
DOTNET_NOLOGO: true
9+
610
jobs:
711
build:
812
name: Build

.github/workflows/02_publish_docs.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ permissions:
1414
pages: write
1515
id-token: write
1616

17+
env:
18+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
19+
DOTNET_NOLOGO: true
20+
1721
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
1822
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
1923
concurrency:

.github/workflows/03b_publish_gh_release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "3 – Publish Github Release"
1+
name: "3b – Publish Github Release"
22

33
# Trigger the action on push to main
44
on:

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src/*/bin/
2+
src/*/obj/
3+
test/*/bin/
4+
test/*/obj/

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
All notable changes to this project will be documented in this file. This
44
project adheres to [Semantic Versioning](http://semver.org/).
55

6+
## 0.1.5
7+
8+
This release is a release engineering test of the decoupled workflow.
9+
610
## 0.1.4
711

812
This release decouples Github Releases from NuGet package updates.

DEVELOPMENT.md

+30
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,32 @@
11
# OPA ASP.NET Core SDK Development
22

3+
## Reference docs auto-publishing
4+
5+
On every commit merged to `main`, the docs will automatically be rebuilt using DocFX, and then published using Github Pages as a "Deployment", similar to how the `StyraInc/opa-csharp` repo publishes its reference docs.
6+
7+
8+
## Release workflows
9+
10+
### Minor changes
11+
12+
If you are doing minor bugfixes, simply merge your PRs to `main` after bumping the version in `src/Styra.Opa.AspNetCore/Styra.Opa.AspNetCore.csproj` (the main project file).
13+
The release automation will then discover that the version differs from the latest version on NuGet, and will automatically publish the package after building and running tests.
14+
15+
16+
### Major changes
17+
18+
If you are doing major changes, adding features, or fixing major bugs, do the same steps as mentioned above for the "Minor changes" workflow, but after merging, push up a release PR, and a tag, as detailed below.
19+
20+
Example:
21+
- The `.csproj` file version is bumped from `0.2.42` to `0.3.0`.
22+
- Create a git branch named `release-v0.3.0`.
23+
- Add a `CHANGELOG.md` entry:
24+
```md
25+
## 0.3.0
26+
27+
My significant changes...
28+
```
29+
- Push up the branch to Github: `git push origin release-v0.3.0`
30+
- Create a PR.
31+
- After merging the PR, push up the tag `v0.3.0`, (e.g. `git checkout main && git pull && git tag v0.3.0 && git push origin v0.3.0`)
32+
- Release automation will automatically pluck out the latest release notes, and use them as the body text for a Github Release.

src/Styra.Opa.AspNetCore/OpaAuthorizationMiddleware.cs

-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ await context.WriteAccessDeniedResponse(
161161
public Dictionary<string, object> MakeRequestInput(HttpContext context)
162162
{
163163
var subjectId = context.User.Identity?.Name ?? "";
164-
//var subjectDetails = principal ?? "";
165164
var subjectClaims = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(context.User.Claims, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore })) ?? new { };
166165

167166
string resourceId = context.Request.Path;

src/Styra.Opa.AspNetCore/OpaResponseContext.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4-
using System.Reflection.Metadata.Ecma335;
54
using Newtonsoft.Json;
65

76
namespace Styra.Opa.AspNetCore;

src/Styra.Opa.AspNetCore/Styra.Opa.AspNetCore.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<PackageId>Styra.Opa.AspNetCore</PackageId>
4-
<Version>0.1.4</Version>
4+
<Version>0.1.5</Version>
55
<Authors>Styra</Authors>
66
<TargetFramework>net8.0</TargetFramework>
77
<IsPackable>true</IsPackable>

test/Styra.Opa.AspNetCore.Tests/EOPAContainerFixture.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public async Task InitializeAsync()
1515
"testdata/simple/policy.rego",
1616
"testdata/simple/system.rego",
1717
};
18-
string[] opaCmd = { "run", "--server", "--addr=0.0.0.0:8181", "--disable-telemetry" };
18+
string[] opaCmd = ["run", "--server", "--addr=0.0.0.0:8181", "--disable-telemetry"];
1919
var startupCommand = new List<string>().Concat(opaCmd).Concat(startupFiles).ToArray();
2020

2121
// Create a new instance of a container.

test/Styra.Opa.AspNetCore.Tests/OpaAspNetCoreTests.cs

+9-13
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ protected override Task<AuthenticateResult> HandleAuthenticateAsync()
4747
}
4848
}
4949

50-
public class OpaAspNetCoreTests : IClassFixture<OPAContainerFixture>, IClassFixture<EOPAContainerFixture>
50+
public class OpaAspNetCoreTests(OPAContainerFixture opaFixture, EOPAContainerFixture eopaFixture) : IClassFixture<OPAContainerFixture>, IClassFixture<EOPAContainerFixture>
5151
{
52-
public IContainer _containerOpa;
53-
public IContainer _containerEopa;
52+
public IContainer _containerOpa = opaFixture.GetContainer();
53+
public IContainer _containerEopa = eopaFixture.GetContainer();
5454

55-
public IWebHostBuilder GetWebHostBuilder()
55+
public static IWebHostBuilder GetWebHostBuilder()
5656
{
5757
var builder = new WebHostBuilder()
5858
.ConfigureServices(services =>
@@ -75,12 +75,6 @@ public IWebHostBuilder GetWebHostBuilder()
7575
return builder;
7676
}
7777

78-
public OpaAspNetCoreTests(OPAContainerFixture opaFixture, EOPAContainerFixture eopaFixture)
79-
{
80-
_containerOpa = opaFixture.GetContainer();
81-
_containerEopa = eopaFixture.GetContainer();
82-
}
83-
8478
private OpaClient GetOpaClient()
8579
{
8680
// Construct the request URI by specifying the scheme, hostname, assigned random host port, and the endpoint "uuid".
@@ -211,9 +205,11 @@ public async Task TestMiddlewareJSONFormatEcho()
211205
expectCtx.ID = "0";
212206
expectCtx.Data = expectData;
213207

214-
OpaResponse expect = new OpaResponse();
215-
expect.Decision = true;
216-
expect.Context = expectCtx;
208+
OpaResponse expect = new()
209+
{
210+
Decision = true,
211+
Context = expectCtx
212+
};
217213
string expectedJson = JsonConvert.SerializeObject(expect, Formatting.Indented);
218214

219215
IContextDataProvider prov = new ConstantContextDataProvider(new Dictionary<string, string>() {

0 commit comments

Comments
 (0)