Skip to content

Commit

Permalink
squash merge upstream/main into feat/pagination-ordering
Browse files Browse the repository at this point in the history
Signed-off-by: ff137 <[email protected]>
  • Loading branch information
ff137 committed Oct 22, 2024
1 parent a2cecc4 commit 2a7bc47
Show file tree
Hide file tree
Showing 2,077 changed files with 99,497 additions and 96,155 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "aries_cloudagent",
"name": "acapy_agent",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
Expand All @@ -18,7 +18,7 @@
],
"settings": {
"python.testing.pytestArgs": [
"aries_cloudagent",
"acapy_agent",
"--no-cov"
],
"python.testing.autoTestDiscoverOnSaveEnabled": true,
Expand Down
6 changes: 3 additions & 3 deletions .devcontainer/post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ WORKSPACE_DIR=$(pwd)
python -m pip install --upgrade pip
pip3 install -r demo/requirements.txt -r demo/requirements.behave.txt

# install a version of aries-cloudagent so the pytests can pick up a version
pip3 install aries-cloudagent
# install a version of acapy-agent so the pytests can pick up a version
pip3 install acapy-agent

# hack/workaround to allow `pytest .` and `poetry run pytest` work.
# need to not run ruff...
Expand All @@ -19,7 +19,7 @@ cat > .pytest.ini <<EOF
# remove this file for normal operations outside of the devcontainer.
# basically we cannot have ruff (--ruff) in the pytest configuration as it breaks the Testing View.
[pytest]
testpaths = "aries_cloudagent"
testpaths = "acapy_agent"
addopts = --quiet
markers = [
"anoncreds: Tests specifically relating to AnonCreds support",
Expand Down
39 changes: 39 additions & 0 deletions .github/actions/is-release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Check if PR is a release
description: "Checks if the PR is a release"

outputs:
is_release:
description: "Is this a release?"
value: ${{ steps.check_if_release.outputs.is_release }}

runs:
using: "composite"
steps:
- name: Check if PR is a release
shell: bash
id: check_if_release
continue-on-error: true
run: |
# Get the diff between the current commit and the last merge commit on the upstream/main branch
git remote add upstream https://github.com/openwallet-foundation/acapy.git
git fetch upstream
last_merge=$(git rev-list --no-merges -n 1 upstream/main)
echo event = ${{ github.event_name }}
echo last upstream commit = "$last_merge"
echo current pr commit = "${{ github.sha }}"
echo Will exit with code 1 if the pull request is not a release
changes=$(git diff "${{ github.sha }}" "$last_merge" pyproject.toml)
# Extract the version of acapy-agent from the diff of pyproject.toml
version=$(echo "$changes" | grep -A1 'name = "acapy_agent"' | head -n 2 | tail -n 1 | awk '{print $3}' | tr -d '"')
echo "$version"
if [ "$version" ]; then
echo "This is a release because the acapy-agent version in pyproject.toml has changes"
echo is_release=true >> $GITHUB_OUTPUT
fi
2 changes: 1 addition & 1 deletion .github/actions/run-unit-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ runs:
- name: Tests
shell: bash
run: |
poetry run pytest --cov=aries_cloudagent --cov-report term-missing --cov-report xml --ignore-glob=/tests/* --ignore-glob=demo/* --ignore-glob=docker/* --ignore-glob=docs/* --ignore-glob=scripts/* 2>&1 | tee pytest.log
poetry run pytest --cov=acapy_agent --cov-report term-missing --cov-report xml --ignore-glob=/tests/* --ignore-glob=demo/* --ignore-glob=docker/* --ignore-glob=docs/* --ignore-glob=scripts/* --ignore-glob=scenarios/* 2>&1 | tee pytest.log
PYTEST_EXIT_CODE=${PIPESTATUS[0]}
if grep -Eq "RuntimeWarning: coroutine .* was never awaited" pytest.log; then
echo "Failure: Detected unawaited coroutine warning in pytest output."
Expand Down
55 changes: 25 additions & 30 deletions .github/workflows/bdd-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,46 +20,41 @@ defaults:
jobs:
test:
runs-on: ubuntu-latest
if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false && github.repository == 'hyperledger/aries-cloudagent-python') || (github.event_name != 'pull_request')
# Run on openwallet-foundation and non-draft PRs or on non-PR events
if: (github.repository == 'openwallet-foundation/acapy') && ((github.event_name == 'pull_request' && github.event.pull_request.draft == false) || (github.event_name != 'pull_request'))
outputs:
is_release: ${{ steps.check_if_release.outputs.is_release }}
steps:
- name: checkout-acapy
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if PR is a release
id: check_if_release
continue-on-error: true
- name: Check changed files
id: check-changed-files
uses: tj-actions/changed-files@v45
with:
files_yaml: |
src:
- acapy_agent/**/*
- poetry.lock
- pyproject.toml
demo: "demo/**/*"
- name: Check if demo or src files changed
id: check-if-demo-or-src-changed
run: |
# Get the diff between the current commit and the last merge commit on the upstream/main branch
git remote add upstream https://github.com/hyperledger/aries-cloudagent-python.git
git fetch upstream
last_merge=$(git rev-list --no-merges -n 1 upstream/main)
echo event = ${{ github.event_name }}
echo last upstream commit = "$last_merge"
echo current pr commit = "${{ github.sha }}"
echo Will exit with code 1 if the pull request is not a release
changes=$(git diff "${{ github.sha }}" "$last_merge" pyproject.toml)
# Extract the version of aries-cloudagent from the diff of pyproject.toml
version=$(echo "$changes" | grep -A1 'name = "aries_cloudagent"' | head -n 2 | tail -n 1 | awk '{print $3}' | tr -d '"')
echo "$version"
if [ "$version" ]; then
echo "This is a release because the aries-cloudagent version in pyproject.toml has changes"
echo is_release=true >> $GITHUB_OUTPUT
if [ "${{ steps.check-changed-files.outputs.demo_any_changed }}" != "true" ] && [ "${{ steps.check-changed-files.outputs.src_any_changed }}" != "true" ] && [ '${{ github.event_name }}' == 'pull_request' ]; then
echo "No demo or src files changed..."
echo run_tests=false >> $GITHUB_OUTPUT
fi
- name: run-pr-integration-tests
- name: Check if PR is a release
if: steps.check-if-demo-or-src-changed.outputs.run_tests != 'false'
uses: ./.github/actions/is-release
id: check_if_release
- name: Run PR or Nightly Integration Tests
if: (steps.check_if_release.outputs.is_release != 'true' && steps.check-if-demo-or-src-changed.outputs.run_tests != 'false')
uses: ./.github/actions/run-integration-tests
if: (steps.check_if_release.outputs.is_release != 'true' && github.event_name == 'pull_request')
- name: run-release-or-cron-integration-tests
if: (steps.check_if_release.outputs.is_release == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
- name: Run Release Integration Tests
if: (steps.check_if_release.outputs.is_release == 'true' && steps.check-if-demo-or-src-changed.outputs.run_tests != 'false')
uses: ./.github/actions/run-integration-tests
with:
TEST_SCOPE: "-t @Release -t ~@BBS"
56 changes: 48 additions & 8 deletions .github/workflows/bdd-interop-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: BDD Interop Integration Tests

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
pull_request:
branches:
- main
Expand All @@ -17,30 +20,67 @@ defaults:
jobs:
test:
runs-on: ubuntu-latest
if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false && github.repository == 'hyperledger/aries-cloudagent-python') || (github.event_name != 'pull_request')
# Run on openwallet-foundation and non-draft PRs or on non-PR events
if: (github.repository == 'openwallet-foundation/acapy') && ((github.event_name == 'pull_request' && github.event.pull_request.draft == false) || (github.event_name != 'pull_request'))
outputs:
is_release: ${{ steps.check_if_release.outputs.is_release }}
steps:
- name: checkout-acapy
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check changed files
id: check-changed-files
uses: tj-actions/changed-files@v45
with:
files_yaml: |
src:
- acapy_agent/**/*
- poetry.lock
- pyproject.toml
- name: Check if src files changed
id: check-if-src-changed
run: |
if [ "${{ steps.check-changed-files.outputs.src_any_changed }}" != "true" ] && [ '${{ github.event_name }}' == 'pull_request' ]; then
echo "No src files changed..."
echo run_tests=false >> $GITHUB_OUTPUT
fi
- name: Check if PR is a release
if: steps.check-if-src-changed.outputs.run_tests != 'false'
uses: ./.github/actions/is-release
id: check_if_release
- name: Request GitHub API for PR data
if: steps.check-if-src-changed.outputs.run_tests != 'false'
uses: octokit/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: get_pr_data
with:
route: GET /repos/${{ github.event.repository.full_name }}/pulls/${{ github.event.number }}
- name: Run BDD Interop Tests
- name: Prepare Interop Tests
if: steps.check-if-src-changed.outputs.run_tests != 'false'
run: |
# Get AATH
git clone https://github.com/hyperledger/aries-agent-test-harness.git
echo ${{ fromJson(steps.get_pr_data.outputs.data).head.repo.html_url }}
echo ${{ fromJson(steps.get_pr_data.outputs.data).head.ref }}
sed -i 's|@git+https://github.com/hyperledger/aries-cloudagent-python@main|@git+${{ fromJson(steps.get_pr_data.outputs.data).head.repo.html_url }}@${{ fromJson(steps.get_pr_data.outputs.data).head.ref }}|g' ./aries-agent-test-harness/aries-backchannels/acapy/requirements-main.txt
cat aries-agent-test-harness/aries-backchannels/acapy/requirements-main.txt
cd aries-agent-test-harness
git clone https://github.com/openwallet-foundation/owl-agent-test-harness.git
# Change fork and branch for pull requests
if [ ${{ github.event_name }} == 'pull_request' ]; then
echo ${{ fromJson(steps.get_pr_data.outputs.data).head.repo.html_url }}
echo ${{ fromJson(steps.get_pr_data.outputs.data).head.ref }}
sed -i 's|@git+https://github.com/openwallet-foundation/acapy@main|@git+${{ fromJson(steps.get_pr_data.outputs.data).head.repo.html_url }}@${{ fromJson(steps.get_pr_data.outputs.data).head.ref }}|g' ./owl-agent-test-harness/aries-backchannels/acapy/requirements-main.txt
fi
cat owl-agent-test-harness/aries-backchannels/acapy/requirements-main.txt
cd owl-agent-test-harness
./manage build -a acapy-main
- name: Run PR Interop Tests
if: (steps.check_if_release.outputs.is_release != 'true' && github.event_name == 'pull_request' && steps.check-if-src-changed.outputs.run_tests != 'false')
run: |
cd owl-agent-test-harness
NO_TTY=1 LEDGER_URL_CONFIG=http://test.bcovrin.vonx.io TAILS_SERVER_URL_CONFIG=https://tails.vonx.io ./manage run -d acapy-main -t @critical -t ~@wip -t ~@T004-RFC0211 -t ~@DidMethod_orb -t ~@Transport_NoHttpOutbound
- name: Run Release or Nightly Interop Tests
if: (steps.check_if_release.outputs.is_release == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' && steps.check-if-src-changed.outputs.run_tests != 'false')
run: |
cd owl-agent-test-harness
NO_TTY=1 LEDGER_URL_CONFIG=http://test.bcovrin.vonx.io TAILS_SERVER_URL_CONFIG=https://tails.vonx.io ./manage run -d acapy-main -t @AcceptanceTest -t ~@wip -t ~@T004-RFC0211 -t ~@DidMethod_orb -t ~@Transport_NoHttpOutbound
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
CodeQL-Build:
# CodeQL runs on ubuntu-latest and windows-latest
runs-on: ubuntu-latest
if: (github.event_name == 'pull_request' && github.repository == 'hyperledger/aries-cloudagent-python') || (github.event_name != 'pull_request')
if: (github.event_name == 'pull_request' && github.repository == 'openwallet-foundation/acapy') || (github.event_name != 'pull_request')

permissions:
security-events: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nigthly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
matrix:
os: ["ubuntu-latest"]
python-version: ["3.12"]
if: github.repository == 'hyperledger/aries-cloudagent-python' || github.event_name == 'workflow_dispatch'
if: github.repository == 'openwallet-foundation/acapy' || github.event_name == 'workflow_dispatch'
steps:
- name: checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pip-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:
jobs:
selftest:
runs-on: ubuntu-latest
if: (github.event_name == 'pull_request' && github.repository == 'hyperledger/aries-cloudagent-python') || (github.event_name != 'pull_request')
if: (github.event_name == 'pull_request' && github.repository == 'openwallet-foundation/acapy') || (github.event_name != 'pull_request')
steps:
- uses: actions/checkout@v4
- name: install
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
type: string

env:
# linux/386 platform support has been disabled pending a permanent fix for https://github.com/hyperledger/aries-cloudagent-python/issues/2124
# linux/386 platform support has been disabled pending a permanent fix for https://github.com/openwallet-foundation/acapy/issues/2124
# PLATFORMS: ${{ inputs.platforms || 'linux/amd64,linux/arm64,linux/386' }}
PLATFORMS: ${{ inputs.platforms || 'linux/amd64,linux/arm64' }}

Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ steps.info.outputs.repo-owner }}/aries-cloudagent-python
ghcr.io/${{ steps.info.outputs.repo-owner }}/acapy-agent
tags: |
type=raw,value=py${{ matrix.python-version }}-${{ inputs.tag || github.event.release.tag_name }}
Expand All @@ -108,7 +108,7 @@ jobs:
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ steps.info.outputs.repo-owner }}/aries-cloudagent-bbs
ghcr.io/${{ steps.info.outputs.repo-owner }}/acapy-agent-bbs
tags: |
type=raw,value=py${{ matrix.python-version }}-${{ inputs.tag || github.event.release.tag_name }}
Expand All @@ -123,13 +123,13 @@ jobs:
target: main
build-args: |
python_version=${{ matrix.python-version }}
acapy_name=aries-cloudagent-bbs
acapy_name=acapy-agent-bbs
acapy_version=${{ inputs.tag || github.event.release.tag_name }}
acapy_reqs=[askar,bbs,didcommv2]
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
# Because of BBS, only linux/amd64 is supported for the extended image
# https://github.com/hyperledger/aries-cloudagent-python/issues/2124#issuecomment-2293569659
# https://github.com/openwallet-foundation/acapy/issues/2124#issuecomment-2293569659
platforms: linux/amd64

# Temp fix
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/acapy-agent
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
- name: Install build and publish dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine poetry
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
poetry build
twine upload dist/*
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
26 changes: 25 additions & 1 deletion .github/workflows/scenario-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Scenario Integration Tests

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
pull_request:
branches:
- main
Expand All @@ -17,20 +20,41 @@ defaults:
jobs:
test:
runs-on: ubuntu-latest
if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false && github.repository == 'hyperledger/aries-cloudagent-python') || (github.event_name != 'pull_request')
# Run on openwallet-foundation and non-draft PRs or on non-PR events
if: (github.repository == 'openwallet-foundation/acapy') && ((github.event_name == 'pull_request' && github.event.pull_request.draft == false) || (github.event_name != 'pull_request'))
steps:
- name: checkout-acapy
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check changed files
id: check-changed-files
uses: tj-actions/changed-files@v45
with:
files_yaml: |
scenarios: "scenarios/**/*"
src:
- acapy_agent/**/*
- poetry.lock
- pyproject.toml
- name: Check if scenarios or src files changed
id: check-if-scenarios-or-src-changed
run: |
if [ "${{ steps.check-changed-files.outputs.scenarios_any_changed }}" != "true" ] && [ "${{ steps.check-changed-files.outputs.src_any_changed }}" != "true" ] && [ '${{ github.event_name }}' == 'pull_request' ]; then
echo "No scenarios or src files changed..."
echo run_tests=false >> $GITHUB_OUTPUT
fi
- name: Install poetry
if: steps.check-if-scenarios-or-src-changed.outputs.run_tests != 'false'
run: pipx install poetry
id: setup-poetry
- uses: actions/setup-python@v5
if: steps.check-if-scenarios-or-src-changed.outputs.run_tests != 'false'
with:
python-version: "3.12"
cache: "poetry"
- name: Run Scenario Tests
if: steps.check-if-scenarios-or-src-changed.outputs.run_tests != 'false'
run: |
# Build the docker image for testing
docker build -t acapy-test -f docker/Dockerfile.run .
Expand Down
Loading

0 comments on commit 2a7bc47

Please sign in to comment.