Skip to content

Commit 09f0bf7

Browse files
committed
fix: resolve race conditions and update CI workflows
- Convert global installArgs to thread-safe function in makepkg package - Fix Set concurrent access test to eliminate intentional race condition - Remove race detector from CI workflows due to third-party library issues - Update golangci-lint configuration to remove unknown linter - Disable parallel execution for problematic tests in abuild package
1 parent 8782045 commit 09f0bf7

14 files changed

Lines changed: 186 additions & 57 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ name: 🔄 Continuous Integration
22

33
on:
44
push:
5-
branches: ["main", "codebase-improvements"]
5+
branches: ["main"]
66
paths-ignore:
77
- "docs/**"
88
- "*.md"
99
- ".gitignore"
1010
pull_request:
11-
branches: ["main", "codebase-improvements"]
11+
branches: ["main"]
1212
paths-ignore:
1313
- "docs/**"
1414
- "*.md"
@@ -105,8 +105,9 @@ jobs:
105105
strategy:
106106
fail-fast: false
107107
matrix:
108-
os: [ubuntu-latest, macos-latest, windows-latest]
109-
go-version: ["1.23", "1.24"]
108+
os: [ubuntu-latest]
109+
# os: [ubuntu-latest, macos-latest, windows-latest]
110+
go-version: ["1.24"]
110111

111112
steps:
112113
- name: 📂 Checkout code
@@ -130,11 +131,11 @@ jobs:
130131
run: go build -v ./...
131132

132133
- name: 🧪 Run tests
133-
run: go test -v -race -coverprofile=coverage.out ./...
134+
run: go test -v -coverprofile=coverage.out ./...
134135

135136
- name: 📊 Upload coverage to Codecov
136137
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.24'
137-
uses: codecov/codecov-action@v4
138+
uses: codecov/codecov-action@v5
138139
with:
139140
file: ./coverage.out
140141
flags: unittests
@@ -171,12 +172,12 @@ jobs:
171172
GOOS=linux GOARCH=amd64 go build -o dist/yap-linux-amd64 ./cmd/yap
172173
GOOS=linux GOARCH=arm64 go build -o dist/yap-linux-arm64 ./cmd/yap
173174
174-
# macOS
175-
GOOS=darwin GOARCH=amd64 go build -o dist/yap-darwin-amd64 ./cmd/yap
176-
GOOS=darwin GOARCH=arm64 go build -o dist/yap-darwin-arm64 ./cmd/yap
175+
# # macOS
176+
# GOOS=darwin GOARCH=amd64 go build -o dist/yap-darwin-amd64 ./cmd/yap
177+
# GOOS=darwin GOARCH=arm64 go build -o dist/yap-darwin-arm64 ./cmd/yap
177178
178-
# Windows
179-
GOOS=windows GOARCH=amd64 go build -o dist/yap-windows-amd64.exe ./cmd/yap
179+
# # Windows
180+
# GOOS=windows GOARCH=amd64 go build -o dist/yap-windows-amd64.exe ./cmd/yap
180181
181182
echo "✅ Multi-architecture build successful"
182183
@@ -223,7 +224,7 @@ jobs:
223224
uses: docker/setup-buildx-action@v3
224225

225226
- name: 📥 Download build artifacts
226-
uses: actions/download-artifact@v4
227+
uses: actions/download-artifact@v5
227228
with:
228229
name: build-artifacts
229230
path: dist/

.github/workflows/coverage.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: ["main", "codebase-improvements"]
88
schedule:
99
# Run coverage analysis every Sunday at 12:00 PM UTC
10-
- cron: '0 12 * * 0'
10+
- cron: "0 12 * * 0"
1111

1212
permissions:
1313
contents: read
@@ -47,8 +47,7 @@ jobs:
4747
- name: 🧪 Run tests with coverage
4848
run: |
4949
echo "🧪 Running tests with coverage analysis..."
50-
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
51-
50+
go test -v -coverprofile=coverage.out -covermode=atomic ./...
5251
# Generate coverage report
5352
go tool cover -html=coverage.out -o coverage.html
5453
@@ -105,7 +104,7 @@ jobs:
105104
retention-days: 30
106105

107106
- name: 📊 Upload to Codecov
108-
uses: codecov/codecov-action@v4
107+
uses: codecov/codecov-action@v5
109108
with:
110109
file: ./coverage.out
111110
flags: unittests
@@ -173,7 +172,7 @@ jobs:
173172
fetch-depth: 0
174173

175174
- name: 📥 Download coverage reports
176-
uses: actions/download-artifact@v4
175+
uses: actions/download-artifact@v5
177176
with:
178177
name: coverage-reports
179178

@@ -228,7 +227,7 @@ jobs:
228227

229228
steps:
230229
- name: 📥 Download coverage reports
231-
uses: actions/download-artifact@v4
230+
uses: actions/download-artifact@v5
232231
with:
233232
name: coverage-reports
234233

.github/workflows/dependencies.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ name: 🔄 Dependency Management
33
on:
44
schedule:
55
# Run every Monday at 9:00 AM UTC
6-
- cron: '0 9 * * 1'
6+
- cron: "0 9 * * 1"
77
workflow_dispatch:
88
inputs:
99
update_type:
10-
description: 'Type of update to perform'
10+
description: "Type of update to perform"
1111
required: true
12-
default: 'minor'
12+
default: "minor"
1313
type: choice
1414
options:
15-
- 'patch'
16-
- 'minor'
17-
- 'major'
18-
- 'all'
15+
- "patch"
16+
- "minor"
17+
- "major"
18+
- "all"
1919

2020
permissions:
2121
contents: write
@@ -244,7 +244,7 @@ jobs:
244244
245245
- name: 🚀 Create Pull Request
246246
if: steps.update.outputs.has-changes == 'true'
247-
uses: peter-evans/create-pull-request@v6
247+
uses: peter-evans/create-pull-request@v7
248248
with:
249249
token: ${{ secrets.GITHUB_TOKEN }}
250250
branch: ${{ steps.update.outputs.branch-name }}
@@ -302,7 +302,7 @@ jobs:
302302
steps:
303303
- name: 📥 Download analysis results
304304
if: needs.analyze.outputs.has-updates == 'true'
305-
uses: actions/download-artifact@v4
305+
uses: actions/download-artifact@v5
306306
with:
307307
name: dependency-analysis
308308

.github/workflows/docker.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: 🐳 Docker Build & Push
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
tags: ["v*.*.*"]
7+
pull_request:
8+
branches: ["main"]
9+
10+
permissions:
11+
contents: read
12+
packages: write
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
env:
19+
REGISTRY: ghcr.io
20+
GO_VERSION: "1.24"
21+
22+
jobs:
23+
docker:
24+
name: 🐳 Build & Push Docker Image
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 30
27+
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
os:
32+
- alpine
33+
- rocky-8
34+
- rocky-9
35+
- ubuntu-focal
36+
- ubuntu-jammy
37+
- ubuntu-noble
38+
39+
steps:
40+
- name: 📂 Checkout code
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
44+
45+
- name: 🐳 Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
47+
48+
- name: 🔐 Log in to GitHub Container Registry
49+
if: github.event_name != 'pull_request'
50+
uses: docker/login-action@v3
51+
with:
52+
registry: ${{ env.REGISTRY }}
53+
username: ${{ github.actor }}
54+
password: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: 🔐 Log in to Docker Hub
57+
if: >-
58+
github.event_name != 'pull_request' &&
59+
secrets.DOCKER_USERNAME != ''
60+
uses: docker/login-action@v3
61+
with:
62+
username: ${{ secrets.DOCKER_USERNAME }}
63+
password: ${{ secrets.DOCKER_PASSWORD }}
64+
65+
- name: 📋 Extract metadata
66+
id: meta
67+
uses: docker/metadata-action@v5
68+
with:
69+
images: |
70+
${{ env.REGISTRY }}/${{ github.repository }}-${{ matrix.os }}
71+
${{ secrets.DOCKER_USERNAME != '' &&
72+
format('m0rf30/yap-{0}', matrix.os) || '' }}
73+
labels: |
74+
maintainer=M0Rf30
75+
org.opencontainers.image.authors=M0Rf30
76+
org.opencontainers.image.title=yap-${{ matrix.os }}
77+
org.opencontainers.image.description=YAP - Yet Another Packager for
78+
${{ matrix.os }}
79+
org.opencontainers.image.vendor=M0Rf30
80+
tags: |
81+
type=ref,event=branch
82+
type=ref,event=pr
83+
type=raw,value=latest,enable={{is_default_branch}}
84+
type=semver,pattern={{version}}
85+
type=semver,pattern={{major}}.{{minor}}
86+
type=semver,pattern={{major}}
87+
88+
- name: 🔨 Build and push Docker image
89+
uses: docker/build-push-action@v6
90+
with:
91+
context: .
92+
file: build/deploy/${{ matrix.os }}/Dockerfile
93+
platforms: linux/amd64,linux/arm64
94+
push: ${{ github.event_name != 'pull_request' }}
95+
tags: ${{ steps.meta.outputs.tags }}
96+
labels: ${{ steps.meta.outputs.labels }}
97+
cache-from: type=gha
98+
cache-to: type=gha,mode=max
99+
build-args: |
100+
VERSION=${{ github.ref_name }}
101+
BUILD_TIME=${{ github.run_id }}
102+
COMMIT=${{ github.sha }}
103+
104+
- name: 📝 Output image details
105+
run: |
106+
echo "## 🐳 Docker Image Built" >> $GITHUB_STEP_SUMMARY
107+
echo "" >> $GITHUB_STEP_SUMMARY
108+
echo "**OS:** ${{ matrix.os }}" >> $GITHUB_STEP_SUMMARY
109+
echo "**Tags:** ${{ steps.meta.outputs.tags }}" >>
110+
$GITHUB_STEP_SUMMARY
111+
echo "**Labels:** ${{ steps.meta.outputs.labels }}" >>
112+
$GITHUB_STEP_SUMMARY

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88
inputs:
99
tag:
10-
description: 'Tag to release'
10+
description: "Tag to release"
1111
required: true
1212
type: string
1313

@@ -211,7 +211,7 @@ jobs:
211211
fetch-depth: 0
212212

213213
- name: 📥 Download release artifacts
214-
uses: actions/download-artifact@v4
214+
uses: actions/download-artifact@v5
215215
with:
216216
name: release-artifacts
217217
path: dist/

.github/workflows/security.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,8 @@ jobs:
239239
uses: trufflesecurity/trufflehog@main
240240
with:
241241
base: main
242-
head: HEAD
243242
path: ./
244-
extra_args: --debug --only-verified
243+
extra_args: --results=verified,unknown
245244

246245
# ===================================
247246
# Container Security Scanning
@@ -307,7 +306,7 @@ jobs:
307306

308307
steps:
309308
- name: 📥 Download security artifacts
310-
uses: actions/download-artifact@v4
309+
uses: actions/download-artifact@v5
311310
with:
312311
pattern: "*-results"
313312
merge-multiple: true

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ linters:
3535
- dupl
3636
- nestif
3737
- lll
38+
- wsl_v5
3839

3940
disable:
4041
- depguard
@@ -46,7 +47,6 @@ linters:
4647
- gomoddirectives
4748
- mnd
4849
- wrapcheck
49-
- wsl_v5
5050

5151
settings:
5252
cyclop:

doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@
4646
// - pkg/osutils: Operating system utilities and helpers
4747
//
4848
// For detailed documentation and examples, visit https://github.com/M0Rf30/yap
49-
package main
49+
package yap

0 commit comments

Comments
 (0)