Skip to content

Commit

Permalink
Merge pull request #1485 from firesim/main
Browse files Browse the repository at this point in the history
Bump `stable` branch
  • Loading branch information
abejgonzalez committed Mar 24, 2023
2 parents f33e1f2 + df095fb commit 3d24a60
Show file tree
Hide file tree
Showing 564 changed files with 20,369 additions and 14,284 deletions.
75 changes: 75 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
Checks: >
-*,
clang-diagnostic-*,
misc-*,
-misc-const-correctness,
-misc-unused-parameters,
-misc-non-private-member-variables-in-classes,
bugprone-argument-comment,
bugprone-assert-side-effect,
bugprone-branch-clone,
bugprone-copy-constructor-init,
bugprone-dangling-handle,
bugprone-dynamic-static-initializers,
bugprone-macro-parentheses,
bugprone-macro-repeated-side-effects,
bugprone-misplaced-widening-cast,
bugprone-move-forwarding-reference,
bugprone-multiple-statement-macro,
bugprone-suspicious-semicolon,
bugprone-swapped-arguments,
bugprone-terminating-continue,
bugprone-unused-raii,
bugprone-unused-return-value,
modernize-use-bool-literals,
modernize-loop-convert,
modernize-make-unique,
modernize-raw-string-literal,
modernize-use-equals-default,
modernize-use-default-member-init,
modernize-use-emplace,
modernize-use-nullptr,
modernize-use-override,
modernize-use-using,
performance-for-range-copy,
performance-implicit-conversion-in-loop,
performance-inefficient-algorithm,
performance-inefficient-vector-operation,
performance-no-automatic-move,
performance-trivially-destructible,
performance-move-const-arg,
performance-unnecessary-copy-initialization,
performance-unnecessary-value-param,
#readability-identifier-naming,
readability-avoid-const-params-in-decls,
readability-const-return-type,
readability-inconsistent-declaration-parameter-name,
readability-container-size-empty,
readability-misleading-indentation,
readability-redundant-control-flow,
readability-redundant-smartptr-get,
readability-simplify-boolean-expr,
readability-simplify-subscript-expr,
readability-use-anyofallof
WarningsAsErrors: '*'
CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.FunctionCase
value: camelBack
- key: readability-identifier-naming.MemberCase
value: camelBack
- key: readability-identifier-naming.ParameterCase
value: camelBack
- key: readability-identifier-naming.UnionCase
value: CamelCase
- key: readability-identifier-naming.VariableCase
value: camelBack
- key: readability-identifier-naming.IgnoreMainLikeFunctions
value: 1
- key: readability-redundant-member-init.IgnoreBaseInCopyConstructors
value: 1
- key: modernize-use-default-member-init.UseAssignment
value: 1
17 changes: 16 additions & 1 deletion .github/CI_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,26 @@ Currently, the only way to access any running instance that is created from the

If the instance is stopped, then you must request a AWS IAM user account from the FireSim developers to access the EC2 console and restart the instance.

Prior CI Jobs for Pull Requests
------------------------------

The default behavior is that a new commit to a PR will cancel any existing workflows that are still running. This is to save resources and is done by the `cancel-prior-workflows` job. If you wish to
allow all prior workflows to keep running, add the `ci:persist-prior-workflows` tag to your PR. Please use this tag sparingly, and with caution.

GitHub Secrets
--------------
* **AWS_ACCESS_KEY_ID**: Passed to `aws configure` on CI containers + manager instances
* **AWS_DEFAULT_REGION**: Passed to `aws configure` on CI containers + manager instances
* **AWS_SECRET_ACCESS_KEY**: Passed to `aws configure` on CI containers + manager instances
* **FIRESIM_PEM**: Used by the manager on CI manager instances
* **AZURE_CLIENT_ID**: Used to manage Azure resources
* **AZURE_CLIENT_SECRET**: Used to manage Azure resources
* **AZURE_TENANT_ID**: Used to manage Azure resources
* **AZURE_SUBSCRIPTION_ID**: Subscription ID of Azure account to run CI on
* **AZURE_DEFAULT_REGION**: Used to setup Azure region
* **AZURE_RESOURCE_GROUP**: Resource group Azure is running in
* **AZURE_CI_SUBNET_ID**: Subnet used by Azure VMs running CI
* **AZURE_CI_NSG_ID**: Network Security Group used by Azure VMs running CI
* **FIRESIM_PEM**: Used by the manager on CI manager instances and VMs
* **FIRESIM_PEM_PUBLIC**: Public key of the above secret, used to setup the key in Azure
* **FIRESIM_REPO_DEP_KEY**: Used to push scala doc to GH pages
* **GH_A_PERSONAL_ACCESS_TOKEN**: Used to dynamically register and deregister GitHub Actions runners. See `https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token`, and enable the `workflow` (Update GitHub Action workflows) setting.
4 changes: 3 additions & 1 deletion .github/actions/build-scala-doc/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ runs:
using: "composite"
steps:
- run: |
cat env.sh
source env.sh
make -C sim scaladoc
which conda
source env.sh && make -C sim scaladoc
shell: bash
8 changes: 3 additions & 5 deletions .github/actions/buildsetup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ runs:
source /etc/profile.d/conda.sh
./build-setup.sh --skip-validate
# All actions that run in a GH-hosted container source env.sh before
# running their jobs. This just ensures these actions bring in the conda
# environment too, which is a prereq for doing any meaningful work.
# This source must run before any "conda activate" step, thus it is prepended
# to the env.sh file that is generated (which includes an "activate" call).
sed -i "1s;^;source /etc/profile.d/conda.sh\n;" env.sh
# running their jobs. This ensures conda is in the runner's path, which
# is not the case by default.
sed -i "1s;^;export PATH=$PATH:/opt/conda/condabin\n;" env.sh
shell: bash
15 changes: 9 additions & 6 deletions .github/actions/change-workflow-instance-states/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ inputs:
github-token:
description: "Personal Access Token on GitHub with workflow access"
required: true
platform:
description: "The platform on which CI is running."
default: 'aws'

runs:
using: "composite"
steps:
- uses: aws-actions/configure-aws-credentials@v1
- uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ env.AWS-ACCESS-KEY-ID }}
aws-secret-access-key: ${{ env.AWS-SECRET-ACCESS-KEY }}
aws-region: ${{ env.AWS-DEFAULT-REGION }}
- run: .github/scripts/change-workflow-instance-states.py ${{ github.run_id }} ${{ inputs.new-state }} ${{ inputs.github-token }}
shell: bash
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- run: .github/scripts/change-workflow-instance-states.py ${{ inputs.platform }} ${{ github.run_id }} ${{ inputs.new-state }} ${{ inputs.github-token }}
shell: bash -el {0}
10 changes: 0 additions & 10 deletions .github/actions/install-ci-python-reqs/action.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/actions/job-start/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ runs:
restore-keys: ${{ github.run_id }}-${{ github.job }}
- name: Set run_result to default or use cached value
id: run_result
run: echo "::set-output name=run_result::$(cat run_result 2>/dev/null || echo 'default')"
run: echo "run_result=$(cat run_result 2>/dev/null || echo 'default')" >> $GITHUB_OUTPUT
shell: bash
9 changes: 4 additions & 5 deletions .github/actions/repo-setup-aws/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ description: "Runs all baseline setup to interact with a AWS-hosted manager inst
runs:
using: "composite"
steps:
- uses: aws-actions/configure-aws-credentials@v1
- uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ env.AWS-ACCESS-KEY-ID }}
aws-secret-access-key: ${{ env.AWS-SECRET-ACCESS-KEY }}
aws-region: ${{ env.AWS-DEFAULT-REGION }}
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ env.FIRESIM_PEM }}
known_hosts: unnecessary
- uses: ./.github/actions/install-ci-python-reqs
1 change: 0 additions & 1 deletion .github/actions/repo-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ runs:
steps:
- uses: ./.github/actions/machinelaunchscript
- uses: ./.github/actions/buildsetup
- uses: ./.github/actions/scala-build
5 changes: 4 additions & 1 deletion .github/actions/setup-workflow-monitor/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ inputs:
max-runtime-hours:
description: "Max runtime hours"
required: true
platform:
description: "The platform on which CI is running."
default: 'aws'

runs:
using: "composite"
steps:
- run: .github/scripts/setup-workflow-monitor.py ${{ inputs.max-runtime-hours }}
- run: .github/scripts/setup-workflow-monitor.py ${{ inputs.platform }} ${{ inputs.max-runtime-hours }}
shell: bash
2 changes: 1 addition & 1 deletion .github/scripts/build-default-workloads.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

from fabric.api import *
from fabric.api import prefix, settings, run, execute # type: ignore

from common import manager_fsim_dir, set_fabric_firesim_pem

Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/build-f1-driver.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

from fabric.api import *
from fabric.api import cd, prefix, run, execute # type: ignore

from common import manager_fsim_dir, set_fabric_firesim_pem

Expand Down
20 changes: 20 additions & 0 deletions .github/scripts/build-vitis-driver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python3

from fabric.api import prefix, run, execute # type: ignore

from ci_variables import ci_env

def build_vitis_driver():
"""Runs compilation of Vitis driver for the make-default tuple"""

# assumptions:
# - the firesim repo is already setup in a prior script
# - machine-launch-script requirements are already installed

with prefix(f"cd {ci_env['GITHUB_WORKSPACE']}"):
with prefix('source sourceme-f1-manager.sh --skip-ssh-setup'):
with prefix("cd ./sim"):
run("make PLATFORM=vitis vitis")

if __name__ == "__main__":
execute(build_vitis_driver, hosts=["localhost"])
17 changes: 13 additions & 4 deletions .github/scripts/change-workflow-instance-states.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,26 @@

import argparse

from common import change_workflow_instance_states
from platform_lib import Platform, get_platform_enum
from common import get_platform_lib

if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('tag_value',

platform_choices = [str(p) for p in Platform]
parser.add_argument('platform',
choices = platform_choices,
help = "The platform CI is being run on")
parser.add_argument('workflow_tag',
help = "The tag used to identify workflow instances.")
parser.add_argument('state_change',
choices = ['terminate', 'stop', 'start'],
help = "The state transition to initiate on workflow instances.")
parser.add_argument('github_api_token',
help = "API token to modify self-hosted runner state.")

args = parser.parse_args()
change_workflow_instance_states(args.github_api_token, args.tag_value, args.state_change)
platform = get_platform_enum(args.platform)
if platform == Platform.AWS or platform == Platform.ALL:
get_platform_lib(Platform.AWS).change_workflow_instance_states(args.github_api_token, args.workflow_tag, args.state_change)
if platform == Platform.AZURE or platform == Platform.ALL:
get_platform_lib(Platform.AZURE).change_workflow_instance_states(args.github_api_token, args.workflow_tag, args.state_change)
2 changes: 1 addition & 1 deletion .github/scripts/check-docs-generated-components.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

from fabric.api import *
from fabric.api import cd, prefix, run, execute # type: ignore

from common import manager_fsim_dir, set_fabric_firesim_pem

Expand Down
28 changes: 28 additions & 0 deletions .github/scripts/check-vitis-docs-generated-components.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python3

import sys
from fabric.api import prefix, run, settings, execute # type: ignore

from ci_variables import ci_env

def run_docs_generated_components_check():
""" Runs checks to make sure generated components of vitis docs have been
updated. """

# assumptions:
# - machine-launch-script requirements are already installed
# - XILINX_VITIS, XILINX_XRT, XILINX_VIVADO are setup (in env / LD_LIBRARY_PATH / path / etc)

# repo should already be checked out

with prefix(f"cd {ci_env['GITHUB_WORKSPACE']}"):
run("./build-setup.sh --skip-validate")
with prefix('source sourceme-f1-manager.sh --skip-ssh-setup'):
run("firesim managerinit --platform vitis")
with prefix("cd deploy"):
run("cat config_runtime.yaml")
run("cat ../docs/Running-OnPrem-Simulations-Tutorial/DOCS_EXAMPLE_config_runtime.yaml")
run("diff config_runtime.yaml ../docs/Running-OnPrem-Simulations-Tutorial/DOCS_EXAMPLE_config_runtime.yaml")

if __name__ == "__main__":
execute(run_docs_generated_components_check, hosts=["localhost"])

0 comments on commit 3d24a60

Please sign in to comment.