This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
Update readme #175
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: varda-rekisterointi | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ master ] | |
pull_request: | |
jobs: | |
build: | |
services: | |
postgres: | |
image: postgres:15.7 | |
ports: | |
- 5433:5432 | |
env: | |
POSTGRES_USER: varda-rekisterointi | |
POSTGRES_DB: varda-rekisterointi | |
POSTGRES_PASSWORD: varda-rekisterointi | |
POSTGRES_HOST_AUTH_METHOD: trust | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Build frontend | |
run: | | |
npm ci | |
npm run lint | |
npm test | |
npm run build | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'corretto' | |
cache: 'maven' | |
- name: Maven version | |
run: mvn --version | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: mvn clean install -B -Dbranch=$GITHUB_REF_NAME -Drevision=$GITHUB_SHA -DbuildNumber=$GITHUB_RUN_NUMBER/$GITHUB_RUN_ATTEMPT org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=Opetushallitus_varda-rekisterointi | |
- name: Upload varda-rekisterointi-jar | |
uses: actions/upload-artifact@v4 | |
with: | |
name: varda-rekisterointi-jar | |
path: target/varda-rekisterointi.jar | |
deploy-container: | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Download varda-rekisterointi-jar | |
uses: actions/download-artifact@v4 | |
with: | |
name: varda-rekisterointi-jar | |
- 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="varda-rekisterointi" | |
cp varda-rekisterointi.jar $DOCKER_BUILD_DIR/artifact/$ARTIFACT_NAME.jar | |
cp -vr 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 |