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

Modernize CI #1616

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
118 changes: 45 additions & 73 deletions .github/workflows/autobuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: |
sudo apt-get install jq
- name: Clone scripts
uses: actions/checkout@v2
uses: actions/checkout@v3
# Choose the commit to build a release from.
#
# We want to avoid unbuildable revisions: choose the last green from CI.
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
run: >
echo "RELEASE_DESCRIPTION=Unstable snapshot of clangd on ${{ env.RELEASE_DATE }}." >> commit.env
- name: Upload result
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: env
path: commit.env
Expand All @@ -85,7 +85,7 @@ jobs:
echo "RELEASE_NAME=${{ github.event.inputs.release_name }}" >> commit.env
echo "RELEASE_DESCRIPTION=${{ github.event.inputs.description }}" >> commit.env
- name: Upload result
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: env
path: commit.env
Expand All @@ -99,37 +99,22 @@ jobs:
if: always() && (needs.schedule_environment.result == 'success' || needs.workflow_dispatch_environment.result == 'success')
steps:
- name: Fetch environment variables
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name:
env
name: env
- name: Set environment variables
run: |
cat env/commit.env >> $GITHUB_ENV
run: cat commit.env >> $GITHUB_ENV
- name: Setup gh
uses: wusatosi/setup-gh@v1
with:
token: ${{ secrets.RELEASE_TOKEN }}
- name: Create release
uses: actions/create-release@master
id: create_release
run: gh release create ${{ env.TAG_NAME }} -t "${{ env.RELEASE_NAME }}" -n "${{ env.body }}" --draft --prerelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
release_name: ${{ env.RELEASE_NAME }}
body: |
${{ env.RELEASE_DESCRIPTION }}

Built from ${{ env.LLVM_REPO }}@${{ env.LLVM_COMMIT }}.
prerelease: true
draft: true
- name: Preserve release info
run: |
echo "UPLOAD_URL=${{ steps.create_release.outputs.upload_url }}" >> release.env
echo "TAG_NAME=${{ env.TAG_NAME }}" >> release.env
echo "RELEASE_ID=${{ steps.create_release.outputs.id }}" >> release.env
- name: Upload result
uses: actions/upload-artifact@v2
with:
name: release
path: release.env
# Build clangd using CMake/Ninja.
#
# This step is a template that runs on each OS, build config varies slightly.
Expand Down Expand Up @@ -171,10 +156,9 @@ jobs:
- name: linux
os: ubuntu-latest
container: ubuntu:18.04
preinstall: >-
preinstall: |
apt-get update &&
apt-get install -y ninja-build libz-dev libc-ares-dev wget clang-9
software-properties-common p7zip-full curl &&
apt-get install -y ninja-build libz-dev libc-ares-dev wget clang-9 software-properties-common p7zip-full curl &&
add-apt-repository ppa:git-core/ppa &&
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add - &&
apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' &&
Expand All @@ -196,10 +180,15 @@ jobs:
container: ${{ matrix.config.container }}
steps:
- name: Clone scripts
uses: actions/checkout@v2
with: { ref: master }
uses: actions/checkout@v3
with:
ref: master
- name: Install tools
run: ${{ matrix.config.preinstall }}
- name: Setup gh
uses: wusatosi/setup-gh@v1
with:
token: ${{ secrets.RELEASE_TOKEN }}
# Visual Studio tools require a bunch of environment variables to be set.
# Run vcvars64.bat and re-export the current environment to the workflow.
# (It'd be nice to only export the variables that *changed*, oh well).
Expand All @@ -214,7 +203,7 @@ jobs:
}
}
- name: Clone gRPC
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: grpc/grpc
path: grpc
Expand All @@ -239,19 +228,11 @@ jobs:

ninja -C grpc-build install
- name: Fetch target commit
uses: actions/download-artifact@v1
with:
name:
env
- name: Fetch release info
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name:
release
name: env
- name: Put release info into env
run: |
cat env/commit.env >> $GITHUB_ENV
cat release/release.env >> $GITHUB_ENV
run: cat commit.env >> $GITHUB_ENV
shell: bash
# Use environment variables set above to create a directory. This needs
# to be a separate step because they are not in the context yet when
Expand All @@ -261,7 +242,7 @@ jobs:
echo "CLANGD_DIR=clangd_${{ env.TAG_NAME }}" >> $GITHUB_ENV
shell: bash
- name: Clone LLVM
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: ${{ env.LLVM_REPO }}
path: llvm-project
Expand Down Expand Up @@ -309,24 +290,17 @@ jobs:
${{ env.CLANGD_DIR }}/bin/clangd-index-server${{ matrix.config.binary_extension }}
${{ env.CLANGD_DIR }}/bin/clangd-index-server-monitor${{ matrix.config.binary_extension }}
${{ env.CLANGD_DIR }}/lib/clang
- name: Upload clangd asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_name: clangd-${{ matrix.config.name }}-${{ env.TAG_NAME }}.zip
asset_path: clangd.zip
asset_content_type: application/zip
- name: Upload indexing-tools asset
uses: actions/upload-release-asset@v1.0.1
- name: Upload clangd asset and indexing tools
shell: bash
run: |
mv clangd.zip ${{ env.RELEASE_FILE_NAME }}
gh release upload ${{ env.TAG_NAME }} ${{ env.RELEASE_FILE_NAME }}

mv indexing-tools.zip ${{ env.INDEXING_TOOL_NAME }}
gh release upload ${{ env.TAG_NAME }} ${{ env.INDEXING_TOOL_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_name: clangd_indexing_tools-${{ matrix.config.name }}-${{ env.TAG_NAME }}.zip
asset_path: indexing-tools.zip
asset_content_type: application/zip
RELEASE_FILE_NAME: clangd-${{ matrix.config.name }}-${{ env.TAG_NAME }}.zip
INDEXING_TOOL_NAME: clangd_indexing_tools-${{ matrix.config.name }}-${{ env.TAG_NAME }}.zip
- name: Check binary compatibility
if: matrix.config.name == 'linux'
run: .github/workflows/lib_compat_test.py --lib=GLIBC_2.18 "$CLANGD_DIR/bin/clangd"
Expand All @@ -336,17 +310,15 @@ jobs:
needs: build
if: always() && needs.build.result == 'success'
steps:
- name: Fetch release info
uses: actions/download-artifact@v1
- name: Fetch environment variables
uses: actions/download-artifact@v3
with:
name:
release
- name: Update the env variables
run: >
cat release/release.env >> $GITHUB_ENV
name: env
- name: Set environment variables
run: cat commit.env >> $GITHUB_ENV
- name: Setup gh
uses: wusatosi/setup-gh@v1
with:
token: ${{ secrets.RELEASE_TOKEN }}
- name: Publish release
run: >
curl -XPATCH
"-HAuthorization: Bearer ${{ secrets.RELEASE_TOKEN }}"
"https://api.github.com/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }}"
"-d" '{"draft": false}'
run: gh release edit ${{ env.TAG_NAME }} --draft=false