-
-
Notifications
You must be signed in to change notification settings - Fork 1
ci: add required test and container gates #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,9 @@ | ||
| .git | ||
| .github | ||
| .pytest_cache | ||
| **/__pycache__ | ||
| **/*.pyc | ||
| site/node_modules | ||
| site/dist | ||
| site/.astro | ||
| work |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -91,9 +91,6 @@ markmap/ | |
| *.dll | ||
| *.exe | ||
|
|
||
| # Docker | ||
| .dockerignore | ||
|
|
||
| # Coverage reports | ||
| /coverage/ | ||
| *.coverage | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
| @@ -1,17 +1,25 @@ | ||
| # Use a base image with the required runtime for FortiPath | ||
| FROM ubuntu:20.04 | ||
| FROM node:22-alpine AS build | ||
|
|
||
| # Set working directory | ||
| WORKDIR /app | ||
| WORKDIR /app/site | ||
|
|
||
| # Copy the FortiPath application to the container | ||
| COPY . /app | ||
| COPY site/package.json site/package-lock.json ./ | ||
| RUN npm ci | ||
|
|
||
| # Install any necessary dependencies | ||
| # TODO: Add installation commands for FortiPath dependencies | ||
| COPY site/ ./ | ||
| COPY docs /app/docs | ||
| COPY mermaid /app/mermaid | ||
| RUN --mount=type=secret,id=github_token,required=true \ | ||
| export GITHUB_TOKEN="$(cat /run/secrets/github_token)" \ | ||
| && node --experimental-strip-types scripts/fetch_repo_data.ts \ | ||
| && node --experimental-strip-types scripts/fetch_discussions.ts \ | ||
| && node --experimental-strip-types scripts/fetch_projects.ts \ | ||
| && npm run build | ||
|
|
||
| # Expose the port FortiPath runs on | ||
| EXPOSE 8080 | ||
| FROM nginxinc/nginx-unprivileged:1.27-alpine | ||
|
|
||
| COPY infra/nginx.conf /etc/nginx/conf.d/default.conf | ||
| COPY --from=build /app/site/dist /usr/share/nginx/html | ||
|
|
||
| # Command to run the application | ||
| CMD ["./fortipath"] | ||
| HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ | ||
| CMD wget --quiet --spider http://127.0.0.1:8080/ || exit 1 | ||
| EXPOSE 8080 |
This file contains hidden or 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,28 @@ | ||
| server { | ||
| listen 8080; | ||
| listen [::]:8080; | ||
| server_name _; | ||
|
|
||
| root /usr/share/nginx/html; | ||
| index index.html; | ||
|
|
||
| location / { | ||
| try_files $uri $uri/ $uri.html =404; | ||
| } | ||
|
|
||
| location = /FortiPath { | ||
| return 301 /FortiPath/; | ||
| } | ||
|
|
||
| location ^~ /FortiPath/ { | ||
| rewrite ^/FortiPath/?(.*)$ /$1 break; | ||
| try_files $uri $uri/ $uri.html =404; | ||
| } | ||
|
|
||
| add_header X-Content-Type-Options "nosniff" always; | ||
| add_header Referrer-Policy "strict-origin-when-cross-origin" always; | ||
| add_header X-Frame-Options "SAMEORIGIN" always; | ||
|
|
||
| access_log /dev/stdout; | ||
| error_log /dev/stderr warn; | ||
| } | ||
This file contains hidden or 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,50 @@ | ||
| import datetime | ||
| import importlib.util | ||
| from pathlib import Path | ||
| import unittest | ||
| from unittest import mock | ||
|
|
||
|
|
||
| MODULE_PATH = ( | ||
| Path(__file__).resolve().parents[1] | ||
| / "scripts" | ||
| / "report-writing" | ||
| / "Professional_Emails.py" | ||
| ) | ||
| SPEC = importlib.util.spec_from_file_location("professional_emails", MODULE_PATH) | ||
| if SPEC is None or SPEC.loader is None: | ||
| raise RuntimeError(f"Unable to load {MODULE_PATH}") | ||
| professional_emails = importlib.util.module_from_spec(SPEC) | ||
| SPEC.loader.exec_module(professional_emails) | ||
|
|
||
|
|
||
| class FixedDatetime(datetime.datetime): | ||
| @classmethod | ||
| def now(cls, tz=None): | ||
| return cls(2026, 7, 20, tzinfo=tz) | ||
|
|
||
|
|
||
| class GenerateEmailDraftTests(unittest.TestCase): | ||
| def test_generates_expected_professional_fields(self): | ||
| with mock.patch.object( | ||
| professional_emails.datetime, | ||
| "datetime", | ||
| FixedDatetime, | ||
| ): | ||
| draft = professional_emails.generate_email_draft( | ||
| "Alex Rivera", | ||
| "alex@example.com", | ||
| "Protective operations update", | ||
| "The advance is complete.", | ||
| ) | ||
|
|
||
| self.assertIn("Date: 2026-07-20", draft) | ||
| self.assertIn("To: Alex Rivera <alex@example.com>", draft) | ||
| self.assertIn("Subject: Protective operations update", draft) | ||
| self.assertIn("Dear Alex Rivera,", draft) | ||
| self.assertIn("The advance is complete.", draft) | ||
| self.assertIn("FortiPath Security Team", draft) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.