Skip to content
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

feat(actions): adding build action #7

Merged
merged 7 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "Docker Images"

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]

env:
AWS_REGION: eu-west-1

jobs:
build-image:
name: Build, Tag and Upload
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Create dist directory
run: mkdir dist

- name: Compute labels
run: |
TAG_HASH="$(echo $GITHUB_SHA | head -c 8)"
TAG_NAME="$(echo $GITHUB_REF | sed -E -e 's:refs/pull/([0-9]+)/merge:pr.\1:' -e 's:refs/heads/::' -e 's:tag/v?([.0-9]+):v\1:' -e 's:/:.:')"
SUPERSET_REPOSITORY_URI="289222877357.dkr.ecr.eu-west-1.amazonaws.com/webgains/superset"
echo "TAG_HASH=$TAG_HASH" >> $GITHUB_ENV
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "SUPERSET_REPOSITORY_URI=$SUPERSET_REPOSITORY_URI" >> $GITHUB_ENV
if [ $TAG_NAME = "main" ]; then echo "LATEST_TAG=$SUPERSET_REPOSITORY_URI:latest" >> $GITHUB_ENV; fi

- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/[email protected]

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: |
${{ env.SUPERSET_REPOSITORY_URI }}:${{ env.TAG_HASH }}
${{ env.SUPERSET_REPOSITORY_URI }}:${{ env.TAG_NAME }}
${{ env.LATEST_TAG }}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ RUN --mount=type=bind,target=./package.json,src=./superset-frontend/package.json

# Runs the webpack build process
COPY superset-frontend /app/superset-frontend
RUN npm run ${BUILD_CMD}

# This copies the .po files needed for translation
RUN mkdir -p /app/superset/translations
Expand All @@ -57,6 +56,8 @@ RUN npm run build-translation
RUN rm /app/superset/translations/*/LC_MESSAGES/*.po
RUN rm /app/superset/translations/messages.pot

RUN npm run ${BUILD_CMD}

######################################################################
# Final lean image...
######################################################################
Expand Down
6 changes: 3 additions & 3 deletions superset-frontend/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ export const URL_PARAMS = {
},
language: {
name: 'lang',
type: 'string'
type: 'string',
},
currency: {
name: 'currency',
type: 'string'
}
type: 'string',
},
} as const;

export const RESERVED_CHART_URL_PARAMS: string[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,12 @@ const DashboardBuilder: FC<DashboardBuilderProps> = () => {

const fireResizeEventToParent = () => {
const data = {
event: "supersetContentRefreshed",
width: window.document.body.scrollWidth,
height: window.document.body.scrollHeight,
}
window.parent.postMessage(data, "*");
}
event: 'supersetContentRefreshed',
width: window.document.body.scrollWidth,
height: window.document.body.scrollHeight,
};
window.parent.postMessage(data, '*');
};

useEffect(() => {
setBarTopOffset(headerRef.current?.getBoundingClientRect()?.height || 0);
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ const config = {
},
},
output,
stats: 'minimal',
stats: 'none',
/*
Silence warning for missing export in @data-ui's internal structure. This
issue arises from an internal implementation detail of @data-ui. As it's
Expand Down
Loading