Skip to content

Merge pull request #808 from pizzi80/4.x_utils #306

Merge pull request #808 from pizzi80/4.x_utils

Merge pull request #808 from pizzi80/4.x_utils #306

Workflow file for this run

#
# Copyright OmniFaces
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
#
# NOTE: this workflow file cannot have the same file name across all branches, otherwise each branch will pick the
# latest modified one. Hence the workflow files have each a different file name with the branch name as prefix.
name: 4.x
on:
push:
branches: [ 4.x ]
pull_request:
branches: [ 4.x ]
permissions:
contents: read
jobs:
test:
name: Test 4.x on ${{matrix.server}}
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
server: [ wildfly-mojarra4, liberty-myfaces3, glassfish-mojarra4, tomee-myfaces3, tomcat-mojarra4, tomcat-mojarra3, tomcat-myfaces4, tomcat-myfaces3 ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
cache: maven
- name: Test with Maven
run: mvn -B verify -P ${{matrix.server}}
deploy:
name: Deploy 4.x SNAPSHOT
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
server-id: ossrh
server-username: OSSRH_USERNAME
server-password: OSSRH_PASSWORD
- name: Extract project version
id: project
run: echo version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) >> $GITHUB_OUTPUT
- name: Deploy with Maven
if: ${{endsWith(steps.project.outputs.version, '-SNAPSHOT')}}
run: mvn -B deploy -Dmaven.test.skip=true
env:
OSSRH_USERNAME: ${{secrets.OSSRH_USERNAME}}
OSSRH_PASSWORD: ${{secrets.OSSRH_PASSWORD}}
analyze:
name: Analyze 4.x with Sonar
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Cache Sonar 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: Build and analyze
run: mvn -B package org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=omnifaces_omnifaces -Dmaven.javadoc.skip=true -Dmaven.test.skip=true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}