-
Notifications
You must be signed in to change notification settings - Fork 22
Fix ci and benchmarks #581
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
Changes from all commits
803389a
e558f02
4bf84fc
f60a626
6dce89c
cbd9b1b
9f83b3a
bcb7951
0341d85
dba5022
2416fd5
d927346
1c7bb5c
dc3fb80
2636ec7
fda5df9
cd7e50c
11b4f64
574ea0d
e17fa99
fa266ca
c5da522
225db76
169afc5
e6946ce
3559c81
147b681
98f6431
bdc2092
f637be8
e4e4654
e74851d
514846a
b754bca
dd8622e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: Cache Cleanup | ||
| on: | ||
| workflow_dispatch: # Manual trigger | ||
| schedule: | ||
| - cron: '0 0 * * 0' # Run weekly on Sunday at midnight | ||
|
|
||
| jobs: | ||
| cleanup: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Cleanup | ||
| run: | | ||
| # Get all cache keys | ||
| CACHE_KEYS=$(gh cache list -L 1000 | awk '{print $1}') | ||
|
|
||
| # Calculate total size | ||
| TOTAL_SIZE=$(gh cache list -L 1000 | awk '{sum += $2} END {print sum}') | ||
|
|
||
| # If total size > 8GB (keeping buffer from 10GB limit) | ||
| if [ "$TOTAL_SIZE" -gt 8000000000 ]; then | ||
| # Delete older caches until we're under 8GB | ||
| echo "$CACHE_KEYS" | while read key; do | ||
| gh cache delete "$key" -f | ||
| TOTAL_SIZE=$(gh cache list -L 1000 | awk '{sum += $2} END {print sum}') | ||
| if [ "$TOTAL_SIZE" -lt 8000000000 ]; then | ||
| break | ||
| fi | ||
| done | ||
| fi | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: Documentation Generation | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| docgen: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: 'go.mod' | ||
| - name: Initialize database for doc generation | ||
| run: | | ||
| cd singularity | ||
| ./singularity admin init | ||
| - name: Generate documentation | ||
| run: | | ||
| cd singularity | ||
| sh docgen.sh | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This docs are generated, but not stored anywhere. I don't think this is needed |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,9 @@ name: Go Checks | |
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main, develop] | ||
| push: | ||
| branches: ["main"] | ||
| branches: [main, develop] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
|
|
@@ -14,19 +15,88 @@ concurrency: | |
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| go-check: | ||
| uses: ipdxco/unified-github-workflows/.github/workflows/[email protected] | ||
| go-check-all: | ||
| name: go-check / All | ||
| runs-on: ubuntu-latest | ||
| services: | ||
| mysql: | ||
| image: mysql:8.0 | ||
| env: | ||
| MYSQL_ROOT_PASSWORD: root | ||
| MYSQL_DATABASE: singularity | ||
| MYSQL_USER: singularity | ||
| MYSQL_PASSWORD: singularity | ||
| ports: | ||
| - 3306:3306 | ||
| options: >- | ||
| --health-cmd="mysqladmin ping" | ||
| --health-interval=10s | ||
| --health-timeout=5s | ||
| --health-retries=3 | ||
|
|
||
| postgres: | ||
| image: postgres:15 | ||
| env: | ||
| POSTGRES_USER: singularity | ||
| POSTGRES_PASSWORD: singularity | ||
| POSTGRES_DB: singularity | ||
| ports: | ||
| - 5432:5432 | ||
| options: >- | ||
| --health-cmd pg_isready | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v4 | ||
| with: | ||
| go-version: "1.21.x" | ||
|
|
||
| - name: Wait for PostgreSQL | ||
| run: | | ||
| echo "Waiting for PostgreSQL..." | ||
| for i in {1..10}; do | ||
| if PGPASSWORD=singularity psql -h localhost -U singularity -d singularity -c "SELECT 1" > /dev/null 2>&1; then | ||
| echo "Postgres is ready!" | ||
| break | ||
| fi | ||
| sleep 3 | ||
| done | ||
|
|
||
| - name: Verify MySQL connection | ||
| run: mysql -h127.0.0.1 -P3306 -usingularity -psingularity -e "SELECT VERSION();" | ||
|
|
||
| - name: Verify PostgreSQL connection | ||
| run: PGPASSWORD=singularity psql -h localhost -U singularity -d singularity -c "SELECT version();" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you create a MySQL connection and a PSQL connection? Singularity seems to support both, so I could understand wanting to test with both, but I don't see you passing a connection string to Singularity anywhere so I think this test is still using sqllite. Have I missed where you configure the database you set up for testing? https://data-programs.gitbook.io/singularity/installation/deploy-to-production |
||
|
|
||
| - name: Ensure swagger directories exist | ||
| run: mkdir -p client/swagger/client | ||
|
|
||
| - name: Install swagger tools | ||
| run: go install github.com/go-swagger/go-swagger/cmd/[email protected] | ||
|
|
||
| - name: Generate code | ||
| run: go generate ./client/swagger/... | ||
|
|
||
| - name: Build | ||
| run: go build ./... | ||
|
|
||
| - name: Run tests | ||
| run: go test -v ./... | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are you running go test inside go check? |
||
|
|
||
| staticcheck: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v4 | ||
| with: | ||
| go-version: "1.21" | ||
| go-version: "1.21.x" | ||
|
|
||
| - name: Install staticcheck | ||
| run: go install honnef.co/go/tools/cmd/staticcheck@latest | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,9 @@ name: Go Test | |
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main, develop] | ||
| push: | ||
| branches: ["main"] | ||
| branches: [main, develop] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
|
|
@@ -14,5 +15,50 @@ concurrency: | |
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| go-test: | ||
| uses: ipdxco/unified-github-workflows/.github/workflows/[email protected] | ||
| go-test-this: | ||
| name: go-test / ${{ matrix.os }} (go this) | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: Start MongoDB | ||
| if: runner.os == 'Linux' | ||
| uses: supercharge/[email protected] | ||
| with: | ||
| mongodb-version: '6.0' | ||
| mongodb-port: 27018 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v4 | ||
| with: | ||
| go-version: '1.21' | ||
|
|
||
| - name: Run Go Tests | ||
| run: go test ./... | ||
|
|
||
| go-test-next: | ||
| name: go-test / ${{ matrix.os }} (go next) | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: Start MongoDB | ||
| if: runner.os == 'Linux' | ||
| uses: supercharge/[email protected] | ||
| with: | ||
| mongodb-version: '6.0' | ||
| mongodb-port: 27018 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v4 | ||
| with: | ||
| go-version: '1.21' | ||
|
|
||
| - name: Run Go Tests | ||
| run: go test ./... | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This workflow for testing is substantially different from the IPDX workflow: https://github.com/ipdxco/unified-github-workflows/blob/main/.github/workflows/go-test.yml Without using an AI summary, can you please explain why you made these changes and what the effect on testing will be? The IPDX workflow seems much more robust
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, why is there both a go-test-next job and a go-test-this job? They seem to be exactly the same except for the name? |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,10 @@ import ( | |
|
|
||
| const flushInterval = time.Hour | ||
|
|
||
| var Enabled = true | ||
| var ( | ||
| mu sync.RWMutex | ||
| Enabled = true | ||
| ) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What problem does switching this to a mutex fix? |
||
|
|
||
| var logger = log.Logger("analytics") | ||
|
|
||
|
|
@@ -37,6 +40,8 @@ var logger = log.Logger("analytics") | |
| // Returns: | ||
| // - An error if there are issues fetching the instance id from the database or if the database appears empty. | ||
| func Init(ctx context.Context, db *gorm.DB) error { | ||
| mu.Lock() | ||
| defer mu.Unlock() | ||
| if Instance != "" { | ||
| return nil | ||
| } | ||
|
|
@@ -68,6 +73,27 @@ var ( | |
| Identity string | ||
| ) | ||
|
|
||
| // GetInstance safely returns the Instance value | ||
| func GetInstance() string { | ||
| mu.RLock() | ||
| defer mu.RUnlock() | ||
| return Instance | ||
| } | ||
|
|
||
| // GetIdentity safely returns the Identity value | ||
| func GetIdentity() string { | ||
| mu.RLock() | ||
| defer mu.RUnlock() | ||
| return Identity | ||
| } | ||
|
|
||
| // IsEnabled safely returns the Enabled value | ||
| func IsEnabled() bool { | ||
| mu.RLock() | ||
| defer mu.RUnlock() | ||
| return Enabled | ||
| } | ||
|
|
||
| type Collector struct { | ||
| mu sync.Mutex | ||
| packJobEvents []PackJobEvent | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cache doesn't start empty with a fresh container?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, why isn't this needed on the go-check-setup action?