Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a comment on a not strictly necessary grammar rule #3016

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
Merge branch 'master' into comment-on-grammar-transition-not-needed-i…
…n-spec
  • Loading branch information
jafingerhut committed Aug 20, 2023
commit 451819242fead0edbc118c6162f93ae3f411d635
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build --action_env=BAZEL_CXXOPTS="-std=c++17"
File renamed without changes.
37 changes: 37 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# SPDX-License-Identifier: GPL-2.0
#
# clang-format configuration file. Intended for clang-format >= 4.
#
# For more information, see:
#
# Documentation/process/clang-format.rst
# https://clang.llvm.org/docs/ClangFormat.html
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
#
---
BasedOnStyle: Google
IndentWidth: 4
FixNamespaceComments: true
ColumnLimit: 100
SpacesBeforeTrailingComments: 2
AccessModifierOffset: -3

IncludeBlocks: Regroup
# Force pointers to the type for C++.
DerivePointerAlignment: false
PointerAlignment: Right
Standard: c++17
IncludeCategories:
# Matches common headers first and sorts them before project includes
- Regex: '^<.+/.*\.h>'
Priority: 2000
- Regex: '^<.+/.*>'
Priority: 4000
- Regex: '^<.*\.h>'
Priority: 1000
- Regex: '^<.*>'
Priority: 3000
- Regex: 'testgen/.*'
Priority: 6000
- Regex: '.*'
Priority: 5000
38 changes: 38 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
Checks:
'clang-diagnostic-*,
clang-analyzer-*,
modernize-*,
performance-*,
readability-*,
bugprone-*,
cppcoreguidelines-*,
boost-*,
hicpp-*,
misc-*,
llvm-*,
google-*,
-modernize-use-trailing-return-type,
-readability-identifier-length,
-cppcoreguidelines-owning-memory,
-bugprone-easily-swappable-parameters,
-llvm-header-guard,
-misc-no-recursion'
FormatStyle: file
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
UseColor: true
CheckOptions:
- { key: misc-const-correctness.AnalyzeValues, value: false }
- { key: readability-identifier-naming.NamespaceCase, value: CamelCase }
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
- { key: readability-identifier-naming.VariableCase, value: camelBack }
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.StaticVariableCase, value: UPPER_CASE }
ExtraArgs:
- '--std=c++17'
...
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
**/Dockerfile
**/*.md

build
docs
11 changes: 11 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Run this command to always ignore formatting commits in `git blame`
# git config blame.ignoreRevsFile .git-blame-ignore-revs
# Source: https://www.stefanjudis.com/today-i-learned/how-to-exclude-commits-from-git-blame/
# clang-format first PR.
e26a49dbf5749ee92585cec9e95ca781d377ebfd
# clang-format ir and lib folder.
7a722a3fb8205c57d7e9554fc7c62c2629720d5a
# Switched from left to right pointer alignment.
f1181a071844f759b618ed3c894cf56e2df1dd05
# Added a Python formatter.
8947d5ec2c12157d29a2d07ad25cf0245a5792a5
11 changes: 4 additions & 7 deletions .github/.travis.yml.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ cache:
env:
- CTEST_PARALLEL_LEVEL=4
UNIFIED=ON
ENABLE_GMP=ON
- CTEST_PARALLEL_LEVEL=4
UNIFIED=OFF
ENABLE_GMP=ON
- CTEST_PARALLEL_LEVEL=4
UNIFIED=ON
ENABLE_GMP=OFF

before_install:
- tools/install_os_deps.sh
Expand All @@ -40,8 +37,8 @@ install:
# To flush out issues with unified vs. non-unified builds, do a non-unified
# build before continuing with the rest, which produces a unified build.
# This is done here on MacOS; for Linux, this is done in Dockerfile.
- if [[ $TRAVIS_OS_NAME == 'linux' ]] ; then docker build --network ccache_network -t p4c --build-arg IMAGE_TYPE=test --build-arg ENABLE_UNIFIED_COMPILATION=$UNIFIED --build-arg ENABLE_GMP=$ENABLE_GMP . ; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]] ; then ./bootstrap.sh -DCMAKE_BUILD_TYPE=RELEASE -DENABLE_UNIFIED_COMPILATION=$UNIFIED -DENABLE_GMP=$ENABLE_GMP && cd build && make -j2; fi
- if [[ $TRAVIS_OS_NAME == 'linux' ]] ; then docker build --network ccache_network -t p4c --build-arg IMAGE_TYPE=test --build-arg ENABLE_UNIFIED_COMPILATION=$UNIFIED . ; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]] ; then ./bootstrap.sh -DCMAKE_BUILD_TYPE=RELEASE -DENABLE_UNIFIED_COMPILATION=$UNIFIED && cd build && make -j2; fi

script:
# run with sudo (...) --privileged so that we can create network namespaces for the ebpf tests
Expand All @@ -57,6 +54,6 @@ jobs:
os: linux
install:
- tools/start_ccache
- docker build --network ccache_network -t p4c --build-arg IMAGE_TYPE=test --build-arg ENABLE_UNIFIED_COMPILATION=$UNIFIED --build-arg ENABLE_GMP=$ENABLE_GMP --build-arg VALIDATION=ON . || { echo "Building Gauntlet failed." ; travis_terminate 0; }
- docker build --network ccache_network -t p4c --build-arg IMAGE_TYPE=test --build-arg ENABLE_UNIFIED_COMPILATION=$UNIFIED --build-arg VALIDATION=ON . || { echo "Building Gauntlet failed." ; travis_terminate 0; }
script:
- docker run -w /gauntlet p4c python3.6 -m pytest test.py -vrf -k "test_p4c" -n $CTEST_PARALLEL_LEVEL --suppress-crashes
- docker run -w /gauntlet p4c python3 -m pytest test.py -vrf -k "test_p4c" -n $CTEST_PARALLEL_LEVEL --suppress-crashes
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# The P4Tools repository is owned by the following maintainers.
backends/p4tools @fruffy @pkotikal @jnfoster

87 changes: 87 additions & 0 deletions .github/workflows/ci-auto-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Automated Release

on:
schedule:
- cron: '0 12 1 * *' # At 12:00 on day-of-month 1

jobs:
build:
runs-on: ubuntu-latest
# Check if the event is not triggered by a fork
if: ${{ github.repository == 'p4lang/p4c' && github.ref == 'refs/heads/main' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Fetch all history for all branches and tags
fetch-depth: 0

- name: Increment version number
run: perl -i -pe 's/\b(\d+)(?=\D*$)/$1+1/e' Version.txt

- name: Get changelog
id: changelog
run: |
TAG="$(git describe --tags --abbrev=0)"
GIT_LOG="$(git log $TAG..HEAD --oneline --pretty=format:"- %s [%an]")"
CHANGELOG=$(cat << EOF
Changelog:
$GIT_LOG
EOF
)
CHANGELOG="${CHANGELOG//'%'/'%25'}"
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
CHANGELOG="${CHANGELOG//'#'/''}"
echo "::set-output name=content::$CHANGELOG"

- name: Display changelog
run: echo "${{ steps.changelog.outputs.content }}"

- name: Get version
run: |
VERSION="$(cat Version.txt)"
echo "VERSION=$VERSION" >> $GITHUB_ENV

- name: Get commit message
id: message
run: |
COMMIT_MSG=$(cat << EOF
Release v${{ env.VERSION }}

${{ steps.changelog.outputs.content }}
EOF
)
COMMIT_MSG="${COMMIT_MSG//'%'/'%25'}"
COMMIT_MSG="${COMMIT_MSG//$'\n'/'%0A'}"
COMMIT_MSG="${COMMIT_MSG//$'\r'/'%0D'}"
echo "::set-output name=content::$COMMIT_MSG"

- name: Get pull request body message
id: body
run: |
MSG=$(cat << EOF
Auto-generated pull request for version ${{ env.VERSION }}.

Please use **Squash and merge** to include the changelog in the release message.

${{ steps.changelog.outputs.content }}
EOF
)
MSG="${MSG//'%'/'%25'}"
MSG="${MSG//$'\n'/'%0A'}"
MSG="${MSG//$'\r'/'%0D'}"
echo "::set-output name=content::$MSG"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
base: main
add-paths: Version.txt
reviewers: mbudiu-vmw
commit-message: ${{ steps.message.outputs.content }}
signoff: false
branch: v${{ env.VERSION }}
delete-branch: true
title: Automated Release v${{ env.VERSION }}
body: ${{ steps.body.outputs.content }}
17 changes: 11 additions & 6 deletions .github/workflows/ci-bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ on:
pull_request:
branches: [ main ]

# Cancel any preceding run on the pull request.
concurrency:
group: bazel-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build_direct: # Build p4c directly.
runs-on: ubuntu-latest
env:
BAZEL: bazelisk-linux-amd64
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

Expand All @@ -33,8 +38,8 @@ jobs:
chmod +x $BAZEL
sudo mv $BAZEL /usr/local/bin/bazel

- name: Install Flex, Bison, and GMP
run: sudo apt-get update && sudo apt-get install bison flex libfl-dev libgmp-dev
- name: Install Flex and Bison
run: sudo apt-get update && sudo apt-get install bison flex libfl-dev

- name: Build p4c
run: bazel build //... --verbose_failures --distinct_host_configuration=false
Expand All @@ -44,7 +49,7 @@ jobs:
env:
BAZEL: bazelisk-linux-amd64
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

Expand All @@ -65,8 +70,8 @@ jobs:
chmod +x $BAZEL
sudo mv $BAZEL /usr/local/bin/bazel

- name: Install Flex, Bison, and GMP
run: sudo apt-get update && sudo apt-get install bison flex libfl-dev libgmp-dev
- name: Install Flex and Bison
run: sudo apt-get update && sudo apt-get install bison flex libfl-dev

- name: Build bazel/example
run: cd ./bazel/example && bazel build //... --verbose_failures --distinct_host_configuration=false
49 changes: 33 additions & 16 deletions .github/workflows/ci-container-image.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
name: Build and push latest image to container registry
name: container-image

# This job should ideally also execute when the base image (p4lang/pi) is updated
on:
push:
branches:
- main
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
# Ideally, we would update the image every time the base image
# (p4lang/behavioral-model) is updated, this is good enough.
# "At minute 15 past every 4th hour from midnight through 23."
- cron: '15 0-23/4 * * *'

# Cancel any preceding run on the pull request.
concurrency:
group: container-image-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build:
if: ${{ github.repository == 'p4lang/p4c' && github.event_name == 'push' }}
if: ${{ github.repository == 'p4lang/p4c' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Determine Docker image tag
Expand All @@ -22,16 +32,23 @@ jobs:
if [[ "$GITHUB_REF" =~ "main" ]]; then
TAG="latest"
else
echo "Invalid Github ref $GITHUB_REF"
exit 1
TAG=${GITHUB_REF////_}
fi
echo "Tag is $TAG"
echo "::set-output name=tag::$TAG"
- name: Build and push container image to registry
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker build -t p4lang/p4c:${{ steps.get-tag.outputs.tag }} .
docker push p4lang/p4c:${{ steps.get-tag.outputs.tag }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image to registry
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: p4lang/p4c:${{ steps.get-tag.outputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.