Skip to content

Commit

Permalink
Fix linux E2E
Browse files Browse the repository at this point in the history
  • Loading branch information
paolino committed Nov 29, 2023
1 parent d25e8bf commit 654e585
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 28 deletions.
58 changes: 31 additions & 27 deletions .github/workflows/e2e-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ jobs:
test:
runs-on: ubuntu-latest

env:
TESTS_E2E_FIXTURES: ${{ secrets.TESTS_E2E_FIXTURES }}
BUILDKITE_API_TOKEN: ${{ secrets.BUILDKITE_TOKEN_READ_BUILDS_ARTIFACTS }}
BRANCH: ${{ github.event.inputs.branch || '' }}
TAGS: ${{ github.event.inputs.tags || 'all' }}

steps:
- uses: actions/checkout@v3.2.0

Expand All @@ -36,38 +42,37 @@ jobs:
- name: Install dependencies
run: bundle install

- name: 🕒 Get Date/Time
id: date-time
shell: bash
run: |
echo "value=$(rake datetime)" >> $GITHUB_OUTPUT
- name: 💾 GH Cache node db
id: cache
- name: 💾 GH Restore Cache of node db
id: cache-node
uses: actions/cache@v3
with:
path: test/e2e/state/node_db/${{ env.NETWORK }}
key: node-db-${{ runner.os }}-${{ env.NETWORK }}-${{ steps.date-time.outputs.value }}
restore-keys: |
node-db-${{ runner.os }}-${{ env.NETWORK }}-
path: test/e2e/state/node_db/preprod
key: node-db-${{ runner.os }}-preprod

- name: 💾 Cache wallet db
id: cache-wallet
uses: actions/cache@v3
with:
path: test/e2e/state/wallet_db/${{ env.NETWORK }}
key: wallet-db3-${{ runner.os }}-${{ env.NETWORK }}-${{ steps.date-time.outputs.value }}
restore-keys: |
wallet-db3-${{ runner.os }}-${{ env.NETWORK }}-
path: test/e2e/state/wallet_db/preprod
key: wallet-db3-${{ runner.os }}-preprod

- name: Fetch preprod snapshot
if: steps.cache-node.outputs.cache-hit != 'true'
run: |
mkdir -p state/node_db/preprod
curl -o - https://downloads.csnapshots.io/snapshots/testnet/$(curl -s https://downloads.csnapshots.io/snapshots/testnet/testnet-db-snapshot.json | jq -r .[].file_name ) \
| lz4 -c -d - | tar -x -C state/node_db/preprod
mv state/node_db/preprod/db/* state/node_db/preprod
rmdir state/node_db/preprod/db
- name: ⚙️ Setup (get latest bins and configs and decode fixtures)
run: rake setup[$NETWORK,$BRANCH]
run: rake setup[preprod,$BRANCH]

- name: 🔍 Display versions
run: rake display_versions

- name: 🚀 Start node and wallet
run: rake start_node_and_wallet[$NETWORK]
run: rake start_node_and_wallet[preprod]

- name: ⏳ Wait until node is synced
run: rake wait_until_node_synced
Expand All @@ -76,7 +81,14 @@ jobs:
run: rake spec SPEC_OPTS="-t $TAGS"

- name: 🏁 Stop node and wallet
run: rake stop_node_and_wallet[$NETWORK]
run: rake stop_node_and_wallet[preprod]

- name: 💾 GH Save Cache of node db
if: always()
uses: actions/cache/save@v3
with:
path: test/e2e/state/node_db/preprod
key: node-db-${{ runner.os }}-preprod

- name: 📎 Upload state
uses: actions/upload-artifact@v3
Expand All @@ -87,11 +99,3 @@ jobs:
test/e2e/state/logs
test/e2e/state/configs
test/e2e/state/wallet_db
env:
TESTS_E2E_FIXTURES: ${{ secrets.TESTS_E2E_FIXTURES }}
BUILDKITE_API_TOKEN: ${{ secrets.BUILDKITE_TOKEN_READ_BUILDS_ARTIFACTS }}
NETWORK: ${{ github.event.inputs.network || 'preprod' }}
BRANCH: ${{ github.event.inputs.branch || '' }}
NODE_DB_CACHE: ${{ github.event.inputs.node_db_cache || 'GH' }}
TAGS: ${{ github.event.inputs.tags || 'all' }}
5 changes: 4 additions & 1 deletion test/e2e/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ require 'cardano_wallet'
require_relative 'env'
require_relative 'helpers/utils'
require_relative 'helpers/buildkite'
require 'io/console'

include Helpers::Utils

$stdout.sync = true

STATE = absolute_path ENV.fetch('TESTS_E2E_STATEDIR', nil)
CONFIGS = absolute_path ENV.fetch('CARDANO_NODE_CONFIGS', nil)
LOGS = absolute_path ENV.fetch('TESTS_LOGDIR', nil)
Expand Down Expand Up @@ -124,7 +127,7 @@ task :wait_until_node_synced do
current_time = Time.now
while network.information['sync_progress']['status'] == 'syncing'
log "Syncing node... #{network.information['sync_progress']['progress']['quantity']}%"
sleep 15
sleep 5
end
rescue StandardError
retry if current_time <= timeout_treshold
Expand Down

0 comments on commit 654e585

Please sign in to comment.