Skip to content

Commit

Permalink
fix: update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
GAlexIHU committed Aug 27, 2024
1 parent 384de92 commit fffb9ff
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 17 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,22 @@ jobs:
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
version: ${{ env.DAGGER_VERSION }}

- name: Export Container Logs
id: export-container-logs
run: docker logs $(docker container list --all --filter 'name=^*-openmeter-*' --format '{{.Names}}') > container.stdout.log 2> container.stderr.log
if: always()
continue-on-error: true

- name: Upload Container logs as artifact
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
if: always() && steps.export-container-logs.outcome == 'success'
with:
name: "[${{ github.job }}] Container logs"
path: |
container.stdout.log
container.stderr.log
retention-days: 14

- name: Cleanup Docker Compose
run: docker compose -f docker-compose.yaml -f docker-compose.ci.yaml down -v
working-directory: quickstart
Expand Down
4 changes: 2 additions & 2 deletions ci/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ func (m *Ci) Etoe(
WithExec([]string{"openmeter-sink-worker", "--config", "/etc/openmeter/config.yaml"}).
AsService()

args := []string{"go", "test", "-count=1", "-v"}
args := []string{"go", "test", "-tags", "musl", "-count=1", "-v"}

if test != "" {
args = append(args, "-run", fmt.Sprintf("Test%s", test))
}

args = append(args, "./e2e/...")

return goModule().
return goModuleCross("").
WithModuleCache(cacheVolume("go-mod-e2e")).
WithBuildCache(cacheVolume("go-build-e2e")).
WithSource(m.Source).
Expand Down
15 changes: 2 additions & 13 deletions ci/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (m *Migrate) Check(

bin := dag.Container(dagger.ContainerOpts{
Platform: "linux/amd64",
}).From("arigaio/atlas:0.26.0").File("atlas")
}).From(atlasImage).File("atlas")

atlas := app.
WithFile("/bin/atlas", bin).
Expand All @@ -41,7 +41,7 @@ func (m *Migrate) Check(
// Always validate schema is generated
p.Go(func(ctx context.Context) error {
result := app.
WithExec([]string{"go", "generate", "-x", "-tags=musl", "-ldflags", "linkmode=external", "./openmeter/ent/..."}).
WithExec([]string{"go", "generate", "-x", "./openmeter/ent/..."}).
Directory("openmeter/ent")

source := m.Source.Directory("openmeter/ent")
Expand Down Expand Up @@ -85,14 +85,3 @@ func (m *Migrate) Check(

return p.Wait()
}

func diff(ctx context.Context, d1, d2 *dagger.Directory) error {
_, err := dag.Container(dagger.ContainerOpts{Platform: ""}).
From(alpineBaseImage).
WithExec([]string{"apk", "add", "--update", "--no-cache", "ca-certificates", "tzdata", "bash"}).
WithDirectory("src", d1).
WithDirectory("res", d2).
WithExec([]string{"diff", "-u", "-r", "src", "res"}).
Sync(ctx)
return err
}
2 changes: 2 additions & 0 deletions ci/versions_pinned.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ const (
xxBaseImage = "tonistiigi/xx:1.5.0@sha256:0c6a569797744e45955f39d4f7538ac344bfb7ebf0a54006a0a4297b153ccf0f"

alpineBaseImage = "alpine:3.20.2@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5"

atlasImage = "arigaio/atlas:0.26.1@sha256:f77152f5458255410d2e59ad80a0fc661524067a90d297a0b62e6bda23437893"
)
4 changes: 2 additions & 2 deletions openmeter/ent/db/runtime/runtime.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions quickstart/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ sink:
minCommitCount: 1
namespaceRefetch: 1s

postgres:
url: postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable
autoMigrate: migration # Runs migrations as part of the service startup, valid values are: ent, migration, false

meters:
# Sample meter to count API requests
- slug: api_requests_total # Unique identifier for the meter
Expand Down
20 changes: 20 additions & 0 deletions quickstart/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ services:
condition: service_healthy
clickhouse:
condition: service_healthy
postgres:
condition: service_healthy
ports:
- 127.0.0.1:8888:8888
volumes:
Expand Down Expand Up @@ -82,3 +84,21 @@ services:
extends:
file: ../docker-compose.yaml
service: redis

postgres:
image: postgres:14.9
ports:
- "5432:5432"
environment:
- POSTGRES_USER=postgres
- POSTGRES_DB=postgres
- POSTGRES_PASSWORD=postgres
command:
- "postgres"
- "-c"
- "wal_level=logical"
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-d", "db_prod"]
interval: 5s
timeout: 60s
retries: 5

0 comments on commit fffb9ff

Please sign in to comment.