Skip to content

Commit

Permalink
Merge branch 'main' into feat/add-user-types
Browse files Browse the repository at this point in the history
  • Loading branch information
oskogstad authored Jun 5, 2024
2 parents b006bf9 + aaec603 commit e1e4d7f
Show file tree
Hide file tree
Showing 15 changed files with 117 additions and 17 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/action-check-for-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
hasSlackNotifierChanges:
description: "Slack Notifier function related files changed"
value: ${{ jobs.check-for-changes.outputs.hasSlackNotifierChanges }}
hasSchemaChanges:
description: "Schema has changed"
value: ${{ jobs.check-for-changes.outputs.hasSchemaChanges }}
hasMigrationChanges:
description: "Migration related files changed"
value: ${{ jobs.check-for-changes.outputs.hasMigrationChanges }}
Expand All @@ -23,6 +26,7 @@ jobs:
hasBackendChanges: ${{ steps.filter.outputs.backend_any_changed == 'true' }}
hasAzureChanges: ${{ steps.filter.outputs.azure_any_changed == 'true' }}
hasSlackNotifierChanges: ${{ steps.filter.outputs.slackNotifier_any_changed == 'true'}}
hasSchemaChanges: ${{ steps.filter.outputs.schema_any_changed == 'true'}}
hasMigrationChanges: ${{ steps.filter.outputs.migration_any_changed == 'true'}}
steps:
- name: Checkout
Expand All @@ -46,5 +50,7 @@ jobs:
slackNotifier:
- '.github/**/*'
- 'src/Digdir.Tool.Dialogporten.SlackNotifier/**/*'
schema:
- 'docs/schema/V1/**/*'
migration:
- 'src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/**/*'
42 changes: 42 additions & 0 deletions .github/workflows/action-publish-schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish Schema to NPM

on:
workflow_call:
inputs:
version:
required: true
type: string
secrets:
NPM_TOKEN:
required: true
env:
WORKING_DIRECTORY: docs/schema/V1

jobs:
publish-schema-to-npm:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org/'

- name: Install dependencies
run: npm ci
working-directory: ${{ env.WORKING_DIRECTORY }}

- name: Update package version
run: |
jq '.version = "${{ inputs.version }}"' package.json > temp.json
mv temp.json package.json
working-directory: ${{ env.WORKING_DIRECTORY }}

- name: Publish package
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
working-directory: ${{ env.WORKING_DIRECTORY }}
10 changes: 10 additions & 0 deletions .github/workflows/ci-cd-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@ jobs:
function-project-path: "./src/Digdir.Tool.Dialogporten.SlackNotifier"
environment: test

publish-schema-npm:
name: Deploy schema npm package
needs: [check-for-changes, get-current-version, generate-git-short-sha]
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasSchemaChanges == 'true' }}
uses: ./.github/workflows/action-publish-schema.yml
with:
version: ${{ needs.get-current-version.outputs.version }}-${{ needs.generate-git-short-sha.outputs.gitShortSha }}
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

run-e2e-tests:
name: "Run K6 functional end-to-end tests"
# we want the end-to-end tests to be dependent on deployment of infrastructure and apps, but if infrastructure is skipped, we still want to run the tests
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/ci-cd-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ jobs:
version: ${{ needs.get-current-version.outputs.version }}
runMigration: ${{ needs.check-for-changes.outputs.hasMigrationChanges == 'true' }}

publish-schema-npm:
name: Publish schema npm package
needs: [check-for-changes, get-current-version]
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasSchemaChanges == 'true' }}
uses: ./.github/workflows/action-publish-schema.yml
with:
version: ${{ needs.get-current-version.outputs.version }}
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

run-e2e-tests:
name: "Run K6 functional end-to-end tests"
# we want the end-to-end tests to be dependent on deployment of infrastructure and apps, but if infrastructure is skipped, we still want to run the tests
Expand Down
19 changes: 19 additions & 0 deletions docs/schema/V1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Dialogporten Schema Package

This npm package contains both the Swagger and GraphQL schema definitions for the Dialogporten API. It is designed to provide developers with the necessary specifications to interact with the Dialogporten API effectively.

## Description
This package includes:
- **GraphQL Schema (schema.verified.graphql)**: Defines the types, queries, and mutations available in the Dialogporten GraphQL API.
- **OpenAPI Specification ((swagger.verified.json))**: Provides a detailed description of the RESTful endpoints, parameters, and models used in the Dialogporten API.

## Usage
To use this package, include it in your project dependencies using npm:
To install the Dialogporten Schema Package in your JavaScript project, follow these steps:

1. Ensure you have npm installed. You can check by running `npm -v` in your terminal. If npm is not installed, download and install Node.js from [nodejs.org](https://nodejs.org/), which includes npm.

2. Add the Dialogporten Schema Package to your project dependencies. Run the following command in your project directory:
```bash
npm install @digdir/dialogporten-schema
```
13 changes: 13 additions & 0 deletions docs/schema/V1/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/schema/V1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"url": "git+https://github.com/digdir/dialogporten.git"
},
"license": "ISC"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.11.3" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0"/>
<PackageReference Include="HotChocolate.AspNetCore" Version="13.9.4" />
<PackageReference Include="HotChocolate.Data.EntityFramework" Version="13.9.4" />
<PackageReference Include="HotChocolate.AspNetCore.Authorization" Version="13.9.4" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.5" />
<PackageReference Include="HotChocolate.AspNetCore" Version="13.9.5" />
<PackageReference Include="HotChocolate.Data.EntityFramework" Version="13.9.5" />
<PackageReference Include="HotChocolate.AspNetCore.Authorization" Version="13.9.5" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.6" />
<PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="7.2.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Serilog.Sinks.ApplicationInsights" Version="4.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

<ItemGroup>
<PackageReference Include="Altinn.ApiClients.Maskinporten" Version="9.1.0" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.5" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.6" />
<PackageReference Include="Altinn.Authorization.ABAC" Version="0.0.8" />
<PackageReference Include="Bogus" Version="35.5.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.5" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.6" />
<PackageReference Include="Npgsql" Version="8.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.5">
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<TreatAsUsed>true</TreatAsUsed>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ WORKDIR /src

# Main project
COPY ["src/Digdir.Domain.Dialogporten.Infrastructure/Digdir.Domain.Dialogporten.Infrastructure.csproj", "src/Digdir.Domain.Dialogporten.Infrastructure/"]
# Dependencies
# Dependencies
COPY ["src/Digdir.Domain.Dialogporten.Domain/Digdir.Domain.Dialogporten.Domain.csproj", "src/Digdir.Domain.Dialogporten.Domain/"]
COPY ["src/Digdir.Library.Entity.Abstractions/Digdir.Library.Entity.Abstractions.csproj", "src/Digdir.Library.Entity.Abstractions/"]
COPY ["src/Digdir.Library.Entity.EntityFrameworkCore/Digdir.Library.Entity.EntityFrameworkCore.csproj", "src/Digdir.Library.Entity.EntityFrameworkCore/"]
Expand All @@ -17,7 +17,7 @@ COPY ["src/", "."]

WORKDIR "/src/Digdir.Domain.Dialogporten.Infrastructure"
RUN mkdir -p /app/publish
RUN dotnet tool install --global dotnet-ef --version 7.0.14
RUN dotnet tool install --global dotnet-ef
ENV PATH $PATH:/root/.dotnet/tools
RUN dotnet ef migrations -v bundle -o /app/publish/efbundle

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<PackageReference Include="Azure.Identity" Version="1.11.3" />
<PackageReference Include="FastEndpoints.Swagger" Version="5.25.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.5" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.6" />
<PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="7.2.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Serilog.Sinks.ApplicationInsights" Version="4.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.6" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
<PackageReference Include="BouncyCastle.Cryptography" Version="2.3.1" />
<PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0" />
<PackageReference Include="NSec.Cryptography" Version="24.4.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="Verify.Xunit" Version="24.2.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Verify.Xunit" Version="24.2.0" />
<PackageReference Include="xunit" Version="2.8.1" />
Expand Down

0 comments on commit e1e4d7f

Please sign in to comment.