Skip to content

Commit

Permalink
Assign eQuantum
Browse files Browse the repository at this point in the history
  • Loading branch information
eq19 committed Sep 10, 2024
1 parent dcb7b89 commit 877bd8e
Show file tree
Hide file tree
Showing 53 changed files with 4,388 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
- name: 📂 Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
token: ${{ secrets.ACCESS_TOKEN }}

- name: ⚙️ Build Maps
Expand Down Expand Up @@ -103,6 +104,7 @@ jobs:
- name: 📂 Checkout
uses: actions/checkout@v4
with:
repository: eq19/eq19
token: ${{ secrets.ACCESS_TOKEN }}

- name: 🕸️ Parsering
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/reserves/llvm-project/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Github action workflows should be stored in this directory.
112 changes: 112 additions & 0 deletions .github/workflows/reserves/llvm-project/build-ci-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Build CI Container

permissions:
contents: read

on:
push:
branches:
- main
paths:
- .github/workflows/build-ci-container.yml
- '.github/workflows/containers/github-action-ci/**'
pull_request:
branches:
- main
paths:
- .github/workflows/build-ci-container.yml
- '.github/workflows/containers/github-action-ci/**'

jobs:
# TODO(boomanaiden154): Switch this back to a single stage build when we can
# run this on the self-hosted runners and don't have to do it this way to
# avoid timeouts.
build-ci-container-stage1:
if: github.repository_owner == 'llvm'
runs-on: ubuntu-latest
steps:
- name: Checkout LLVM
uses: actions/checkout@v4
with:
sparse-checkout: .github/workflows/containers/github-action-ci/
- name: Change podman Root Direcotry
run: |
mkdir -p ~/.config/containers
sudo mkdir -p /mnt/podman
sudo chown `whoami`:`whoami` /mnt/podman
cp ./.github/workflows/containers/github-action-ci/storage.conf ~/.config/containers/storage.conf
podman info
- name: Build container stage1
working-directory: ./.github/workflows/containers/github-action-ci/
run: |
podman build -t stage1-toolchain --target stage1-toolchain -f stage1.Dockerfile .
- name: Save container image
run: |
podman save stage1-toolchain > stage1-toolchain.tar
- name: Upload container image
uses: actions/upload-artifact@v4
with:
name: stage1-toolchain
path: stage1-toolchain.tar
retention-days: 1
build-ci-container-stage2:
if: github.repository_owner == 'llvm'
runs-on: ubuntu-latest
needs: build-ci-container-stage1
permissions:
packages: write
steps:
- name: Write Variables
id: vars
run: |
tag=`date +%s`
container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/ci-ubuntu-22.04"
echo "container-name=$container_name" >> $GITHUB_OUTPUT
echo "container-name-tag=$container_name:$tag" >> $GITHUB_OUTPUT
- name: Checkout LLVM
uses: actions/checkout@v4
with:
sparse-checkout: .github/workflows/containers/github-action-ci/

- name: Change podman Root Direcotry
run: |
mkdir -p ~/.config/containers
sudo mkdir -p /mnt/podman
sudo chown `whoami`:`whoami` /mnt/podman
cp ./.github/workflows/containers/github-action-ci/storage.conf ~/.config/containers/storage.conf
podman info
# Download the container image into /mnt/podman rather than
# $GITHUB_WORKSPACE to avoid space limitations on the default drive
# and use the permissions setup for /mnt/podman.
- name: Download stage1-toolchain
uses: actions/download-artifact@v4
with:
name: stage1-toolchain
path: /mnt/podman

- name: Load stage1-toolchain
run: |
podman load -i /mnt/podman/stage1-toolchain.tar
- name: Build Container
working-directory: ./.github/workflows/containers/github-action-ci/
run: |
podman build -t ${{ steps.vars.outputs.container-name-tag }} -f stage2.Dockerfile .
podman tag ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}:latest
- name: Test Container
run: |
for image in ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}; do
podman run --rm -it $image /usr/bin/bash -x -c 'printf '\''#include <iostream>\nint main(int argc, char **argv) { std::cout << "Hello\\n"; }'\'' | clang++ -x c++ - && ./a.out | grep Hello'
done
- name: Push Container
if: github.event_name == 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
podman login -u ${{ github.actor }} -p $GITHUB_TOKEN ghcr.io
podman push ${{ steps.vars.outputs.container-name-tag }}
podman push ${{ steps.vars.outputs.container-name }}:latest
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import json
import multiprocessing
import os
import re
import subprocess
import sys


def run_analyzer(data):
os.chdir(data["directory"])
command = (
data["command"]
+ f" --analyze --analyzer-output html -o analyzer-results -Xclang -analyzer-config -Xclang max-nodes=75000"
)
print(command)
subprocess.run(command, shell=True, check=True)


def pool_error(e):
print("Error analyzing file:", e)


def main():
db_path = sys.argv[1]
database = json.load(open(db_path))

with multiprocessing.Pool() as pool:
pool.map_async(run_analyzer, [k for k in database], error_callback=pool_error)
pool.close()
pool.join()


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Post-Commit Static Analyzer

permissions:
contents: read

on:
push:
branches:
- 'release/**'
paths:
- 'clang/**'
- 'llvm/**'
- '.github/workflows/ci-post-commit-analyzer.yml'
pull_request:
types:
- opened
- synchronize
- reopened
- closed
paths:
- '.github/workflows/ci-post-commit-analyzer.yml'
- '.github/workflows/ci-post-commit-analyzer-run.py'
schedule:
- cron: '30 0 * * *'

concurrency:
group: >-
llvm-project-${{ github.workflow }}-${{ github.event_name == 'pull_request' &&
( github.event.pull_request.number || github.ref) }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
post-commit-analyzer:
if: >-
github.repository_owner == 'llvm' &&
github.event.action != 'closed'
runs-on: ubuntu-22.04
container:
image: 'ghcr.io/llvm/ci-ubuntu-22.04:latest'
env:
LLVM_VERSION: 18
steps:
- name: Checkout Source
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
# A full build of llvm, clang, lld, and lldb takes about 250MB
# of ccache space. There's not much reason to have more than this,
# because we usually won't need to save cache entries from older
# builds. Also, there is an overall 10GB cache limit, and each
# run creates a new cache entry so we want to ensure that we have
# enough cache space for all the tests to run at once and still
# fit under the 10 GB limit.
# Default to 2G to workaround: https://github.com/hendrikmuhs/ccache-action/issues/174
max-size: 2G
key: post-commit-analyzer
variant: sccache

- name: Configure
run: |
cmake -B build -S llvm -G Ninja \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_PROJECTS=clang \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DLLVM_INCLUDE_TESTS=OFF \
-DCLANG_INCLUDE_TESTS=OFF \
-DCMAKE_BUILD_TYPE=Release
- name: Build
run: |
# FIXME: We need to build all the generated header files in order to be able to run
# the analyzer on every file. Building libLLVM and libclang is probably overkill for
# this, but it's better than building every target.
ninja -v -C build libLLVM.so libclang.so
# Run the analyzer.
python3 .github/workflows/ci-post-commit-analyzer-run.py build/compile_commands.json
scan-build --generate-index-only build/analyzer-results
- name: Upload Results
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
if: always()
with:
name: analyzer-results
path: 'build/analyzer-results/*'

38 changes: 38 additions & 0 deletions .github/workflows/reserves/llvm-project/clang-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Clang Tests

permissions:
contents: read

on:
workflow_dispatch:
push:
branches:
- 'release/**'
paths:
- 'clang/**'
- '.github/workflows/clang-tests.yml'
- '.github/workflows/llvm-project-tests.yml'
- '!llvm/**'
pull_request:
branches:
- 'release/**'
paths:
- 'clang/**'
- '.github/workflows/clang-tests.yml'
- '.github/workflows/llvm-project-tests.yml'
- '!llvm/**'

concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
check_clang:
if: github.repository_owner == 'llvm'
name: Test clang,lldb,libclc
uses: ./.github/workflows/llvm-project-tests.yml
with:
build_target: check-clang
projects: clang;lldb;libclc
Loading

0 comments on commit 877bd8e

Please sign in to comment.