Files
spring-tools/.github/workflows/eclipse-ls-extensions-build.yml
2025-03-12 22:55:27 -04:00

164 lines
7.2 KiB
YAML

name: Eclipse LS Extensions Build
# configure manual trigger
#on:
# workflow_dispatch:
on:
workflow_call:
inputs:
build_type:
description: Build type such as 'snapshot', 'milestone' or 'release'
required: true
default: 'snapshot'
type: string
eclipse_profile:
description: Eclipse profile 'e429' etc
required: false
default: 'e431'
type: string
skip_tests:
description: skip ls tests execution
required: false
default: false
type: boolean
sts4-language-servers-version:
description: version of sts4 ls extensions
required: false
type: string
env:
AWS_ACCESS_KEY_ID: ${{ secrets.CDN_S3_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CDN_S3_SECRET_KEY }}
AWS_DEFAULT_REGION: us-east-1
AWS_ENDPOINT_URL_S3: ${{ secrets.CDN_S3_ENDPOINT }}
AWS_S3_BUCKET: ${{ secrets.CDN_BUCKET }}/spring-tools
DOWNLOAD_URL_ROOT: https://cdn.spring.io/spring-tools
jobs:
eclipse-language-servers-build:
runs-on: ubuntu-latest
outputs:
invalid_urls: ${{ steps.compute-invalid-urls.outputs.invalid_urls }}
steps:
- name: Setup AWS CLI 2.22
run: |
curl -s "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.22.35.zip" -o "awscliv2.zip"
unzip -q awscliv2.zip
sudo ./aws/install --update
aws --version
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
sparse-checkout: |
.github
headless-services
eclipse-language-servers
- name: Set up JDK 21
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2
with:
java-version: '21'
distribution: 'temurin'
- name: Enforce https instead of http
run: ./nohttp.sh
- name: Build Language Servers JARs
run: |
cd headless-services
if command -v xvfb-run ; then
xvfb-run ./mvnw --batch-mode clean install -DskipTests=${{ inputs.skip_tests }}
else
./mvnw --batch-mode clean install -DskipTests=${{ inputs.skip_tests }}
fi
- name: Install GPG key
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" > gpg.asc
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --passphrase-fd 0 --import gpg.asc
- name: Build Eclipse LS extensions
env:
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
gpg_keyname: ${{ secrets.GPG_KEYID }}
run: |
sts4_ls_version=${{ inputs.sts4-language-servers-version }}
sts4_ls_version_param=""
if ! [[ -z ${sts4_ls_version} ]]; then
sts4_ls_version_param="-Ddist.version=${sts4_ls_version}"
fi
cd eclipse-language-servers
if command -v xvfb-run ; then
xvfb-run ./mvnw --batch-mode clean install -P${{ inputs.eclipse_profile }} -P${{ inputs.build_type }} $sts4_ls_version_param -Pgitactions -Pgpg.sign -Dmaven.test.skip=true -Dhttpclient.retry-max=20 -Declipse.p2.mirrors=false -Dtycho.localArtifacts=ignore
else
./mvnw --batch-mode clean install -P${{ inputs.eclipse_profile }} -P${{ inputs.build_type }} $sts4_ls_version_param -Pgitactions -Pgpg.sign -Dmaven.test.skip=true -Dhttpclient.retry-max=20 -Declipse.p2.mirrors=false -Dtycho.localArtifacts=ignore
fi
- name: Upload P2 Repo to S3
id: upload-p2
run: |
p2_path=`cat ${{ github.workspace }}/eclipse-language-servers/org.springframework.tooling.ls.integration.repository/target/s3-p2-repo-dist-path.txt`
echo "p2_path=$p2_path" >> $GITHUB_OUTPUT
echo "P2 path: ${p2_path}"
aws s3 rm s3://$AWS_S3_BUCKET/${p2_path}/ --recursive
aws s3 cp ${{ github.workspace }}/eclipse-language-servers/org.springframework.tooling.ls.integration.repository/target/repository/ s3://$AWS_S3_BUCKET/${p2_path}/ --recursive --no-progress
- name: Compute invalid URLs
if: ${{ inputs.build_type != 'snapshot' }}
id: compute-invalid-urls
run: |
invalid_urls=`aws s3 ls s3://$AWS_S3_BUCKET/${{ steps.upload-p2.outputs.p2_path }}/ --recursive | awk '{$1=$2=$3=""; print $0}' | sed -e 's/^[ \t]*/https:\/\/cdn.spring.io\/spring-tools\//' | paste -sd' ' -`
echo "invalid_urls=$invalid_urls" >> $GITHUB_OUTPUT
- uses: ./.github/actions/cloudflare-purge
if: ${{ inputs.build_type != 'snapshot' }}
name: Invalidate URLs
with:
urls: ${{ steps.compute-invalid-urls.outputs.invalid_urls }}
cloudflare_zone_id: ${{ secrets.CLOUDFLARE_ZONE_ID }}
cloudflare_cache_token: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}
- name: Verify Eclipse LS Extensions on e436
if: ${{ inputs.build_type == 'snapshot' }}
run: |
cd eclipse-language-servers
if command -v xvfb-run ; then
xvfb-run ./mvnw --batch-mode clean package -Pe436 -P${{ inputs.build_type }} -Dhttpclient.retry-max=20 -Declipse.p2.mirrors=false -Dmaven.test.skip=true -Dtycho.localArtifacts=ignore
else
./mvnw --batch-mode clean package -Pe436 -P${{ inputs.build_type }} -Dhttpclient.retry-max=20 -Declipse.p2.mirrors=false -Dmaven.test.skip=true -Dtycho.localArtifacts=ignore
fi
- name: GChat spring-tools-team notification
if: ${{ inputs.build_type == 'release' }}
run: |
cd eclipse-language-servers
current_version=`./mvnw help:evaluate -Dexpression="project.version" -q -DforceStdout`
version=${current_version%%-*}
build_type=${{ inputs.build_type }}
build_type=${build_type^}
curl --location --request POST '${{ secrets.TOOLS_TEAM_GCHAT_WEBHOOK_URL }}' \
--header 'Content-Type: application/json' \
--data-raw "{
\"cards\": [
{
\"header\": {
\"title\": \"${build_type} Eclipse LS Extensions ${version}\",
\"subtitle\": \"${{ inputs.sts4-language-servers-version }}\",
\"imageUrl\": \"https://avatars.githubusercontent.com/u/317776?s=48&v=4\",
},
\"sections\": [
{
\"widgets\": [
{
\"keyValue\": {
\"topLabel\": \"P2 Update Site\",
\"content\": \"<a href=${DOWNLOAD_URL_ROOT}/${{ steps.upload-p2.outputs.p2_path }}/>${DOWNLOAD_URL_ROOT}/${{ steps.upload-p2.outputs.p2_path }}</a>\",
\"contentMultiline\": true
}
}
]
}
]
}
]
}"
notify-failure:
needs: [ eclipse-language-servers-build ]
if: ${{ always() && contains(needs.*.result, 'failure') }}
uses: ./.github/workflows/notify-failed.yml
with:
md_message: "*Failed LS Extensions ${{ inputs.build_type }} Build:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_id }}>"
secrets: inherit