Skip to content

Commit

Permalink
ci: Frontend publishing (#731)
Browse files Browse the repository at this point in the history
* Update Earthfile

* Update Earthfile

* ci: update frontend configs

* Update Earthfile

* Update Earthfile

* Update Earthfile

* Update Earthfile

* Update Earthfile

* Update Earthfile

* feat: add RUN_ON_PR flag
  • Loading branch information
minikin authored Aug 30, 2024
1 parent 5565166 commit 1fb17b2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 33 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build-flutter-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
earthfile: ./catalyst_voices/
flags: --allow-privileged
targets: build-web
target_flags: --SECRETS_ARE_AVAILABLE=true, --SENTRY_DSN=${{ secrets.SENTRY_DSN }}
target_flags: --RUN_ON_PR=false --SENTRY_DSN=${{ secrets.SENTRY_DSN }}
runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }}
artifact: "true"

Expand All @@ -54,7 +54,6 @@ jobs:
earthfile: ./catalyst_voices/
flags: --allow-privileged
targets: package
target_flags: --SECRETS_ARE_AVAILABLE=true
runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }}
artifact: "true"

Expand All @@ -66,6 +65,5 @@ jobs:
earthfile: ./catalyst_voices/
flags: --allow-privileged
targets: publish
target_flags: --SECRETS_ARE_AVAILABLE=true
runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }}
artifact: "true"
45 changes: 16 additions & 29 deletions catalyst_voices/Earthfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
VERSION 0.8

IMPORT ../catalyst-gateway AS catalyst-gateway
IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.1.25 AS flutter-ci
IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.1.26 AS flutter-ci

# Copy all the necessary files and running bootstrap
builder:
Expand Down Expand Up @@ -52,14 +52,6 @@ check-package-publishing:
FROM +builder
DO flutter-ci+PUBLISH_DRY_RUN

# Build web version of Catalyst Voices without arguments.
# This is used for development purposes to validate build on PRs.
build-web-on-pr:
FROM +builder

ARG WORKDIR=/frontend/catalyst_voices
DO flutter-ci+BUILD_WEB --TARGET=lib/configs/main_web.dart --WORKDIR=$WORKDIR

# Run unit tests
test-unit:
FROM +builder
Expand All @@ -68,34 +60,29 @@ test-unit:
# Build web version of Catalyst Voices
build-web:
FROM +builder
ARG RUN_ON_PR=true
ARG SENTRY_DSN

ARG WORKDIR=/frontend/catalyst_voices
DO flutter-ci+BUILD_WEB --TARGET=lib/configs/main_web.dart --dart-define SENTRY_DSN=$SENTRY_DSN --WORKDIR=$WORKDIR
SAVE ARTIFACT web
IF [ $RUN_ON_PR = true ]
DO flutter-ci+BUILD_WEB --WORKDIR=$WORKDIR --BUILD_MODE='--profile' --TARGET=lib/configs/main_web.dart
ELSE
DO flutter-ci+BUILD_WEB --WORKDIR=$WORKDIR --TARGET=lib/configs/main_web.dart --SENTRY_DSN=$SENTRY_DSN
SAVE ARTIFACT web
END

package:
FROM nginx:alpine3.18
ARG SECRETS_ARE_AVAILABLE=false
ARG tag='latest'

IF [$SECRETS_ARE_AVAILABLE]
COPY +build-web/web /app
COPY ./nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
COPY +build-web/web /app
COPY ./nginx.conf /etc/nginx/nginx.conf
EXPOSE 80

SAVE IMAGE voices-frontend:$tag
ELSE
RUN echo "No secrets are available in Earthly yet."
END
SAVE IMAGE voices-frontend:$tag

#publish:
# FROM +package
# ARG SECRETS_ARE_AVAILABLE=false
# ARG tag='latest'
publish:
FROM +package
ARG tag='latest'

# IF [$SECRETS_ARE_AVAILABLE]
# SAVE IMAGE voices-frontend:$tag
# ELSE
# RUN echo "No secrets are available in Earthly yet."
# END
SAVE IMAGE voices-frontend:$tag
2 changes: 1 addition & 1 deletion catalyst_voices/uikit_example/Earthfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
VERSION 0.8

IMPORT ../ AS catalyst-voices
IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.1.25 AS flutter-ci
IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.1.26 AS flutter-ci

# local-build-web - build web version of UIKit example.
# Prefixed by "local" to make sure it's not auto triggered, the target was
Expand Down

0 comments on commit 1fb17b2

Please sign in to comment.