cra eject #449
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: koodisto-app | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ master ] | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
jobs: | |
cypress: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Install mock-api dependencies | |
run: cd mock-api && npm ci && cd - | |
- name: Run Cypress tests | |
run: npm run cypress:ci | |
react-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Run test | |
run: npm test | |
- name: Run react Build | |
run: npm run build | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'corretto' | |
cache: 'maven' | |
- name: Maven version | |
run: mvn --version | |
- name: Build Spring-Boot | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: cd server && mvn clean install && cd - | |
- name: Upload koodisto-app-spring-boot | |
uses: actions/upload-artifact@v4 | |
with: | |
name: koodisto-app-spring-boot | |
path: server/target/koodisto-app.jar | |
deploy-container: | |
needs: [cypress,react-build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Download koodisto-app-spring-boot | |
uses: actions/download-artifact@v4 | |
with: | |
name: koodisto-app-spring-boot | |
- name: Build Docker Conainer | |
shell: bash | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
run: | | |
git clone https://github.com/Opetushallitus/ci-tools.git | |
source ci-tools/common/setup-tools.sh | |
export BASE_IMAGE="baseimage-fatjar-openjdk21:master" | |
export ARTIFACT_NAME="koodisto-app" | |
mv koodisto-app.jar $DOCKER_BUILD_DIR/artifact/$ARTIFACT_NAME.jar | |
cp -vr 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 | |
sonarcloud: | |
needs: [react-build, cypress] | |
name: SonarCloud | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Code coverrage cache | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-code-coverage | |
with: | |
path: coverage | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }} | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |