Skip to content

Commit

Permalink
ci: centos7 build and release
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy committed Jun 25, 2024
1 parent 3a333b9 commit aecaefd
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 59 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build-test-centos7-amd64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and Test on centos7 amd64

on: ["push", "pull_request"]

jobs:
build-and-test-centos7:
name: Build and Test on centos7 amd64
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
submodules: "true"

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Pull custom centos7 Docker image
run: |
docker pull kcllang/kcl-builder:centos7
# Use llvm7 to build kcl in centos7
- name: Release
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace -w /workspace \
kcllang/kcl-builder:centos7 \
/bin/bash -c "source ~/.bash_profile && export PATH=$PATH:/opt/build/bin/ && sed -i 's/llvm12/llvm7/g' kclvm/compiler/Cargo.toml && make && make release"
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: kcl-centos7-amd64
path: _build/dist/centos/kclvm
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Build and Test on Linux ARCH64

on:
push:
branches:
- main
pull_request:
branches:
- main
on: ["push", "pull_request"]

jobs:
build-and-test-arm64:
Expand All @@ -17,33 +11,15 @@ jobs:
uses: actions/checkout@v3
with:
submodules: "true"

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21

- name: Install prerequisites
run: |
sudo apt-get update
sudo apt-get install -y git wget curl make python3 python3-pip clang-12 lld-12
sudo ln -sf /usr/bin/clang-12 /usr/bin/clang

- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.76
override: true
components: clippy, rustfmt

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Pull custom ARM64 Docker image
run: |
docker pull --platform linux/arm64 kcllang/kcl-builder-arm64
Expand Down
3 changes: 0 additions & 3 deletions kclvm/compiler/src/codegen/llvm/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use indexmap::{IndexMap, IndexSet};
use inkwell::basic_block::BasicBlock;
use inkwell::builder::Builder;
use inkwell::context::Context;
use inkwell::debug_info::{DICompileUnit, DebugInfoBuilder};
use inkwell::memory_buffer::MemoryBuffer;
use inkwell::module::{Linkage, Module};
use inkwell::support::LLVMString;
Expand Down Expand Up @@ -137,8 +136,6 @@ pub struct LLVMCodeGenContext<'ctx> {
/// LLVM module with debug info builder and compile unit.
pub struct DebugModule<'ctx> {
pub inner: Module<'ctx>,
pub dibuilder: DebugInfoBuilder<'ctx>,
pub compile_unit: DICompileUnit<'ctx>,
}

impl<'ctx> CodeGenObject for BasicValueEnum<'ctx> {}
Expand Down
30 changes: 1 addition & 29 deletions kclvm/compiler/src/codegen/llvm/metadata.rs
Original file line number Diff line number Diff line change
@@ -1,38 +1,10 @@
// Copyright The KCL Authors. All rights reserved.

use super::context::{DebugModule, LLVMCodeGenContext};
use crate::codegen::traits::ProgramCodeGen;
use inkwell::module::Module;

impl<'ctx> LLVMCodeGenContext<'ctx> {
pub(crate) fn create_debug_module(&self, module: Module<'ctx>) -> DebugModule<'ctx> {
let (dibuilder, compile_unit) = module.create_debug_info_builder(
true,
/* language */ inkwell::debug_info::DWARFSourceLanguage::C,
/* filename */ &self.current_pkgpath(),
/* directory */ ".",
/* producer */ "kcl",
/* is_optimized */ false,
/* compiler command line flags */ "",
/* runtime_ver */ 0,
/* split_name */ "",
/* kind */ inkwell::debug_info::DWARFEmissionKind::Full,
/* dwo_id */ 0,
/* split_debug_inling */ false,
/* debug_info_for_profiling */ false,
/* sys_root */ ".",
"",
);
let debug_metadata_version = self.context.i32_type().const_int(3, false);
module.add_basic_value_flag(
"Debug Info Version",
inkwell::module::FlagBehavior::Warning,
debug_metadata_version,
);
DebugModule {
inner: module,
dibuilder,
compile_unit,
}
DebugModule { inner: module }
}
}

0 comments on commit aecaefd

Please sign in to comment.