File tree Expand file tree Collapse file tree 2 files changed +59
-9
lines changed
Expand file tree Collapse file tree 2 files changed +59
-9
lines changed Original file line number Diff line number Diff line change 1+ name : " CodeQL"
2+
3+ on :
4+ push :
5+ branches : ["main"]
6+ pull_request :
7+ branches : ["main"]
8+ schedule :
9+ - cron : " 0 6 * * 1" # Run every Monday at 6 AM UTC
10+
11+ jobs :
12+ analyze :
13+ name : Analyze
14+ runs-on : ubuntu-latest
15+ timeout-minutes : 360
16+ permissions :
17+ actions : read
18+ contents : read
19+ security-events : write
20+
21+ strategy :
22+ fail-fast : false
23+ matrix :
24+ language : ["go"]
25+
26+ steps :
27+ - name : Checkout repository
28+ uses : actions/checkout@v4
29+
30+ - name : Set up Go
31+ uses : actions/setup-go@v5
32+ with :
33+ go-version-file : go.mod
34+ cache : true
35+
36+ - name : Initialize CodeQL
37+ uses : github/codeql-action/init@v3
38+ with :
39+ languages : ${{ matrix.language }}
40+
41+ - name : Autobuild
42+ uses : github/codeql-action/autobuild@v3
43+
44+ - name : Perform CodeQL Analysis
45+ uses : github/codeql-action/analyze@v3
46+ with :
47+ category : " /language:${{matrix.language}}"
Original file line number Diff line number Diff line change @@ -5,9 +5,10 @@ FROM node:24 AS web
55
66WORKDIR /app
77
8- COPY package.json ./
8+ # Copy package files first for better caching
9+ COPY package.json package-lock.json* ./
910
10- RUN npm i
11+ RUN npm ci --prefer-offline || npm i
1112
1213# Copy full web assets for tailwind to parse templ files
1314COPY ./app/web ./app/web
@@ -30,22 +31,24 @@ FROM golang:1.25-trixie AS builder
3031
3132# Setup workig dir
3233WORKDIR /app
33- # Get dependencies - will also be cached if we won't change mod/sum
34- COPY go.mod .
35- COPY go.sum .
34+
35+ # Get dependencies first - cached if go.mod/go.sum unchanged
36+ COPY go.mod go. sum ./
3637
3738ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
3839RUN go install tool
3940RUN go mod download
4041
41- # COPY the source code
42- COPY . .
42+ # Copy templ files first for templ generate caching
43+ COPY ./app/web ./app/web
4344COPY --from=web /app/dist ./app/web/public/assets
4445
45-
46- # Generate the template code
46+ # Generate the template code (cached if templ files unchanged)
4747RUN go tool templ generate
4848
49+ # Copy remaining source code
50+ COPY . .
51+
4952RUN --mount=type=cache,target=/root/.cache/go-build \
5053 --mount=type=cache,target=/go/pkg \
5154 LDFLAGS="-X github.com/cloudness-io/cloudness/version.GitCommit=${GIT_COMMIT} -X github.com/cloudness-io/cloudness/version.major=${CLOUDNESS_VERSION_MAJOR} -X github.com/cloudness-io/cloudness/version.minor=${CLOUDNESS_VERSION_MINOR} -X github.com/cloudness-io/cloudness/version.patch=${CLOUDNESS_VERSION_PATCH} -extldflags '-static'" && \
You can’t perform that action at this time.
0 commit comments