Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#427: optimize nightly builds #494

Merged
merged 35 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
745a5e6
#427:optimize github workflows
jan-vcapgemini Jul 24, 2024
e7b1b4b
#427: build separated documentation
jan-vcapgemini Jul 24, 2024
5f5b05a
#427: fixed package path
jan-vcapgemini Jul 24, 2024
38e1fea
#427: fixed missing folder
jan-vcapgemini Jul 24, 2024
a8ff362
#427: fixed create folder
jan-vcapgemini Jul 24, 2024
5633483
#427: renamed docs folder
jan-vcapgemini Jul 24, 2024
a0f8ce8
#427: activated all runners
jan-vcapgemini Jul 24, 2024
d273918
#427: switched tests
jan-vcapgemini Jul 24, 2024
2f46dd3
#427: fixed natives download
jan-vcapgemini Jul 24, 2024
8bccdd7
check for updates workflow added
mvomiero Jul 25, 2024
5c83daa
#427: ensure download of natives only
jan-vcapgemini Jul 26, 2024
7732a5a
#427: re-enabled all jobs
jan-vcapgemini Jul 26, 2024
ae39427
#427: renamed jobs
jan-vcapgemini Jul 26, 2024
76cf0b1
#427: adjusted names
jan-vcapgemini Jul 26, 2024
60b192c
#427: fixed syntax
jan-vcapgemini Jul 26, 2024
aa5e13e
#427: removed comments
jan-vcapgemini Jul 26, 2024
18ab260
#427: fixed syntax
jan-vcapgemini Jul 26, 2024
9091676
#427: fixed syntax
jan-vcapgemini Jul 26, 2024
4f97c7f
#427: test
jan-vcapgemini Jul 26, 2024
39dbfee
#427: added merge of artifacts
jan-vcapgemini Jul 26, 2024
e26fcd5
#427: fixed attach artifact name
jan-vcapgemini Jul 26, 2024
98fd113
#427: re-enabled runners
jan-vcapgemini Jul 26, 2024
a1d3c81
#427: re-added comments
jan-vcapgemini Jul 26, 2024
521e871
#427: added comments updated release
jan-vcapgemini Jul 26, 2024
c2c3145
Update .github/workflows/release.yml
jan-vcapgemini Jul 29, 2024
24544f2
Update .github/workflows/nightly-build.yml
jan-vcapgemini Jul 29, 2024
92a9284
#427: implemented requested changes
jan-vcapgemini Jul 29, 2024
88094cc
#427: implemented requested changes
jan-vcapgemini Jul 29, 2024
9962a96
#427: implemented requested changes
jan-vcapgemini Jul 29, 2024
95cbd6d
#427: implemented requested changes
jan-vcapgemini Jul 29, 2024
05ba03c
#427: implemented requested changes
jan-vcapgemini Jul 29, 2024
ff5e17e
#427: implemented requested changes
jan-vcapgemini Jul 29, 2024
7884492
Merge branch 'main' into feature/427-optimize-builds
hohwille Jul 30, 2024
f0c6939
Merge pull request #1 from mvomiero/enhancement/commitCheckWorkflowDe…
jan-vcapgemini Jul 30, 2024
a64ac01
Merge branch 'main' into feature/427-optimize-builds
hohwille Jul 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/check-for-updates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Check for Updates

on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'

jobs:
verify_commit:
runs-on: ubuntu-latest
outputs:
RUN_BUILD: ${{ steps.verify_commit.outputs.RUN_BUILD }}
steps:
- uses: actions/checkout@v3
- id: verify_commit
run: |
if git log --since='24 hours ago' --oneline | grep '.'; then
echo "::set-output name=RUN_BUILD::true"
else
echo "::set-output name=RUN_BUILD::false"
fi

trigger_build:
runs-on: ubuntu-latest
needs: verify_commit
if: ${{ needs.verify_commit.outputs.RUN_BUILD == 'true' }}
steps:
- name: Trigger Nightly Build Workflow
run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/nightly-build.yml/dispatches \
-d '{"ref":"main"}'
62 changes: 49 additions & 13 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,37 @@ jobs:
if: ${{ (github.event_name == 'schedule') || (github.event_name == 'workflow_dispatch') }}
run: echo '::set-output name=RUN_BUILD::'$(test -n "$(git log --format=%H --since='24 hours ago')" && echo 'true' || echo 'false')

# Builds documentation pdf file in cli/target/package and uploads artifact to docs
build-documentation:
name: Build documentation
needs: [ verify_commit ]
if: ${{ needs.verify_commit.outputs.RUN_BUILD == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: '17'
- name: Make documentation available
run: |
cd documentation
mvn -B -ntp -Dstyle.color=always -DskipTests=true package
- name: Upload documentation
uses: actions/upload-artifact@v4
with:
name: docs
path: documentation/target/generated-docs/*.pdf

# Downloads documentation docs artifact, builds all native images, archives native image for each os with documentation pdf file and uploads artifacts to f.e. natives-windows-latest
build-natives:
name: Build native images
runs-on: ${{ matrix.os }}
needs: verify_commit
needs: [ verify_commit, build-documentation ]
if: ${{ needs.verify_commit.outputs.RUN_BUILD == 'true' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest, ubuntu-latest, macos-latest, macos-13 ]
Expand All @@ -36,19 +62,26 @@ jobs:
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Build native images with nativ maven plugin and extract in tar.gz
- name: Download documentation
uses: actions/download-artifact@v4
with:
name: docs
path: ./cli/target/package
- name: Build native image
shell: bash
run: |
cd cli
mvn -B -ntp -Pnative -P!include-docs -DskipTests=true package
- uses: actions/upload-artifact@v3
mvn -B -ntp -Dideasy.assembly.id=${{ matrix.os }} -Pnative -DskipTests=true package
- name: Upload native image
uses: actions/upload-artifact@v4
with:
name: natives
name: natives-${{ matrix.os }}
path: cli/target/*.tar.gz

build:
# Downloads all native image artifacts to cli/target and builds the project for deployment to OSSRH Nexus
deploy:
name: Build Project and Deploy
needs: [ build-natives, verify_commit ]
needs: [ verify_commit, build-documentation, build-natives ]
if: ${{ needs.verify_commit.outputs.RUN_BUILD == 'true' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -60,16 +93,19 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: '17'
- uses: actions/download-artifact@v3
- name: Make natives available and build project
run: |
- name: Download natives and build project
uses: actions/download-artifact@v4
with:
pattern: natives-*
path: ./cli/target/
merge-multiple: true
- run: |
mvn -B -ntp -Dstyle.color=always install
mv ./natives/* ./cli/target/
- name: Deploy to OSSRH nexus
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: mvn --settings .mvn/settings.xml -DskipTests=true -Darchetype.test.skip=true -Dmaven.install.skip=true -Dgpg.skip=true -Dstyle.color=always -B -ntp -P deploy deploy
run: mvn --settings .mvn/settings.xml -DskipTests=true -Darchetype.test.skip=true -Dmaven.install.skip=true -Dgpg.skip=true -Dstyle.color=always -B -ntp -Pdeploy deploy

check_status:
runs-on: ubuntu-latest
Expand Down
55 changes: 45 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,39 @@ on:
workflow_dispatch

jobs:

# Builds documentation pdf file in cli/target/package and uploads artifact to docs
build-documentation:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: '17'
- name: Make documentation available
run: |
cd documentation
mvn -B -ntp -Dstyle.color=always -DskipTests=true package
- name: Upload documentation
uses: actions/upload-artifact@v4
with:
name: docs
path: documentation/target/generated-docs/*.pdf

# Downloads documentation docs artifact, builds all native images, archives native image for each os with documentation pdf file and uploads artifacts to f.e. natives-windows-latest
build-natives:
name: Build native images
needs: build-documentation
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest, macos-latest, macos-13, ubuntu-latest ]
os: [ windows-latest, ubuntu-latest, macos-latest, macos-13 ]

steps:
- uses: actions/checkout@v3
with:
Expand All @@ -21,23 +48,26 @@ jobs:
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Build native images with nativ maven plugin and extract in tar.gz
- name: Download documentation
uses: actions/download-artifact@v4
with:
name: docs
path: ./cli/target/package
- name: Build native image
shell: bash
run: |
maven_config="$(cat .mvn/maven.config)"
current_version="${maven_config/#*-Drevision=}"
current_version="${current_version/ */}"
cd cli
mvn -B -ntp -Pnative -DskipTests=true package
- uses: actions/upload-artifact@v3
mvn -B -ntp -Dideasy.assembly.id=${{ matrix.os }} -Pnative -DskipTests=true package
- name: Upload native image
uses: actions/upload-artifact@v4
with:
name: natives
name: natives-${{ matrix.os }}
path: cli/target/*.tar.gz

release:
name: Release on Sonatype OSS
runs-on: ubuntu-latest
needs: [ build-natives ]
needs: [ build-documentation, build-natives ]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -52,7 +82,12 @@ jobs:
cache: 'maven'
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase
- uses: actions/download-artifact@v3
- name: Download natives and build project
uses: actions/download-artifact@v4
with:
pattern: natives-*
path: ./cli/target/
merge-multiple: true
- name: Publish to Apache Maven Central
run: |
maven_config="$(cat .mvn/maven.config)"
Expand Down
127 changes: 39 additions & 88 deletions cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<properties>
<mainClass>com.devonfw.tools.ide.cli.Ideasy</mainClass>
<imageName>ideasy</imageName>
<releaseName>${project.artifactId}-${os.detected.name}-${os.detected.arch}</releaseName>
<native.maven.plugin.version>0.9.28</native.maven.plugin.version>
<native.maven.plugin.version>0.10.2</native.maven.plugin.version>
<assembly.maven.plugin.version>3.7.1</assembly.maven.plugin.version>
<jline.version>3.24.1</jline.version>
<jansi.version>2.4.0</jansi.version>
</properties>
Expand Down Expand Up @@ -140,52 +140,9 @@
</plugins>
</build>


<profiles>
<profile>
<id>deploy</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.4.0</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/${project.artifactId}-linux-x86_64.tar.gz</file>
<type>tar.gz</type>
<classifier>linux-x64</classifier>
</artifact>
<artifact>
<file>${project.build.directory}/${project.artifactId}-windows-x86_64.tar.gz</file>
<type>tar.gz</type>
<classifier>windows-x64</classifier>
</artifact>
<artifact>
<file>${project.build.directory}/${project.artifactId}-osx-x86_64.tar.gz</file>
<type>tar.gz</type>
<classifier>mac-x64</classifier>
</artifact>
<artifact>
<file>${project.build.directory}/${project.artifactId}-osx-aarch_64.tar.gz</file>
<type>tar.gz</type>
<classifier>mac-arm</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- Builds the native image and archives it with the documentation from the github artifact -->
<profile>
<id>native</id>
<build>
Expand Down Expand Up @@ -230,6 +187,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${assembly.maven.plugin.version}</version>
<executions>
<execution>
<id>create-distribution</id>
Expand All @@ -238,67 +196,60 @@
<goal>single</goal>
</goals>
<configuration>
<finalName>${releaseName}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<appendAssemblyId>true</appendAssemblyId>
<descriptors>
<descriptor>/src/main/assembly/release.xml</descriptor>
<descriptor>/src/main/assembly/release-${ideasy.assembly.id}.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.7.1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>detect</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<!-- New profile for including documentation -->
<!-- Attaches artifacts stored in cli/target/*.tgz to the maven build, moves them to documentation/target/nexus-staging/.../*.tgz and deploys them with the name defined in the classifier -->
<profile>
<id>include-docs</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<id>deploy</id>
<build>
<plugins>
<plugin>
<!-- Include documentation into release -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.4.0</version>
<executions>
<execution>
<id>copy-documentation</id>
<phase>prepare-package</phase>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/${project.artifactId}-${revision}-windows_x86_64.tar.gz</file>
<type>tar.gz</type>
<classifier>windows-x64</classifier>
</artifact>
<artifact>
<file>${project.build.directory}/${project.artifactId}-${revision}-linux_x86_64.tar.gz</file>
<type>tar.gz</type>
<classifier>linux-x64</classifier>
</artifact>
<artifact>
<file>${project.build.directory}/${project.artifactId}-${revision}-osx_x86_64.tar.gz</file>
<type>tar.gz</type>
<classifier>mac-x64</classifier>
</artifact>
<artifact>
<file>${project.build.directory}/${project.artifactId}-${revision}-osx_aarch_64.tar.gz</file>
<type>tar.gz</type>
<classifier>mac-arm</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>ide-doc</artifactId>
<version>${project.version}</version>
<type>pdf</type>
<destFileName>IDEasy-documentation.pdf</destFileName>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/package</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Loading
Loading