From 37e39c8f9ce3af2fe8015a26337fd454dbf41242 Mon Sep 17 00:00:00 2001 From: Olli-Pekka Lehtokallio Date: Thu, 14 Dec 2023 11:26:02 +0200 Subject: [PATCH] build ui --- .github/workflows/build.yml | 179 ++++++++++++++++++------------------ 1 file changed, 91 insertions(+), 88 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9f14e87c4..4e1af7c6c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,62 +7,13 @@ env: ARTIFACT_NAME: eperusteet jobs: - build-and-test-eperusteet-service: + build-and-test-eperusteet-ui: runs-on: ubuntu-latest + env: + EPERUSTEET_SPECFILE: https://raw.githubusercontent.com/Opetushallitus/eperusteet/${{ github.ref_name }}/generated/eperusteet.spec.json steps: - # - uses: actions/checkout@v3 - - # - name: workflow number debug - # run: echo "${{ github.run_id }} ${{ github.run_number }} ${{ github.run_attempt }}" - - # - name: Set up JDK 11 - # uses: actions/setup-java@v3 - # with: - # java-version: '11' - # distribution: 'corretto' - - # - name: Cache Maven repository - # uses: actions/cache@v3 - # with: - # path: ~/.m2/repository - # key: ${{ runner.os }}-maven-cache-${{ hashFiles('**/pom.xml') }} - # restore-keys: | - # ${{ runner.os }}-maven- - - # - name: Build with Maven - # run: | - # cd eperusteet/eperusteet-service - # mvn clean verify --batch-mode - - # - name: Cache eperusteet-service build results - # uses: actions/cache@v3 - # id: restore-service-build - # with: - # path: eperusteet/eperusteet-service/target - # key: ${{ github.run_number }}-${{ github.run_attempt }}-service - name: Checkout source uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'adopt' - cache: 'maven' - - name: Build - run: | - cd eperusteet/eperusteet-service - mvn clean verify -B -DskipTests - - name: Upload eperusteet-service-jar - uses: actions/upload-artifact@v3 - with: - name: eperusteet-service-jar - path: eperusteet/eperusteet-service/target/eperusteet-service.jar - # build-and-test-eperusteet-ui: - # runs-on: ubuntu-latest - # env: - # EPERUSTEET_SPECFILE: https://raw.githubusercontent.com/Opetushallitus/eperusteet/${{ github.ref_name }}/generated/eperusteet.spec.json - # steps: - # - uses: actions/checkout@v3 # - name: Set up JDK 11 # uses: actions/setup-java@v3 @@ -70,10 +21,10 @@ jobs: # java-version: '11' # distribution: 'corretto' - # - name: Set up Node 10 - # uses: actions/setup-node@v3 - # with: - # node-version: '10' + - name: Set up Node 10 + uses: actions/setup-node@v3 + with: + node-version: '10' # - name: Cache Maven repository # uses: actions/cache@v3 @@ -117,45 +68,97 @@ jobs: # restore-keys: | # ${{ runner.os }}-nodeyo- - # - name: Check if UI has same branch - # id: ui_branch_status - # run: | - # if [ "$(curl -s -o /dev/null -I -w '%{http_code}' https://github.com/Opetushallitus/eperusteet-ui/tree/${{ github.ref_name }})" == "200" ] - # then - # echo branch found - # echo "EPERUSTEET_UI_GIT_BRANCH=-b ${{ github.ref_name }}" >> $GITHUB_ENV - # else - # echo "EPERUSTEET_UI_GIT_BRANCH=" >> $GITHUB_ENV - # echo branch not found - # fi + - name: Check if UI has same branch + id: ui_branch_status + run: | + if [ "$(curl -s -o /dev/null -I -w '%{http_code}' https://github.com/Opetushallitus/eperusteet-ui/tree/${{ github.ref_name }})" == "200" ] + then + echo branch found + echo "EPERUSTEET_UI_GIT_BRANCH=-b ${{ github.ref_name }}" >> $GITHUB_ENV + else + echo "EPERUSTEET_UI_GIT_BRANCH=" >> $GITHUB_ENV + echo branch not found + fi + + - name: Build with Maven + run: | + git clone ${{ env.EPERUSTEET_UI_GIT_BRANCH }} --recurse-submodules --depth 1 https://github.com/Opetushallitus/eperusteet-ui.git + export EPERUSTEET_SERVICE_DIR=${{ github.workspace }}/eperusteet/eperusteet-service + + cd eperusteet-ui + yarn install --silent + cd eperusteet-frontend-utils/vue + yarn install --silent + yarn gen:api:eperusteet + rm -rf node_modules + cd ../.. + echo "----------eperusteet-ui:n viimeisimman commitin sha----------" + git rev-parse HEAD + yarn run build + - name: Upload eperusteet-ui + uses: actions/upload-artifact@v3 + with: + name: eperusteet-ui + path: eperusteet-ui/dist + build-and-test-eperusteet-service: + needs: [build-and-test-eperusteet-ui] + runs-on: ubuntu-latest + steps: + # - uses: actions/checkout@v3 + + # - name: workflow number debug + # run: echo "${{ github.run_id }} ${{ github.run_number }} ${{ github.run_attempt }}" + + # - name: Set up JDK 11 + # uses: actions/setup-java@v3 + # with: + # java-version: '11' + # distribution: 'corretto' + + # - name: Cache Maven repository + # uses: actions/cache@v3 + # with: + # path: ~/.m2/repository + # key: ${{ runner.os }}-maven-cache-${{ hashFiles('**/pom.xml') }} + # restore-keys: | + # ${{ runner.os }}-maven- # - name: Build with Maven # run: | - # git clone ${{ env.EPERUSTEET_UI_GIT_BRANCH }} --recurse-submodules --depth 1 https://github.com/Opetushallitus/eperusteet-ui.git - # export EPERUSTEET_SERVICE_DIR=${{ github.workspace }}/eperusteet/eperusteet-service - - # cd eperusteet-ui - # yarn install --silent - # cd eperusteet-frontend-utils/vue - # yarn install --silent - # yarn gen:api:eperusteet - # rm -rf node_modules - # cd ../.. - # echo "----------eperusteet-ui:n viimeisimman commitin sha----------" - # git rev-parse HEAD - # yarn run build - # cp -R dist/ ../eperusteet/eperusteet-app/dist - # cd .. - # cd ${ARTIFACT_NAME}/eperusteet-app + # cd eperusteet/eperusteet-service # mvn clean verify --batch-mode - # - name: Cache eperusteet-app build results + # - name: Cache eperusteet-service build results # uses: actions/cache@v3 - # id: restore-app-build + # id: restore-service-build # with: - # path: eperusteet/eperusteet-app/target - # key: ${{ github.run_number }}-${{ github.run_attempt }}-app - + # path: eperusteet/eperusteet-service/target + # key: ${{ github.run_number }}-${{ github.run_attempt }}-service + - name: Checkout source + uses: actions/checkout@v3 + - name: Download eperusteet-ui + uses: actions/download-artifact@v3 + with: + name: eperusteet-ui + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + cache: 'maven' + - name: Build + run: | + cp -R dist/ eperusteet/eperusteet-service/src/resources/static/ui + cd eperusteet/eperusteet-service/src/resources/static/ui + ls -latr + cd ../../../../../.. + cd eperusteet/eperusteet-service + mvn clean verify -B -DskipTests + - name: Upload eperusteet-service-jar + uses: actions/upload-artifact@v3 + with: + name: eperusteet-service-jar + path: eperusteet/eperusteet-service/target/eperusteet-service.jar build-image: needs: [build-and-test-eperusteet-service] runs-on: ubuntu-latest