|  | 
|  | 1 | +name: CI/CD | 
|  | 2 | + | 
|  | 3 | +on: | 
|  | 4 | +  workflow_dispatch: | 
|  | 5 | +    inputs: | 
|  | 6 | +      environment: | 
|  | 7 | +        description: 'Environment to run e2e tests against' | 
|  | 8 | +        type: choice | 
|  | 9 | +        required: true | 
|  | 10 | +        default: 'dev-preprod' | 
|  | 11 | +        options: | 
|  | 12 | +        - dev-mainnet | 
|  | 13 | +        - dev-preprod | 
|  | 14 | +        - dev-preview | 
|  | 15 | +        - staging-preprod | 
|  | 16 | +  pull_request: | 
|  | 17 | +  push: | 
|  | 18 | +    branches: ['master'] | 
|  | 19 | +    tags: ['*.*.*'] | 
|  | 20 | + | 
|  | 21 | +env: | 
|  | 22 | +  TL_DEPTH: ${{ github.event.pull_request.head.repo.fork && '0' || fromJson(vars.TL_DEPTH) }} | 
|  | 23 | +  TL_LEVEL: ${{ github.event.pull_request.head.repo.fork && 'info' || vars.TL_LEVEL }} | 
|  | 24 | +  # ----------------------------------------------------------------------------------------- | 
|  | 25 | + | 
|  | 26 | +jobs: | 
|  | 27 | +  build_and_test: | 
|  | 28 | +    strategy: | 
|  | 29 | +      matrix: | 
|  | 30 | +        os: [ubuntu-20.04] | 
|  | 31 | +    runs-on: ${{ matrix.os }} | 
|  | 32 | +    steps: | 
|  | 33 | +      - name: 📥 Checkout repository | 
|  | 34 | +        uses: actions/checkout@v3 | 
|  | 35 | + | 
|  | 36 | +      - name: Generate .env file | 
|  | 37 | +        working-directory: ./packages/e2e/ | 
|  | 38 | +        run: | | 
|  | 39 | +          networkMagic=$(jq --arg environment "${{ inputs.environment }}" <<< '{"dev-preprod":1, "dev-preview":2, "dev-mainnet":764824073, "staging-preprod":1}' '.[$environment]') | 
|  | 40 | +          ./src/scripts/generate-dotenv.sh ${{ inputs.environment }} | 
|  | 41 | +          echo "KEY_MANAGEMENT_PARAMS='$(jq --argjson networkMagic $networkMagic --arg mnemonic "${{ secrets.MNEMONIC }}" <<< '{"bip32Ed25519": "Sodium", "accountIndex": 0, "chainId":{"networkId": 0, "networkMagic": 0}, "passphrase":"some_passphrase","mnemonic":"mnemonics"}' '.mnemonic=$mnemonic | .chainId.networkMagic=$networkMagic')'" >> .env | 
|  | 42 | +
 | 
|  | 43 | +      - name: 🧰 Setup Node.js | 
|  | 44 | +        uses: actions/setup-node@v3 | 
|  | 45 | +        with: | 
|  | 46 | +          node-version: 18.12.0 | 
|  | 47 | + | 
|  | 48 | +      - name: 🔨 Build | 
|  | 49 | +        run: | | 
|  | 50 | +          yarn install --immutable --inline-builds --mode=skip-build | 
|  | 51 | +          yarn build:cjs | 
|  | 52 | +          docker build --no-cache . | 
|  | 53 | +        env: | 
|  | 54 | +          NODE_OPTIONS: '--max_old_space_size=8192' | 
|  | 55 | + | 
|  | 56 | +      - name: 🌐 Setup local test network | 
|  | 57 | +        working-directory: packages/e2e | 
|  | 58 | +        run: | | 
|  | 59 | +          yarn local-network:up -d | 
|  | 60 | +        env: | 
|  | 61 | +          CARDANO_NODE_CHAINDB_LOG_LEVEL: 'Warning' | 
|  | 62 | +          CARDANO_NODE_LOG_LEVEL: 'Warning' | 
|  | 63 | +          OGMIOS_PORT: '1340' | 
|  | 64 | +          OGMIOS_URL: 'ws://ogmios:1340' | 
|  | 65 | +          POSTGRES_PORT: '5435' | 
|  | 66 | + | 
|  | 67 | +      - name: Wait for network init | 
|  | 68 | +        run: | | 
|  | 69 | +          yarn workspace @cardano-sdk/e2e wait-for-network-init | 
|  | 70 | +
 | 
|  | 71 | +      - name: 🔬 Test - e2e - wallet at epoch 0 | 
|  | 72 | +        run: | | 
|  | 73 | +          yarn workspace @cardano-sdk/e2e test:wallet | 
0 commit comments