Merge pull request #227 from netgrif/dev #103
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: Build | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: 'adopt' | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Build | |
run: mvn clean verify -DskipTests=true | |
test: | |
name: Test | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 90 | |
services: | |
mongo: | |
image: mongo:4.4 | |
ports: | |
- 27017:27017 | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
elasticsearch: | |
image: elasticsearch:7.17.3 | |
ports: | |
- 9200:9200 | |
- 9300:9300 | |
options: -e="discovery.type=single-node" -e="xpack.security.enabled=false" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10 | |
steps: | |
- name: Test Database | |
env: | |
ELASTIC_SEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }} | |
run: | | |
echo $ELASTIC_SEARCH_URL | |
curl -fsSL "$ELASTIC_SEARCH_URL/_cat/health?h=status" | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: 'adopt' | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Generate certificates | |
run: cd src/main/resources/certificates && openssl genrsa -out keypair.pem 4096 && openssl rsa -in keypair.pem -pubout -out public.crt && openssl pkcs8 -topk8 -inform PEM -outform DER -nocrypt -in keypair.pem -out private.der && cd ../../../.. | |
- name: Build | |
run: mvn clean package install -DskipTests=true | |
- name: Build, test, and analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=netgrif_application-engine | |
docs: | |
name: Generate docs | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PUSH_DOCS }} | |
fetch-depth: 0 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: 'adopt' | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Build | |
run: mvn clean package install -DskipTests=true | |
- name: Generate Docs | |
run: | | |
mvn javadoc:javadoc | |
cp -r ./target/apidocs/* ./docs/javadoc/ | |
- uses: EndBug/add-and-commit@v8 | |
with: | |
add: docs | |
pathspec_error_handling: exitImmediately | |
message: 'CI - Update documentation' |