Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/actions/setup_canton/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: 'Setup Canton/Localnet'
description: 'Cache, download and prepare Canton or Localnet environment'
inputs:
network:
description: 'Network type: canton, devnet, or mainnet'
required: false
default: 'devnet'
runs:
using: 'composite'
steps:
- name: Cache Canton binaries
if: inputs.network == 'canton'
uses: actions/cache@v4
id: canton-cache
with:
path: .canton
key: ${{ runner.os }}-canton-${{ hashFiles('scripts/src/lib/version-config.json') }}

- name: Create Docker cache directory
if: inputs.network != 'canton'
shell: bash
run: mkdir -p /tmp/docker-images

- name: Cache Localnet
if: inputs.network != 'canton'
uses: actions/cache@v4
id: localnet-cache
with:
path: .localnet
key: ${{ runner.os }}-localnet-${{ inputs.network }}-${{ hashFiles('scripts/src/lib/version-config.json') }}

- name: Cache Docker images
if: inputs.network != 'canton'
uses: actions/cache@v4
id: docker-cache
with:
path: /tmp/docker-images
key: ${{ runner.os }}-docker-localnet-${{ inputs.network }}-${{ hashFiles('scripts/src/lib/version-config.json') }}
restore-keys: |
${{ runner.os }}-docker-localnet-${{ inputs.network }}-

- name: Load cached Docker images
if: inputs.network != 'canton' && steps.docker-cache.outputs.cache-hit == 'true'
shell: bash
run: |
if [ -f /tmp/docker-images/images.tar ]; then
docker load -i /tmp/docker-images/images.tar
fi

- name: Download Canton
if: inputs.network == 'canton' && steps.canton-cache.outputs.cache-hit != 'true'
shell: bash
run: yarn script:fetch:canton

- name: Download Localnet
if: inputs.network != 'canton' && (steps.localnet-cache.outputs.cache-hit != 'true' || steps.docker-cache.outputs.cache-hit != 'true')
shell: bash
run: yarn script:fetch:localnet -- --network=${{ inputs.network }}

- name: Start Canton
if: inputs.network == 'canton'
shell: bash
run: |
set -e
timeout 5m bash -c '
LOGFILE=canton_start.log
yarn start:canton > "$LOGFILE" 2>&1 &
pid=$!
for i in {1..60}; do
if grep -q "Bootstrap script successfully executed." "$LOGFILE"; then
echo "Canton started successfully."
exit 0
fi
if ! kill -0 $pid 2>/dev/null; then
echo "Canton process exited unexpectedly."
cat "$LOGFILE"
exit 1
fi
sleep 5
done
echo "Timeout: '"'"'Bootstrap script successfully executed.'"'"' not found in 5 minutes."
cat "$LOGFILE"
exit 1
'

- name: Start Localnet
if: inputs.network != 'canton'
shell: bash
run: yarn start:localnet -- --network=${{ inputs.network }}

- name: Save Docker images to cache
if: inputs.network != 'canton' && steps.docker-cache.outputs.cache-hit != 'true'
shell: bash
run: |
docker images --format "{{.Repository}}:{{.Tag}}" | grep -v "<none>" | xargs -r docker save -o /tmp/docker-images/images.tar
57 changes: 13 additions & 44 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -111,41 +115,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/setup_yarn

- name: Download Canton
run: yarn script:fetch:canton
- uses: ./.github/actions/setup_yarn

- name: Build project
run: yarn build:all
- uses: ./.github/actions/setup_canton
with:
network: canton

- name: Start remote WK
run: yarn nx run @canton-network/wallet-gateway-remote:start &

- name: Start Canton
run: |
set -e
timeout 5m bash -c '
LOGFILE=canton_start.log
yarn start:canton > "$LOGFILE" 2>&1 &
pid=$!
for i in {1..60}; do
if grep -q "Bootstrap script successfully executed." "$LOGFILE"; then
echo "Canton started successfully."
exit 0
fi
if ! kill -0 $pid 2>/dev/null; then
echo "Canton process exited unexpectedly."
cat "$LOGFILE"
exit 1
fi
sleep 5
done
echo "Timeout: 'Bootstrap script successfully executed.' not found in 5 minutes."
cat "$LOGFILE"
exit 1
'

- run: yarn nx run @canton-network/example-ping:dev > "example-ping.log" 2>&1 &

- run: yarn nx run @canton-network/mock-oauth2:start &
Expand Down Expand Up @@ -177,20 +156,12 @@ jobs:
uses: actions/checkout@v4
- uses: ./.github/actions/setup_yarn

- name: Download Canton
run: yarn script:fetch:localnet

- name: Start LocalNet
run: yarn start:localnet
- uses: ./.github/actions/setup_canton

# for some reason it breaks if we don't have a build here...
- name: Build project
run: yarn build:all

- name: Increase rate limit in wallet gateway config
run: |
jq '.server.requestRateLimit = 10000' wallet-gateway/test/config.json >/tmp/e2e-wk-config.json
mv /tmp/e2e-wk-config.json wallet-gateway/test/config.json

- name: Start remote WK
run: yarn nx run @canton-network/wallet-gateway-remote:start > "wallet-gateway-remote.log" 2>&1 &

Expand Down Expand Up @@ -232,11 +203,9 @@ jobs:

- uses: ./.github/actions/setup_yarn

- name: Download localnet (${{ matrix.network }})
run: yarn script:fetch:localnet -- --network=${{ matrix.network }}

- name: Start Localnet (${{ matrix.network }})
run: yarn start:localnet -- --network=${{ matrix.network }}
- uses: ./.github/actions/setup_canton
with:
network: ${{ matrix.network }}

- uses: ./.github/actions/check_resources

Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/examples-under-stress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@ jobs:
- name: Build project
run: yarn build:all

- name: Download localnet (${{ github.event.inputs.network || 'devnet' }})
run: yarn script:fetch:localnet -- --network=${{ github.event.inputs.network || 'devnet' }}

- name: Start localnet (${{ github.event.inputs.network || 'devnet' }})
run: yarn start:localnet -- --network=${{ github.event.inputs.network || 'devnet' }}
- uses: ./.github/actions/setup_canton
with:
network: ${{ github.event.inputs.network || 'devnet' }}

- uses: ./.github/actions/check_resources

Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/stress-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ jobs:
- name: Build project
run: yarn build:all

- name: Download localnet (${{ github.event.inputs.network || 'devnet' }})
run: yarn script:fetch:localnet -- --network=${{ github.event.inputs.network || 'devnet' }}

- name: Start localnet (${{ github.event.inputs.network || 'devnet' }})
run: yarn start:localnet -- --network=${{ github.event.inputs.network || 'devnet' }}
- uses: ./.github/actions/setup_canton
with:
network: ${{ github.event.inputs.network || 'devnet' }}

- uses: ./.github/actions/check_resources

Expand Down
Loading
Loading