Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
  •  
  •  
  •  
8 changes: 7 additions & 1 deletion .github/workflows/macosci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ jobs:
- name: Build
run: dotnet build --configuration Release
- name: Test
run: dotnet test --configuration Release
run: dotnet test --configuration Release --blame-crash --blame-hang --blame-hang-timeout 300s --logger:"console;verbosity=detailed"
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: always() # This ensures it runs even after test failure
with:
name: test-results
path: Tst/UnitTests/TestResults/**/*.xml
128 changes: 102 additions & 26 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,109 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path

name: Maven Publish
name: Publish to Maven Central

on:
push:
branches: [ "maven-publish-**" ]
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., 0.4.1). Leave empty to use current P version from pom.xml'
required: false
type: string

jobs:
Maven-Publish-Ubuntu:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Publish to the Maven Central Repository
working-directory: Src/PRuntimes/PSymRuntime
run: mvn --batch-mode deploy -P release -Dmaven.test.skip
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Cache Maven dependencies
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Extract version from release
id: get_version
run: |
if [ "${{ github.event_name }}" = "release" ]; then
VERSION=${{ github.event.release.tag_name }}
# Remove 'v' prefix if present
VERSION=${VERSION#v}
else
VERSION=${{ github.event.inputs.version }}
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Publishing version: $VERSION"

- name: Update PEx version
run: |
cd Src/PEx
# Update the revision property in pom.xml
sed -i "s/<revision>.*<\/revision>/<revision>${{ steps.get_version.outputs.VERSION }}<\/revision>/" pom.xml
echo "Updated PEx version to ${{ steps.get_version.outputs.VERSION }}"

- name: Create Maven settings.xml
run: |
mkdir -p ~/.m2
cat > ~/.m2/settings.xml << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>central</id>
<username>${{ secrets.MAVEN_USERNAME }}</username>
<password>${{ secrets.MAVEN_PASSWORD }}</password>
</server>
<server>
<id>gpg.passphrase</id>
<passphrase>${{ secrets.GPG_PASSPHRASE }}</passphrase>
</server>
</servers>
</settings>
EOF

- name: Publish to Maven Central
run: |
cd Src/PEx
mvn clean deploy -P release -DskipTests
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Create deployment summary
run: |
echo "## 🚀 Maven Central Deployment" >> $GITHUB_STEP_SUMMARY
echo "Successfully published **PEx ${{ steps.get_version.outputs.VERSION }}** to Maven Central!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📦 Artifact Details" >> $GITHUB_STEP_SUMMARY
echo "- **Group ID:** io.github.p-org" >> $GITHUB_STEP_SUMMARY
echo "- **Artifact ID:** pex" >> $GITHUB_STEP_SUMMARY
echo "- **Version:** ${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📋 Maven Dependency" >> $GITHUB_STEP_SUMMARY
echo '```xml' >> $GITHUB_STEP_SUMMARY
echo '<dependency>' >> $GITHUB_STEP_SUMMARY
echo ' <groupId>io.github.p-org</groupId>' >> $GITHUB_STEP_SUMMARY
echo ' <artifactId>pex</artifactId>' >> $GITHUB_STEP_SUMMARY
echo " <version>${{ steps.get_version.outputs.VERSION }}</version>" >> $GITHUB_STEP_SUMMARY
echo '</dependency>' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "🔗 [View on Maven Central](https://central.sonatype.com/artifact/io.github.p-org/pex/${{ steps.get_version.outputs.VERSION }})" >> $GITHUB_STEP_SUMMARY
39 changes: 39 additions & 0 deletions .github/workflows/pex.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will build and test PEx, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: PEx on Ubuntu

on:
push:
pull_request:
workflow_dispatch:
inputs:
args:
description: Additional arguments
default: ""
required: false
jobs:
PEx-Build-And-Test-Ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 17
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build PEx
working-directory: Src/PEx
run: ./scripts/build_and_test.sh --build
- name: Test PEx
working-directory: Src/PEx
run: ./scripts/build_and_test.sh --test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ Bld/*
!Bld/Jars/
!Bld/Deps/
PGenerated/
PCheckerOutput/
!Src/**/Zing/*.zing
stubs.c
*.idb
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

8 changes: 8 additions & 0 deletions ChangeList.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
P 3.0 Changes

=== First PL ===
- branch: `dev_p3.0/cleanup_targets`
- Targets have been renamed to `PChecker`, `PObserve`, and `Stately`; `PVerifier` and `PExhaustive` to be added later.
- Removed `Symbolic` and other engines around it.


29 changes: 29 additions & 0 deletions Docs/docs/advanced/PVerifierLanguageExtensions/init-condition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Initialization Conditions

Initialization conditions let us constrain the kinds of systems that we consider for formal verification. You can think of these as constraints that P test harnesses have to satisfy to be considered valid.

??? note "P Init Condition Declaration Grammar"

```
initConditionDecl :
| init-condition expression; # P Init Condition Declaration
```

`expression` is a boolean expression that should evaluate to true at initialization time.

**Syntax:** `init-condition expression;`

`expression` is a boolean expression that must be satisfied for the system to be considered valid. This is typically used with quantifiers to express constraints over sets of machines or values.

=== "Init Condition Examples"

``` java
// Ensures that there's a unique machine of type coordinator
init-condition forall (m: machine) :: m == coordinator() <==> m is Coordinator;

// Ensures that every machine in the participants set is a machine of type participant
init-condition forall (m: machine) :: m in participants() <==> m is Participant;

// Ensures that all yesVotes tallies start empty
init-condition forall (c: Coordinator) :: c.yesVotes == default(set[machine]);
```
156 changes: 156 additions & 0 deletions Docs/docs/advanced/PVerifierLanguageExtensions/install-pverifier.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Install Instructions for Amazon Linux

PVerifier requires several dependencies to be installed. Follow the steps below to set up your environment.

!!! success ""
After each step, please use the troubleshooting check to ensure that each installation step succeeded.

### [Step 1] Install Java 11

```sh
sudo rpm --import https://yum.corretto.aws/corretto.key
sudo curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo
sudo yum install java-11-amazon-corretto-devel maven
```

??? hint "Troubleshoot: Confirm that java is correctly installed on your machine."
```shell
java -version
```

If you get `java` command not found error, most likely, you need to add the path to `java` in your `PATH`.

### [Step 2] Install SBT

```sh
sudo rm -f /etc/yum.repos.d/bintray-rpm.repo || true
curl -L https://www.scala-sbt.org/sbt-rpm.repo > sbt-rpm.repo
sudo mv sbt-rpm.repo /etc/yum.repos.d/
sudo yum install sbt
```

??? hint "Troubleshoot: Confirm that sbt is correctly installed on your machine."
```shell
sbt --version
```

If you get `sbt` command not found error, most likely, you need to add the path to `sbt` in your `PATH`.

### [Step 3] Install .NET 8.0

Install .NET 8.0 from Microsoft:

```sh
wget https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh
bash ./dotnet-install.sh -c 8.0 -i $HOME/.dotnet

sudo mkdir /usr/share/dotnet/
sudo cp -r $HOME/.dotnet/* /usr/share/dotnet/
```

Then add the following line to `.zshrc` and run `source .zshrc` (or `.bashrc` if using bash):

```sh
export PATH=$HOME/.dotnet:$HOME/.dotnet/tools:$PATH
```

The purpose of copying the .NET distribution into `/usr/share/dotnet` is to make standard dotnet packages available to dotnet. If you are uncomfortable modifying a system directory, you can add the following line to your `.zshrc` or `.bashrc` instead:

```sh
export DOTNET_ROOT=$HOME/.dotnet
```

### [Step 4] Install Z3

```sh
cd ~
git clone https://github.com/Z3Prover/z3.git
cd z3
python scripts/mk_make.py --java
cd build; make
```

Then add the following lines to your `.zshrc` and run `source ~/.zshrc` (or `.bashrc` if using bash):

```sh
export PATH=$PATH:$HOME/z3/build/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/z3/build/
```

??? hint "Troubleshoot: Confirm that Z3 is correctly installed on your machine."
```shell
z3 --version
```

If you get `z3` command not found error, most likely, you need to add the path to `z3` in your `PATH`.

Note:

* Python: Building Z3 requires Python 3, but Python 2 is the default on Amazon Linux 2. If `python --version` displays version 2, try
```sh
sudo alternatives --set python `which python3`
```
or
```sh
alias python=python3
```

* G++: Building Z3 requires G++ 8 or later with support for C++20, but G++ 7 is the default on Amazon Linux 2. If `g++ --version` displays version 7, try

```sh
sudo yum install gcc10 gcc10-c++
```

to install gcc10-gcc and gcc10-g++ and replace the string `gcc` with `gcc10-` in `config.mk`.

### [Step 5] Install UCLID5

```sh
cd ~
git clone https://github.com/uclid-org/uclid.git
cd uclid
sbt update clean compile "set fork:=true" test # should fail some tests that use cvc5 and delphi
sbt universal:packageBin
unzip target/universal/uclid-0.9.5.zip
```

Then add the following line to your `.zshrc` (or `.bashrc` if using bash) and run `source ~/.zshrc`:

```sh
export PATH=$PATH:$HOME/uclid/uclid-0.9.5/bin/
```

Note:
* Tests using cvc5 and delphi are likely to fail. If you just cut and paste the build commands into your shell, this failure may inhibit running the last two commands, so just cut and paste the last two commands into your shell again.

??? hint "Troubleshoot: Confirm that UCLID5 is correctly installed on your machine."
```shell
uclid --help
```

If you get `uclid` command not found error, most likely, you need to add the path to `uclid` in your `PATH`.

### [Step 6] Install PVerifier

The following steps will build P with PVerifier by running the regular P build on the PVerifier branch of the repository.

```sh
cd ~
git clone https://github.com/p-org/P
cd P
git checkout dev_p3.0/pverifier
root=$(pwd)
cd $root/Bld
./build.sh
dotnet tool uninstall --global P
cd $root/Src/PCompiler/PCommandLine
dotnet pack PCommandLine.csproj --configuration Release --output ./publish -p:PackAsTool=true -p:ToolCommandName=P -p:Version=2.1.3
dotnet tool install P --global --add-source ./publish
```

??? hint "Troubleshoot: Confirm that PVerifier is correctly installed on your machine."
```shell
p --version
```

If you get `p` command not found error, most likely, you need to add the path to `p` in your `PATH`.
Loading
Loading