Skip to content

IntegrateLLVMProject #787

IntegrateLLVMProject

IntegrateLLVMProject #787

# This workflow updates the repository for recent changes to llvm-project.
name: IntegrateLLVMProject
on:
# Run the workflow every day (9am PST) to pull in any changes from llvm-project.
schedule:
- cron: '0 16 * * *'
# Allows for running this workflow manually from the Actions tab.
workflow_dispatch:
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Timestamp Begin
run: date
- uses: actions/checkout@v2
- name: Clone llvm-project
uses: actions/checkout@v2
with:
repository: llvm/llvm-project
ref: 'main'
path: 'llvm_src'
- name: Update extension source
run: |
cp -r llvm_src/mlir/utils/vscode/. ./
cp llvm_src/mlir/utils/textmate/mlir.json ./grammar.json
cp llvm_src/llvm/utils/textmate/tablegen.json ./tablegen-grammar.json
cp llvm_src/mlir/LICENSE.TXT ./LICENSE
curl https://mlir.llvm.org//LogoAssets/logo/PNG/full_color/mlir-identity-03.png > ./icon.png
sed -i '/grammar.json/d' ./.gitignore
# Build the README from the up-to-date MLIR documentation.
printf "# MLIR\n" > README.md
printf "$(sed "/^### Visual Studio Code$/,/^(#|##|###) /!d;//d;" llvm_src/mlir/docs/Tools/MLIRLSP.md | sed "s/^##//")\n\n" >> README.md
MLIR_FEATURES=$(sed '/^\[mlir features\]: #$/,/^## /!d;//d;' llvm_src/mlir/docs/Tools/MLIRLSP.md | sed -n '/^#/,$p')
awk -i inplace -v r="$MLIR_FEATURES" '{gsub(/\[mlir-vscode features\]: #/,r)}1' README.md
PDLL_FEATURES=$(sed '/^\[pdll features\]: #$/,/^## /!d;//d;' llvm_src/mlir/docs/Tools/MLIRLSP.md | sed -n '/^#/,$p')
awk -i inplace -v r="$PDLL_FEATURES" '{gsub(/\[pdll-vscode features\]: #/,r)}1' README.md
TABLEGEN_FEATURES=$(sed '/^\[tablegen features\]: #$/,/^## /!d;//d;' llvm_src/mlir/docs/Tools/MLIRLSP.md | sed -n '/^#/,$p')
awk -i inplace -v r="$TABLEGEN_FEATURES" '{gsub(/\[tablegen-vscode features\]: #/,r)}1' README.md
sed -i 's|](/mlir-lsp-server/|](https://mlir.llvm.org/mlir-lsp-server/|g' README.md
sed -i 's|](/mlir-pdll-lsp-server/|](https://mlir.llvm.org/mlir-pdll-lsp-server/|g' README.md
sed -i 's|](/tblgen-lsp-server/|](https://mlir.llvm.org/tblgen-lsp-server/|g' README.md
- name: Commit updated source
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add -- . ':!llvm_src/'
git commit -m "Integrate from LLVM at llvm/llvm-project@$(cd llvm_src/ && (git rev-parse HEAD | head -1) && cd ..)" -a || echo "Extension source is already up-to-date"
git push || 0
- name: Timestamp End
run: date