From 5e2658cebe9bcc0a36071cd2497cfad2b643be89 Mon Sep 17 00:00:00 2001 From: Charley Wu Date: Sat, 14 Sep 2024 18:57:53 +0800 Subject: [PATCH 1/2] Set up linting --- .github/workflows/lint.yml | 37 +++++++++++++++++++++++++++++++++++++ .hadolint.yaml | 6 ++++++ .markdownlint-cli2.jsonc | 6 ++++++ README.md | 4 +++- 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .hadolint.yaml create mode 100644 .markdownlint-cli2.jsonc diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..2c103deb --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,37 @@ +name: Lint + +on: + push: + branches: + - main + paths: + - '**/*.md' + - '**/*.sh' + - '**/Dockerfile' + - '.github/workflows/*.yml' + pull_request: + branches: + - main + paths: + - '**/*.md' + - '**/*.sh' + - '**/Dockerfile' + - '.github/workflows/*.yml' + +jobs: + build: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Lint Markdown + uses: DavidAnson/markdownlint-cli2-action@v16 + with: + globs: '**/*.md' + - name: Lint Dockerfile + uses: reviewdog/action-hadolint@v1 + - name: Lint shell script + uses: reviewdog/action-shellcheck@v1 + - name: Lint GitHub Actions workflow + uses: reviewdog/action-actionlint@v1 \ No newline at end of file diff --git a/.hadolint.yaml b/.hadolint.yaml new file mode 100644 index 00000000..fa20aa5c --- /dev/null +++ b/.hadolint.yaml @@ -0,0 +1,6 @@ +--- +ignored: + - DL3006 + - DL3008 + - DL3018 + - DL4006 diff --git a/.markdownlint-cli2.jsonc b/.markdownlint-cli2.jsonc new file mode 100644 index 00000000..d24c3acb --- /dev/null +++ b/.markdownlint-cli2.jsonc @@ -0,0 +1,6 @@ +{ + "$schema": "https://raw.githubusercontent.com/DavidAnson/markdownlint-cli2/main/schema/markdownlint-cli2-config-schema.json", + "config": { + "line-length": false + } +} diff --git a/README.md b/README.md index 9a2ca480..146b42ba 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ # GSS.Authentication.CAS -[![Build Status][build-badge]][build] [![Code Coverage][codecov-badge]][codecov] +[![Build Status][build-badge]][build] [![Code Coverage][codecov-badge]][codecov] [![Lint][lint-badge]][lint] [build]: https://github.com/akunzai/GSS.Authentication.CAS/actions/workflows/build.yml [build-badge]: https://github.com/akunzai/GSS.Authentication.CAS/actions/workflows/build.yml/badge.svg [codecov]: https://codecov.io/gh/akunzai/GSS.Authentication.CAS [codecov-badge]: https://codecov.io/gh/akunzai/GSS.Authentication.CAS/branch/main/graph/badge.svg?token=JGG7Y07SR0 +[lint]: https://github.com/akunzai/GSS.Authentication.CAS/actions/workflows/lint.yml +[lint-badge]: https://github.com/akunzai/GSS.Authentication.CAS/actions/workflows/lint.yml/badge.svg CAS Authentication Middleware for OWIN & ASP.NET Core From cdd460dd814f03fd23d4546819640760e112b50b Mon Sep 17 00:00:00 2001 From: Charley Wu Date: Sat, 14 Sep 2024 18:58:31 +0800 Subject: [PATCH 2/2] Fix lint warnings --- .devcontainer/Dockerfile | 5 ++++- .devcontainer/keycloak/Dockerfile | 2 +- .devcontainer/setup.sh | 2 +- .github/ISSUE_TEMPLATE/bug_report.md | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 05250c14..b842b02d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,8 +1,11 @@ +FROM mcr.microsoft.com/dotnet/aspnet:6.0-bookworm-slim as dotnet-lts-runtime +FROM docker.io/library/mono as mono + # https://hub.docker.com/_/microsoft-dotnet-sdk/ FROM mcr.microsoft.com/dotnet/sdk:8.0 # install ASP.NET Core 6.0 Runtime -COPY --from=mcr.microsoft.com/dotnet/aspnet:6.0-bookworm-slim /usr/share/dotnet /usr/share/dotnet +COPY --from=dotnet-lts-runtime /usr/share/dotnet /usr/share/dotnet # install msbuild for Mono # https://hub.docker.com/_/mono/ diff --git a/.devcontainer/keycloak/Dockerfile b/.devcontainer/keycloak/Dockerfile index b446ae00..19c01acc 100644 --- a/.devcontainer/keycloak/Dockerfile +++ b/.devcontainer/keycloak/Dockerfile @@ -4,7 +4,7 @@ ARG KEYCLOAK_VERSION=25.0.4 FROM alpine as downloader ARG KEYCLOAK_VERSION RUN set -eux; \ - apk add curl; \ + apk add --no-cache curl; \ # https://github.com/jacekkow/keycloak-protocol-cas curl -Lo /tmp/keycloak-protocol-cas.jar https://github.com/jacekkow/keycloak-protocol-cas/releases/download/${KEYCLOAK_VERSION}/keycloak-protocol-cas-${KEYCLOAK_VERSION}.jar; diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index d0ca4539..de6d76f0 100755 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # https://learn.microsoft.com/aspnet/core/security/docker-compose-https#macos-or-linux -if [ -f "/https/aspnetapp.pem" ] && [ -f "/https/aspnetapp.key" ]; then +if [[ -f "/https/aspnetapp.pem" ]] && [[ -f "/https/aspnetapp.key" ]]; then cat >> /home/vscode/.bashrc <