diff --git a/.github/workflows/build_app.yaml b/.github/workflows/build_app.yaml new file mode 100644 index 00000000..7ae3a40e --- /dev/null +++ b/.github/workflows/build_app.yaml @@ -0,0 +1,37 @@ +name: Build app +on: + push: + branches: + - gha +jobs: + build_app: + name: Build app + runs-on: ubuntu-22.04 + # container: + # image: harbor.portal.kalisio.com/kalisio/ci-kdk:latest + # # Run using Github Actions specific user in our container + # options: --user 1001 + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + submodules: true + # - name: Cache requirements + # uses: actions/cache@v4 + # with: + # key: requirements + # path: ${{ runner.temp }}/dl + # - name: Get yarn cache directory path + # id: yarn-cache-dir-path + # run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT + # - uses: actions/cache@v4 + # with: + # path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + # key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + - name: Init runner + run: bash ./scripts/init_runner.sh ${{ github.job }} + - name: Run tests + env: + SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }} + GITHUB_DEVELOPMENT_PAT: ${{ secrets.GH_DEVELOPMENT_PAT }} + run: bash ./scripts/build_app.sh diff --git a/scripts/build_app.sh b/scripts/build_app.sh index 93563adf..e09dffa9 100755 --- a/scripts/build_app.sh +++ b/scripts/build_app.sh @@ -7,3 +7,42 @@ THIS_PATH=$(dirname "$THIS_FILE") ROOT_PATH=$(dirname "$THIS_PATH") . "$THIS_PATH/kash/kash.sh" + +if [ "$CI" = true ]; then + begin_group "Fetching project dependencies ..." + + WORKSPACE_DIR="$(dirname "$ROOT_PATH")" + DEVELOPMENT_REPO_DIR="$WORKSPACE_DIR/development" + + # Workaround since repo is kApp with a 'A' and in kli file it's kapp with a 'a' + ln -s "$WORKSPACE_DIR/kApp" "$WORKSPACE_DIR/kapp" + + # clone developement + git clone --depth 1 "https://$GITHUB_DEVELOPMENT_PAT@github.com/kalisio/development.git" "$DEVELOPMENT_REPO_DIR" + + get_app_infos "$ROOT_PATH" "$DEVELOPMENT_REPO_DIR/workspaces/apps" + APP="${APP_INFOS[0]}" + VERSION="${APP_INFOS[1]}" + FLAVOR="${APP_INFOS[2]}" + KLI_FILE="${APP_INFOS[3]}" + + run_kli "$WORKSPACE_DIR" "$KLI_FILE" 16 + + end_group "Fetching project dependencies ..." + + echo "Used kli file $KLI_FILE ..." + echo "About to build app ${APP}@${VERSION} ($FLAVOR) ..." +else + DEVELOPMENT_REPO_DIR="$KALISIO_DEVELOPMENT_DIR/development" +fi + +## Load project env +## + +. "$DEVELOPMENT_REPO_DIR/workspaces/apps/apps.sh" kapp + +## Build app +## + +use_node 16 +yarn pwa:build