Skip to content

[wip] add eudsl-tblgen #9

[wip] add eudsl-tblgen

[wip] add eudsl-tblgen #9

Workflow file for this run

name: "Test"
on:
workflow_dispatch:
inputs:
force_debug_with_tmate:
type: boolean
description: 'Run the build with tmate session'
required: false
default: false
debug_with_tmate:
type: boolean
description: 'Run the build with a tmate session ONLY in case of failure'
required: false
default: false
pull_request:
merge_group:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true
jobs:
test-eudsl-tblgen:
strategy:
fail-fast: false
matrix:
include:
- name: "manylinux_x86_64"
runs-on: "ubuntu-22.04"
- name: "windows_x86_64"
runs-on: "windows-2019"
- name: "macos_arm64"
runs-on: "macos-14"
- name: "macos_x86_64"
runs-on: "macos-13"
runs-on: ${{ matrix.runs-on }}
name: ${{ matrix.name }}
defaults:
run:
shell: bash
permissions:
id-token: write
contents: write
env:
# either the PR number or `branch-N` where N always increments
CACHE_KEY: test_${{ matrix.name }}_clang_${{ format('{0}-{1}', github.ref_name, github.run_number) }}
steps:
- name: "Set unified TZ"
uses: szenius/[email protected]
with:
# this is an arbitrary choice
timezoneLinux: "Asia/Singapore"
timezoneMacos: "Asia/Singapore"
timezoneWindows: "Singapore Standard Time"
- name: "Canonicalize cache dir"
id: canonicalize-cache-dir
run: |
if [[ "${{ matrix.runs-on }}" == ubuntu* ]]; then
echo "CACHE_DIR=/tmp/.container-cache" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.runs-on }}" == macos* ]]; then
echo "CACHE_DIR=/tmp/.container-cache" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.runs-on }}" == windows* ]]; then
echo "CACHE_DIR=D:\a\.container-cache" >> $GITHUB_OUTPUT
fi
- name: "Restore cache"
uses: actions/cache/restore@v3
with:
path: ${{ steps.canonicalize-cache-dir.outputs.CACHE_DIR }}
key: ${{ env.CACHE_KEY }}
restore-keys: test_${{ matrix.name }}_clang
- name: "Check out repository"
uses: actions/[email protected]
with:
submodules: false
- name: "Install OS deps"
run: |
if [[ "${{ matrix.runs-on }}" == macos* ]]; then
brew install ccache ninja curl
fi
- name: "Install Python"
uses: actions/setup-python@v4
if: ${{ startsWith(matrix.runs-on, 'macos') || startsWith(matrix.runs-on, 'windows') }}
with:
python-version: '3.12'
- name: "Setup compiler/toolchain"
uses: aminya/setup-cpp@v1
if: ${{ startsWith(matrix.runs-on, 'ubuntu') || startsWith(matrix.runs-on, 'windows') }}
with:
compiler: llvm-18
cmake: true
ninja: true
ccache: true
vcvarsall: ${{ startsWith(matrix.runs-on, 'windows') }}
- name: "Set CC/CXX"
run: |
if [[ "${{ matrix.runs-on }}" == ubuntu* ]]; then
echo "CC=/github/home/llvm/bin/clang" >> $GITHUB_ENV
echo "CXX=/github/home/llvm/bin/clang++" >> $GITHUB_ENV
elif [[ "${{ matrix.runs-on }}" == windows* ]]; then
echo "CC=/C/Users/runneradmin/llvm/bin/clang-cl.exe" >> $GITHUB_ENV
echo "CXX=/C/Users/runneradmin/llvm/bin/clang-cl.exe" >> $GITHUB_ENV
elif [[ "${{ matrix.runs-on }}" == macos* ]]; then
echo "CC=/usr/bin/clang" >> $GITHUB_ENV
echo "CXX=/usr/bin/clang++" >> $GITHUB_ENV
fi
- name: "Python deps"
run: |
python3_command=""
if (command -v python3.12 &> /dev/null); then
python3_command="python3.12"
elif (command -v python3 &> /dev/null); then
python3_command="python3"
elif (command -v python &> /dev/null); then
python3_command="python"
fi
echo "Python3_EXECUTABLE=$(which $python3_command)" >> $GITHUB_ENV
- name: "Download MLIR"
env:
GH_TOKEN: ${{ github.token }}
run: |
export RELEASE_PREFIX="mlir_${{ matrix.name }}"
RELEASE_URL=$(gh release view latest --json assets -q '.assets |= sort_by(.createdAt) | .assets | map(select(.name | contains(env.RELEASE_PREFIX))) | .[-1] | .url')
curl -svLO $RELEASE_URL
ls -lah
# - name: "Build eudsl-tblgen"
# id: build
# run: |
# export CCACHE_DIR="${{ steps.canonicalize-cache-dir.outputs.CACHE_DIR }}/ccache"
# export CCACHE_COMPILERCHECK="string:$($CC --version)"
# export CCACHE_MAXSIZE=700M
# export CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros
# export CCACHE_CPP2=true
# export CCACHE_UMASK=002
#
# export CMAKE_C_COMPILER_LAUNCHER=ccache
# export CMAKE_CXX_COMPILER_LAUNCHER=ccache
# export CMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld"
# export CMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld"
# export CMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld"
# export Python3_EXECUTABLE="$Python3_EXECUTABLE"
#
# export LLVM_SOURCE_DIR="$PWD/third_party/llvm-project"
# export LLVM_BUILD_DIR="$PWD/llvm-build"
# # double nested so that upload artifacts uploads a folder
# export LLVM_INSTALL_DIR="$PWD/llvm-install/llvm-install"
#
# ccache -z
# build_tools/cmake/build_llvm.sh
# ccache -s
#
# echo "*********************** SMOKE TEST *********************************"
# "$LLVM_INSTALL_DIR/bin/mlir-tblgen" --version
# echo "*********************** SMOKE TEST *********************************"
#
# pushd $LLVM_SOURCE_DIR && LLVM_SHA_SHORT=$(git rev-parse --short HEAD) && popd
# tar -czf mlir_${{ matrix.name }}_$LLVM_SHA_SHORT.tar.gz -C "$LLVM_INSTALL_DIR/.." llvm-install
# rm -rf "$LLVM_BUILD_DIR" "$LLVM_SOURCE_DIR"
#
# - name: Upload artifacts
# uses: actions/upload-artifact@v4
# if: ${{ !cancelled() }}
# with:
# name: mlir_${{ matrix.name }}_artifact
# path: llvm-install
# if-no-files-found: warn
#
# - name: Release current commit
# if: ${{ !cancelled() && github.event_name == 'push' && github.ref_name == 'main' }}
# uses: ncipollo/[email protected]
# with:
# artifacts: "*.tar.gz"
# token: "${{ secrets.GITHUB_TOKEN }}"
# tag: "latest"
# name: "latest"
# removeArtifacts: false
# allowUpdates: true
# replacesArtifacts: true
# makeLatest: true
#
# - name: "Save cache"
# uses: actions/cache/save@v3
# if: ${{ !cancelled() && github.event_name == 'push' && github.ref_name == 'main' }}
# with:
# path: ${{ steps.canonicalize-cache-dir.outputs.CACHE_DIR }}
# key: ${{ env.CACHE_KEY }}
#
# - name: "Setup tmate session"
# if: ${{ (failure() && inputs.debug_with_tmate) || inputs.force_debug_with_tmate }}
# uses: mxschmitt/[email protected]
# with:
# limit-access-to-actor: true
# install-dependencies: ${{ startsWith(matrix.runs-on, 'macos') || startsWith(matrix.runs-on, 'windows') }}