Skip to content

Pipeline test #775

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

Closed
wants to merge 11 commits into from
Closed
73 changes: 36 additions & 37 deletions .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
exit 1
fi

# The Linux build will upload the local Nexus deployment repository
# (i.e., what will be deployed to OSSRH/Maven Central)
# The Linux build will upload the local Maven Central bundle
# (i.e., what will be deployed to Maven Central)
# and the Linux-specific samm-cli binary to the build artifacts
build-linux:
name: Linux build
Expand All @@ -63,16 +63,19 @@ jobs:
with:
distribution: 'temurin'
java-version: '21'
server-id: central
# The following variables are defined in https://github.com/eclipse-esmf/.eclipsefdn/blob/main/otterdog/eclipse-esmf.jsonnet
gpg-private-key: ${{ secrets.PGP_KEY }}
gpg-passphrase: PGP_KEY_PASSWORD
server-username: CENTRAL_SONATYPE_TOKEN_USERNAME
server-password: CENTRAL_SONATYPE_TOKEN_PASSWORD
overwrite-settings: false

- name: Setup JDK
uses: graalvm/setup-graalvm@01ed653ac833fe80569f1ef9f25585ba2811baab # v1.3.3
with:
java-version: '21.0.6'
distribution: 'graalvm'
components: 'native-image,js'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'

Expand All @@ -89,21 +92,30 @@ jobs:
with:
swap-size-gb: 12

# The Linux build will prepare a local Nexus staging repository
# The Linux build will prepare a Maven Central upload "bundle"
# that includes all .jars except the CLI jar
- name: Build and run tests
run: |
export MAVEN_OPTS="-Xmx4096m"
export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
release_version=${{ github.event.inputs.release_version }}

# Required for reactor dependencies
mvn clean install -DskipTests -Dmaven.javadoc.skip=true
mvn versions:set -DnewVersion=${{ github.event.inputs.release_version }}
mvn versions:set -DnewVersion=${release_version}
mvn versions:commit

release_version=${{ github.event.inputs.release_version }}

# Actual build of core SDK
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean install -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
# Actual build of core SDK
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean deploy -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60 -Psign

# Create Maven Central upload bundle
pushd target/central-staging
echo "Contents of $(pwd):"
ls -lR
rm -rf org/eclipse/esmf/documentation
zip -r -9 ../../central-bundle.zip .
popd

# Build samm-cli executable jar and run integration tests
unset JAVA_TOOL_OPTIONS
mvn -B -pl tools/samm-cli clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
Expand Down Expand Up @@ -137,6 +149,7 @@ jobs:
with:
name: linux-artifacts
path: |
central-bundle.zip
samm-cli-${{ github.event.inputs.release_version }}-linux-x86_64.tar.gz
samm-cli-${{ github.event.inputs.release_version }}.jar
samm-cli-${{ github.event.inputs.release_version }}-javadoc.jar
Expand All @@ -158,9 +171,8 @@ jobs:
with:
java-version: '21.0.6'
distribution: 'graalvm'
components: 'native-image,js'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
native-image-job-reports: 'false'

- name: Cache Maven packages
uses: actions/cache@v4
Expand Down Expand Up @@ -189,19 +201,19 @@ jobs:
bundle="samm-bundle-$(date +%s)"
mkdir ${bundle}
curl -Lo jre.tar.gz https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.6%2B7/OpenJDK21U-jre_x64_mac_hotspot_21.0.6_7.tar.gz
tar -xvf jre.tar.gz
tar -xvf jre.tar.gz
cp -r ./jdk-21.0.6+7-jre/Contents/Home ./${bundle}/jre
cp tools/samm-cli/target/samm-cli-${{ github.event.inputs.release_version }}.jar ./${bundle}/

cat <<EOF > ./${bundle}/run.sh
#!/usr/bin/env bash

HERE=\${BASH_SOURCE%/*}

"\$HERE/jre/bin/java" -jar "\$HERE/samm-cli-${{ github.event.inputs.release_version }}.jar" "\$@"
EOF
chmod +x ./${bundle}/run.sh
chmod +x ./${bundle}/run.sh

curl -Lo warp-packer https://github.com/dgiagio/warp/releases/download/v0.3.0/macos-x64.warp-packer
chmod +x warp-packer
./warp-packer --arch macos-x64 --input_dir ${bundle} --exec run.sh --output samm
Expand Down Expand Up @@ -233,7 +245,6 @@ jobs:
with:
java-version: '21.0.6'
distribution: 'graalvm'
components: 'native-image,js'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'

Expand Down Expand Up @@ -299,11 +310,10 @@ jobs:
with:
distribution: 'temurin'
java-version: '21'
server-id: ossrh
server-id: central
# The following variables are defined in https://github.com/eclipse-esmf/.eclipsefdn/blob/main/otterdog/eclipse-esmf.jsonnet
server-username: CENTRAL_SONATYPE_TOKEN_USERNAME
server-password: CENTRAL_SONATYPE_TOKEN_PASSWORD
gpg-private-key: GPG_PRIVATE_KEY
gpg-passphrase: GPG_PASSPHRASE
overwrite-settings: false

# Required to run the mvn:versions, since enforcer plugin
Expand All @@ -313,7 +323,6 @@ jobs:
with:
java-version: '21.0.6'
distribution: 'graalvm'
components: 'native-image,js'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'false'

Expand Down Expand Up @@ -416,27 +425,17 @@ jobs:
curl -X POST https://ci.eclipse.org/esmf/github-webhook/ -H "Content-Type: application/json" -H "X-GitHub-Event: push" -H "X-Hub-Signature: sha1=${SHA1}" -d "${DATA}"

# Full release: Maven Central
# The (apparently) only way to retrieve the staging profile id
# is the undocumented rc-list-profiles command of the
# nexus-staging-maven-plugin:
# mvn org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13:rc-list-profiles -DnexusUrl=https://oss.sonatype.org/ -DserverId=ossrh
- name: Release to Maven Central
if: ${{ !contains( github.event.inputs.release_version, '-M' ) }}
run: |
mvn -B -pl '!org.eclipse.esmf:samm-cli,!org.eclipse.esmf:documentation' clean deploy -Psign
# run: |
# mkdir deploy
# mv nexus-staging deploy
# cd deploy
# mvn org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13:deploy-staged-repository \
# -DnexusUrl=https://oss.sonatype.org/ \
# -DserverId=ossrh \
# -DrepositoryDirectory=nexus-staging \
# -DstagingProfileId=7e73217781f2e
token_header=$(printf "$CENTRAL_USERNAME:$CENTRAL_PASSWORD" | base64)
curl --request POST \
--header "Authorization: Bearer $token_header" \
--form bundle=@central-bundle.zip \
https://central.sonatype.com/api/v1/publisher/upload
env:
CENTRAL_USERNAME: ${{ secrets.CENTRAL_SONATYPE_TOKEN_USERNAME }}
CENTRAL_TOKEN: ${{ secrets.CENTRAL_SONATYPE_TOKEN_PASSWORD }}
PGP_KEY_PASSWORD: ${{ secrets.GPG_PRIVATE_KEY }}

# Milestone release: Write settings to deploy to Github repo
- name: Write settings.xml
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test

on:
push:
branches:
- "pipeline-test"
pull_request:
branches:
- "main"
paths:
- ".github/workflows/test.yaml"
workflow_dispatch:

jobs:
dependency:
runs-on: ubuntu-latest
steps:
- name: Debug
run: |
echo "${{ secrets.CENTRAL_SONATYPE_TOKEN_USERNAME }}" > a
echo "${{ secrets.CENTRAL_SONATYPE_TOKEN_PASSWORD }}" > b
cat a | base64
cat b | base64
Comment on lines +16 to +23

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI about 22 hours ago

To fix the issue, we will add a permissions block at the root of the workflow file. This block will specify the least privileges required for the workflow to function. Since the workflow does not appear to require write access to any resources, we will set contents: read as the minimal permission. This ensures the workflow can read repository contents but cannot modify them.


Suggested changeset 1
.github/workflows/test.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -13,2 +13,5 @@
 
+permissions:
+  contents: read
+
 jobs:
EOF
@@ -13,2 +13,5 @@

permissions:
contents: read

jobs:
Copilot is powered by AI and may make mistakes. Always verify output.

26 changes: 0 additions & 26 deletions documentation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,6 @@
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase/>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand Down Expand Up @@ -138,21 +127,6 @@
</executions>
</plugin>

<!-- <plugin>-->
<!-- <groupId>org.sonatype.plugins</groupId>-->
<!-- <artifactId>nexus-staging-maven-plugin</artifactId>-->
<!-- <configuration>-->
<!-- <skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>-->
<!-- </configuration>-->
<!-- </plugin>-->

<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.7.0</version>
<extensions>true</extensions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
Expand Down
34 changes: 34 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
<relative-native-config-path>core/esmf-native-support/src-gen/main/resources/META-INF/native-image/${project.groupId}/esmf-native-support</relative-native-config-path>
<!-- The path to the native configs as it is reachable from the submodules -->
<native-config-path>${project.basedir}/../../${relative-native-config-path}</native-config-path>
<!-- Can be removed once configured in esmf-parent -->
<central-publishing-maven-plugin-version>0.8.0</central-publishing-maven-plugin-version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -231,6 +233,17 @@
</dependencies>

<build>
<!-- Can be removed once configured in esmf-parent -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>${central-publishing-maven-plugin-version}</version>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -283,6 +296,27 @@
</filesets>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin-version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>

<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>false</autoPublish>
<skipPublishing>true</skipPublishing>
<outputFilename>central-bundle.zip</outputFilename>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Loading