Skip to content

readme-fix

readme-fix #2205

Workflow file for this run

name: Eperusteet build
on: [workflow_dispatch, push]
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
ARTIFACT_NAME: eperusteet
jobs:
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:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up Node 16
uses: actions/setup-node@v3
with:
node-version: '16'
- 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
ls -latr
- 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:
- name: Checkout source
uses: actions/checkout@v3
- name: Download eperusteet-ui
uses: actions/download-artifact@v3
with:
name: eperusteet-ui
path: eperusteet/eperusteet-service/src/main/resources/static/ui
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
cache: 'maven'
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd eperusteet/eperusteet-service
mvn clean verify -B
- name: Upload Coverage to Code Climate
if: ${{ github.ref_name == 'master' }}
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
cd eperusteet/eperusteet-service/src/main/java
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
./cc-test-reporter format-coverage -t jacoco --add-prefix src/main/java/ ../../../target/jacoco/jacoco.xml
./cc-test-reporter upload-coverage
- 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
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Download eperusteet-service-jar
uses: actions/download-artifact@v3
with:
name: eperusteet-service-jar
- name: Build Docker Conainer
shell: bash
run: |
git clone https://github.com/Opetushallitus/ci-tools.git
source ci-tools/common/setup-tools.sh
export BASE_IMAGE="baseimage-fatjar-openjdk11:master"
cp eperusteet-service.jar $DOCKER_BUILD_DIR/artifact/eperusteet.jar
cp -vr $ARTIFACT_NAME/src/main/resources/oph-configuration $DOCKER_BUILD_DIR/config/
./ci-tools/common/pull-image.sh
./ci-tools/github-build/build-fatjar.sh $ARTIFACT_NAME
./ci-tools/github-build/upload-image.sh $ARTIFACT_NAME