Files
spring-tools/.github/workflows/eclipse-ls-extensions-build.yml

155 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: 'e429'
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
ref:
description: Git branch, tag, commit hash
required: false
default: 'main'
type: string
jobs:
eclipse-language-servers-build:
runs-on: ubuntu-latest
outputs:
invalid_urls: ${{ steps.compute-invalid-urls.outputs.invalid_urls }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
sparse-checkout: |
.github
headless-services
eclipse-language-servers
- name: Set up JDK 17
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2
with:
java-version: '17'
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: Cloudgate S3 Configuration
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a
with:
aws-access-key-id: ${{ secrets.TOOLS_CLOUDGATE_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.TOOLS_CLOUDGATE_SECRET_KEY }}
role-to-assume: arn:aws:iam::${{ secrets.TOOLS_CLOUDGATE_ACCOUNT_ID }}:role/${{ secrets.TOOLS_CLOUDGATE_USER }}
role-session-name: ${{ github.run_id }}
aws-region: us-east-1
role-duration-seconds: 900
role-skip-session-tagging: true
- name: Upload P2 Repo to S3 and Akamai
id: upload-p2-to-akamai
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://tools-spring-io/${p2_path}/ --recursive
aws s3 cp ${{ github.workspace }}/eclipse-language-servers/org.springframework.tooling.ls.integration.repository/target/repository/ s3://tools-spring-io/${p2_path}/ --recursive --no-progress
aws s3 rm s3://dist.springsource.com/${p2_path}/ --recursive
aws s3 cp ${{ github.workspace }}/eclipse-language-servers/org.springframework.tooling.ls.integration.repository/target/repository/ s3://dist.springsource.com/${p2_path}/ --recursive --acl public-read --no-progress
# - name: Verify Uploaded P2 Repo
# id: verify-p2-on-akamai
# run: |
# p2_path=`cat ${{ github.workspace }}/eclipse-language-servers/org.springframework.tooling.ls.integration.repository/target/s3-p2-repo-dist-path.txt`
# echo "Verifying uploaded to Akamai files..."
# cd ${{ github.workspace }}/eclipse-language-servers/org.springframework.tooling.ls.integration.repository/target/repository/plugins
# for f in `ls -p | grep -v '/$'`
# do
# wget --no-verbose -O /dev/null https://cdn.spring.io/spring-tools/$p2_path/plugins/$f
# done
- name: Compute invalid URLs
if: ${{ inputs.build_type != 'snapshot' }}
id: compute-invalid-urls
run: |
invalid_urls=`aws s3 ls s3://tools-spring-io/${{ steps.upload-p2-to-akamai.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
- name: Clear S3 Caches
if: ${{ inputs.build_type != 'snapshot' }}
env:
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
CLOUDFLARE_CACHE_TOKEN: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}
run: |
${{ github.workspace }}/.github/scripts/clear-s3-caches.sh ${{ steps.upload-p2-to-akamai.outputs.p2_path }}
- name: Verify Eclipse LS Extensions on e431
if: ${{ inputs.build_type == 'snapshot' }}
run: |
cd eclipse-language-servers
if command -v xvfb-run ; then
xvfb-run ./mvnw --batch-mode clean package -Pe431 -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 -Pe431 -P${{ inputs.build_type }} -Dhttpclient.retry-max=20 -Declipse.p2.mirrors=false -Dmaven.test.skip=true -Dtycho.localArtifacts=ignore
fi
purge_cache:
needs: [ eclipse-language-servers-build ]
if: ${{ inputs.build_type != 'snapshot' }}
runs-on: [self-hosted, macOS]
steps:
- uses: ./.github/actions/akamai-purge-osx
name: Invalidate URLs
env:
EDGERC: ${{ secrets.EDGERC }}
with:
command: invalidate
urls: ${{ needs.eclipse-language-servers-build.outputs.invalid_urls }}
notify-failure:
needs: [ eclipse-language-servers-build, purge_cache ]
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