Skip to content

Commit

Permalink
feat: Add Earthly targets for code generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
coire1 committed Mar 28, 2024
1 parent 6710bb6 commit 3a02120
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions catalyst_voices/Earthfile
@@ -1,5 +1,8 @@
VERSION --try --global-cache --arg-scope-and-set 0.7

# If running this target with a local ssh agent active, set the environment variable EARTHLY_SSH_AUTH_SOCK=''
# to make the `+deps` target work. Earthly defaults to ssh authentication when it founds an ssh agent active
# but the flutter repo needs to be cloned via https to properly use the `channel` subcommand.
deps:
FROM debian:bookworm-slim
RUN apt-get update
Expand All @@ -24,6 +27,26 @@ src:
FROM +deps
COPY --dir pubspec.yaml lib packages web test test_driver integration_test .

# Code generator based on Catalyst Gateway OpenAPI specs.
code-generator:
FROM +deps
COPY --dir pubspec.yaml lib packages web test test_driver integration_test .
COPY ../catalyst-gateway+build/doc/cat-gateway-api.json /frontend/packages/catalyst_voices_services/openapi/cat-gateway-api.json
WORKDIR /frontend/packages/catalyst_voices_services
RUN flutter pub get
RUN dart run build_runner build --delete-conflicting-outputs
SAVE ARTIFACT lib/generated

code-generator-local:
FROM +code-generator
SAVE ARTIFACT lib/generated/* AS LOCAL ./packages/catalyst_voices_models/lib/generated/

test-code-generator:
FROM +code-generator
COPY packages/catalyst_voices_models/lib/generated /tmp/repo_generated
RUN diff /tmp/repo_generated lib/generated


# Build web version of Catalyst Voices
build:
FROM +src
Expand Down

0 comments on commit 3a02120

Please sign in to comment.