Feature/deploymentmodelcompletion #1587
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: Winery CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*.*.*" | |
pull_request: | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
pre_job: | |
continue-on-error: true | |
runs-on: ubuntu-latest | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
docker_run_required: ${{ (github.repository_owner == 'OpenTOSCA' && (github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags'))) }} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@master | |
java17: | |
needs: pre_job | |
if: | | |
needs.pre_job.outputs.should_skip != 'true' | |
|| needs.pre_job.outputs.docker_run_required == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check if AbstractResourceTest does not contain log().all(). | |
run: | | |
if grep -i -q '\.all()' org.eclipse.winery.repository.rest/src/test/java/org/eclipse/winery/repository/rest/resources/AbstractResourceTest.java; | |
then | |
echo "Log output should be shortened. Use .ifValidationFails()!"; | |
exit 1; | |
fi | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
cache: 'maven' | |
- name: Publish package | |
run: mvn --batch-mode deploy | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build with Maven | |
run: mvn -Pjava -B package | |
- name: Upload binary to artifacts | |
uses: actions/upload-artifact@v3 | |
if: ${{ needs.pre_job.outputs.docker_run_required == 'true' }} | |
with: | |
name: artifacts | |
path: | | |
**/winery.war | |
**/winery-cli.jar | |
- name: Run codacy-coverage-reporter | |
if: ${{ github.repository_owner == 'OpenTOSCA' }} | |
uses: codacy/codacy-coverage-reporter-action@master | |
with: | |
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
coverage-reports: org.eclipse.winery.reporting/target/site/jacoco-aggregate/jacoco.xml | |
frontend: | |
needs: pre_job | |
if: | | |
needs.pre_job.outputs.should_skip != 'true' | |
|| needs.pre_job.outputs.docker_run_required == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.npm | |
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-${{ runner.os }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
cache: 'maven' | |
- name: Build with Maven | |
run: mvn -Pfrontend -B package | |
- name: Upload binary to artifacts | |
uses: actions/upload-artifact@v3 | |
if: ${{ needs.pre_job.outputs.docker_run_required == 'true' }} | |
with: | |
name: artifacts | |
path: ${{ github.workspace }}/org.eclipse.winery.frontends/target/*.war | |
dockerBuild: | |
needs: [ java17, frontend ] | |
runs-on: ubuntu-latest | |
if: ${{ needs.pre_job.outputs.docker_run_required == 'true' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifacts | |
path: ${{ github.workspace }} | |
- name: Prepare artifacts | |
run: | | |
mv org.eclipse.winery.cli/target/winery-cli.jar winery-cli.jar | |
mv org.eclipse.winery.repository.rest/target/winery.war winery.war | |
ls -al | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: amd64,arm64,arm | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta-cli | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-cli | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push latest Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: Dockerfile.noBuild | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Build and push latest CLI Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: Dockerfile.cli | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta-cli.outputs.tags }} | |
labels: ${{ steps.meta-cli.outputs.labels }} |