Skip to content

Commit 74ac748

Browse files
authored
Merge pull request #171 from amazeeio/dev
release: linting, dependabot, & add cache-control middleware
2 parents 9eafd81 + 28fbc76 commit 74ac748

File tree

72 files changed

+455
-201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+455
-201
lines changed

.github/dependabot.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
commit-message:
5+
prefix: chore
6+
include: scope
7+
directory: /
8+
schedule:
9+
interval: monthly
10+
groups:
11+
github-actions:
12+
patterns:
13+
- "*"
14+
update-types:
15+
- "minor"
16+
- "patch"
17+
- package-ecosystem: docker
18+
commit-message:
19+
prefix: chore
20+
include: scope
21+
directory: /
22+
schedule:
23+
interval: monthly
24+
groups:
25+
docker:
26+
patterns:
27+
- "*"
28+
update-types:
29+
- "minor"
30+
- "patch"
31+
- package-ecosystem: pip
32+
commit-message:
33+
prefix: chore
34+
include: scope
35+
directory: /
36+
schedule:
37+
interval: monthly
38+
groups:
39+
pip:
40+
patterns:
41+
- "*"
42+
update-types:
43+
- "minor"
44+
- "patch"
45+
- package-ecosystem: npm
46+
commit-message:
47+
prefix: chore
48+
include: scope
49+
directory: /
50+
schedule:
51+
interval: monthly
52+
groups:
53+
pip:
54+
patterns:
55+
- "*"
56+
update-types:
57+
- "minor"
58+
- "patch"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# https://github.com/cncf/foundation/blob/main/allowed-third-party-license-policy.md
2+
allow-licenses:
3+
- 'Apache-2.0'
4+
- 'BSD-2-Clause'
5+
- 'BSD-2-Clause-FreeBSD'
6+
- 'BSD-3-Clause'
7+
- 'ISC'
8+
- 'MIT'
9+
- 'PostgreSQL'
10+
- 'Python-2.0'
11+
- 'X11'
12+
- 'Zlib'
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: dependency review
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
- dev
7+
merge_group:
8+
types:
9+
- checks_requested
10+
permissions: {}
11+
jobs:
12+
dependency-review:
13+
permissions:
14+
contents: read
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
18+
- uses: actions/dependency-review-action@40c09b7dc99638e5ddb0bfd91c1673effc064d8a # v4.8.1
19+
with:
20+
config-file: .github/dependency-review-config.yaml

.github/workflows/helm-package-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ jobs:
137137
for chart in */; do
138138
chart_name=$(basename "$chart")
139139
echo "Testing chart: $chart_name"
140-
helm template test-$chart_name "$chart_name" > /dev/null
140+
helm template "test-$chart_name" "$chart_name" > /dev/null
141141
echo "✅ $chart_name chart template test passed"
142142
done
143143

.github/workflows/lint.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: lint
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
- dev
7+
merge_group:
8+
types:
9+
- checks_requested
10+
permissions: {}
11+
jobs:
12+
lint-python:
13+
permissions:
14+
contents: read
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
18+
- uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # v3.5.1
19+
lint-actions:
20+
permissions:
21+
contents: read
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25+
- uses: docker://rhysd/actionlint:1.7.0@sha256:601d6faeefa07683a4a79f756f430a1850b34d575d734b1d1324692202bf312e # v1.7.0
26+
with:
27+
args: -color
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: OSSF scorecard
2+
on:
3+
push:
4+
branches:
5+
- main
6+
permissions: {}
7+
jobs:
8+
ossf-scorecard-analysis:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
# Needed if using Code scanning alerts
13+
security-events: write
14+
# Needed for GitHub OIDC token if publish_results is true
15+
id-token: write
16+
steps:
17+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
18+
- name: Run analysis
19+
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
20+
with:
21+
results_file: results.sarif
22+
results_format: sarif
23+
# Publish the results for public repositories to enable scorecard badges. For more details, see
24+
# https://github.com/ossf/scorecard-action#publishing-results.
25+
# For private repositories, `publish_results` will automatically be set to `false`, regardless
26+
# of the value entered here.
27+
publish_results: true
28+
- name: Upload SARIF results to code scanning
29+
uses: github/codeql-action/upload-sarif@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5
30+
with:
31+
sarif_file: results.sarif

.github/workflows/publish.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ name: Publish Docker Images
22

33
on:
44
push:
5-
branches: [ dev ]
5+
branches:
6+
- dev
67

78
env:
89
REGISTRY: ghcr.io
@@ -15,6 +16,9 @@ jobs:
1516
permissions:
1617
contents: read
1718
packages: write
19+
# required by attest-build-provenance
20+
id-token: write
21+
attestations: write
1822

1923
steps:
2024
- name: Checkout repository
@@ -41,6 +45,7 @@ jobs:
4145
type=sha,prefix={{branch}}-
4246
4347
- name: Build and push backend Docker image
48+
id: docker-build-push
4449
uses: docker/build-push-action@v5
4550
with:
4651
context: .
@@ -51,11 +56,21 @@ jobs:
5156
cache-from: type=gha
5257
cache-to: type=gha,mode=max
5358

59+
- name: Attest container image
60+
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
61+
with:
62+
subject-digest: ${{steps.docker-build-push.outputs.digest}}
63+
subject-name: ghcr.io/${{github.repository}}-backend
64+
push-to-registry: true
65+
5466
build-and-push-frontend:
5567
runs-on: ubuntu-latest
5668
permissions:
5769
contents: read
5870
packages: write
71+
# required by attest-build-provenance
72+
id-token: write
73+
attestations: write
5974

6075
steps:
6176
- name: Checkout repository
@@ -82,6 +97,7 @@ jobs:
8297
type=sha,prefix={{branch}}-
8398
8499
- name: Build and push frontend Docker image
100+
id: docker-build-push
85101
uses: docker/build-push-action@v5
86102
with:
87103
context: ./frontend
@@ -90,4 +106,11 @@ jobs:
90106
tags: ${{ steps.meta-frontend.outputs.tags }}
91107
labels: ${{ steps.meta-frontend.outputs.labels }}
92108
cache-from: type=gha
93-
cache-to: type=gha,mode=max
109+
cache-to: type=gha,mode=max
110+
111+
- name: Attest container image
112+
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
113+
with:
114+
subject-digest: ${{steps.docker-build-push.outputs.digest}}
115+
subject-name: ghcr.io/${{github.repository}}-frontend
116+
push-to-registry: true

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,8 @@ migration-downgrade:
116116

117117
migration-stamp:
118118
@read -p "Enter revision to stamp: " revision; \
119-
python3 scripts/manage_migrations.py stamp "$$revision"
119+
python3 scripts/manage_migrations.py stamp "$$revision"
120+
121+
.PHONY: lint
122+
lint:
123+
ruff check

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# amazee.ai
22

3+
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/11464/badge)](https://www.bestpractices.dev/projects/11464)
4+
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/amazeeio/amazee.ai/badge)](https://securityscorecards.dev/viewer/?uri=github.com/amazeeio/amazee.ai)
5+
36
This repository contains the backend and frontend services for the amazee.ai application. The project is built using a modern tech stack including Python FastAPI for the backend, Next.js with TypeScript for the frontend, and PostgreSQL for the database.
47

58

app/api/audit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from fastapi import APIRouter, Depends, Query, HTTPException, status
22
from sqlalchemy.orm import Session
3-
from typing import List, Optional
3+
from typing import Optional
44
from datetime import datetime
5-
from sqlalchemy import distinct, text, cast, String
5+
from sqlalchemy import distinct, cast, String
66
from app.db.database import get_db
77
from app.api.auth import get_current_user_from_auth
88
from app.schemas.models import AuditLogResponse, PaginatedAuditLogResponse, AuditLogMetadata

0 commit comments

Comments
 (0)