|
55 | 55 | description: rebuild-tee-docker |
56 | 56 | required: true |
57 | 57 | default: true |
| 58 | + rebuild-bitacross-docker: |
| 59 | + type: boolean |
| 60 | + description: rebuild-bitacross-docker |
| 61 | + required: true |
| 62 | + default: true |
58 | 63 | push-docker: |
59 | 64 | type: boolean |
60 | 65 | description: push-docker |
@@ -140,7 +145,7 @@ jobs: |
140 | 145 | echo "push_docker=$push_docker" | tee -a $GITHUB_OUTPUT |
141 | 146 | echo "run_parachain_test=$run_parachain_test" | tee -a $GITHUB_OUTPUT |
142 | 147 | echo "run_tee_test=$run_tee_test" | tee -a $GITHUB_OUTPUT |
143 | | - echo "run_bitacross_test=$$run_tee_test" | tee -a $GITHUB_OUTPUT |
| 148 | + echo "run_bitacross_test=$run_bitacross_test" | tee -a $GITHUB_OUTPUT |
144 | 149 |
|
145 | 150 | fmt: |
146 | 151 | runs-on: ubuntu-latest |
@@ -511,6 +516,88 @@ jobs: |
511 | 516 | if: failure() |
512 | 517 | uses: andymckay/cancel-action@0.5 |
513 | 518 |
|
| 519 | + bitacross-build: |
| 520 | + runs-on: ubuntu-latest |
| 521 | + needs: |
| 522 | + - fmt |
| 523 | + - set-condition |
| 524 | + - sequentialise |
| 525 | + steps: |
| 526 | + - name: Free up disk space |
| 527 | + if: startsWith(runner.name, 'GitHub Actions') |
| 528 | + uses: jlumbroso/free-disk-space@main |
| 529 | + with: |
| 530 | + tool-cache: true |
| 531 | + swap-storage: false |
| 532 | + large-packages: false |
| 533 | + |
| 534 | + - uses: actions/checkout@v4 |
| 535 | + |
| 536 | + - name: Set up Docker Buildx |
| 537 | + uses: docker/setup-buildx-action@v3 |
| 538 | + with: |
| 539 | + # use the docker driver to access the local image |
| 540 | + # we don't need external caches or multi platforms here |
| 541 | + # see https://docs.docker.com/build/drivers/ |
| 542 | + driver: docker |
| 543 | + |
| 544 | + - name: Build local builder |
| 545 | + if: needs.set-condition.outputs.rebuild_bitacross == 'true' |
| 546 | + uses: docker/build-push-action@v6 |
| 547 | + with: |
| 548 | + context: . |
| 549 | + file: bitacross-worker/build.Dockerfile |
| 550 | + tags: local-builder:latest |
| 551 | + target: builder |
| 552 | + build-args: | |
| 553 | + WORKER_MODE_ARG=offchain-worker |
| 554 | + ADDITIONAL_FEATURES_ARG= |
| 555 | +
|
| 556 | + - name: Build worker |
| 557 | + if: needs.set-condition.outputs.rebuild_bitacross == 'true' |
| 558 | + uses: docker/build-push-action@v6 |
| 559 | + with: |
| 560 | + context: . |
| 561 | + file: bitacross-worker/build.Dockerfile |
| 562 | + tags: litentry/bitacross-worker:latest |
| 563 | + target: deployed-worker |
| 564 | + |
| 565 | + - name: Build cli |
| 566 | + if: needs.set-condition.outputs.rebuild_bitacross == 'true' |
| 567 | + uses: docker/build-push-action@v6 |
| 568 | + with: |
| 569 | + context: . |
| 570 | + file: bitacross-worker/build.Dockerfile |
| 571 | + tags: litentry/bitacross-cli:latest |
| 572 | + target: deployed-client |
| 573 | + |
| 574 | + - name: Pull and tag worker and cli image optionally |
| 575 | + if: needs.set-condition.outputs.rebuild_bitacross == 'false' |
| 576 | + run: | |
| 577 | + docker pull litentry/bitacross-worker:latest |
| 578 | + docker pull litentry/bitacross-cli:latest |
| 579 | +
|
| 580 | + - run: docker images --all |
| 581 | + |
| 582 | + - name: Test enclave |
| 583 | + if: needs.set-condition.outputs.rebuild_bitacross == 'true' |
| 584 | + # cargo test is not supported in the enclave |
| 585 | + # see https://github.com/apache/incubator-teaclave-sgx-sdk/issues/232 |
| 586 | + run: docker run litentry/bitacross-worker:latest test --all |
| 587 | + |
| 588 | + - name: Save docker images |
| 589 | + run: docker save litentry/bitacross-worker:latest litentry/bitacross-cli:latest | gzip > litentry-bitacross.tar.gz |
| 590 | + |
| 591 | + - name: Upload docker images |
| 592 | + uses: actions/upload-artifact@v4 |
| 593 | + with: |
| 594 | + name: litentry-bitacross |
| 595 | + path: litentry-bitacross.tar.gz |
| 596 | + if-no-files-found: error |
| 597 | + - name: Fail early |
| 598 | + if: failure() |
| 599 | + uses: andymckay/cancel-action@0.5 |
| 600 | + |
514 | 601 | parachain-ts-test: |
515 | 602 | runs-on: ubuntu-latest |
516 | 603 | needs: |
@@ -806,6 +893,82 @@ jobs: |
806 | 893 | if-no-files-found: ignore |
807 | 894 | retention-days: 3 |
808 | 895 |
|
| 896 | + bitacross-worker-test: |
| 897 | + runs-on: ubuntu-latest |
| 898 | + needs: |
| 899 | + - set-condition |
| 900 | + - parachain-build-dev |
| 901 | + - bitacross-build |
| 902 | + strategy: |
| 903 | + fail-fast: false |
| 904 | + matrix: |
| 905 | + include: |
| 906 | + - test_name: lit-sign-bitcoin |
| 907 | + steps: |
| 908 | + - uses: actions/checkout@v4 |
| 909 | + |
| 910 | + - name: Pull polkadot image |
| 911 | + run: | |
| 912 | + docker pull parity/polkadot |
| 913 | +
|
| 914 | + - uses: actions/download-artifact@v4 |
| 915 | + with: |
| 916 | + name: litentry-parachain-dev |
| 917 | + |
| 918 | + - uses: actions/download-artifact@v4 |
| 919 | + with: |
| 920 | + name: litentry-bitacross |
| 921 | + |
| 922 | + - name: Load docker image |
| 923 | + run: | |
| 924 | + docker load < litentry-parachain-dev.tar.gz |
| 925 | + docker load < litentry-bitacross.tar.gz |
| 926 | + docker images |
| 927 | +
|
| 928 | + - name: Enable corepack and pnpm |
| 929 | + run: corepack enable && corepack enable pnpm |
| 930 | + |
| 931 | + - name: Generate parachain artefacts |
| 932 | + run: | |
| 933 | + ./tee-worker/scripts/litentry/generate_parachain_artefacts.sh |
| 934 | + ls -l docker/generated-rococo/ |
| 935 | + ls -l bitacross-worker/docker/litentry/ |
| 936 | +
|
| 937 | + - name: Build litentry parachain docker images |
| 938 | + run: | |
| 939 | + cd tee-worker/docker |
| 940 | + docker compose -f litentry-parachain.build.yml build |
| 941 | +
|
| 942 | + - name: Integration bitacross worker test ${{ matrix.test_name }} |
| 943 | + if: needs.set-condition.outputs.run_bitacross_test == 'true' |
| 944 | + timeout-minutes: 40 |
| 945 | + run: | |
| 946 | + cd bitacross-worker/docker |
| 947 | + docker compose -f multiworker-docker-compose.yml -f ${{ matrix.test_name }}.yml up --no-build --exit-code-from ${{ matrix.test_name }} ${{ matrix.test_name }} |
| 948 | +
|
| 949 | + - name: Stop integration multi worker docker containers |
| 950 | + if: needs.set-condition.outputs.run_bitacross_test == 'true' |
| 951 | + run: | |
| 952 | + cd bitacross-worker/docker |
| 953 | + docker compose -f multiworker-docker-compose.yml -f ${{ matrix.test_name }}.yml stop |
| 954 | +
|
| 955 | + - name: Collect docker logs if test fails |
| 956 | + continue-on-error: true |
| 957 | + uses: jwalton/gh-docker-logs@v2 |
| 958 | + if: failure() |
| 959 | + with: |
| 960 | + tail: all |
| 961 | + dest: docker-logs |
| 962 | + |
| 963 | + - name: Upload docker logs if test fails |
| 964 | + uses: actions/upload-artifact@v4 |
| 965 | + if: failure() |
| 966 | + with: |
| 967 | + name: ${{ matrix.test_name }}-docker-logs |
| 968 | + path: docker-logs |
| 969 | + if-no-files-found: ignore |
| 970 | + retention-days: 3 |
| 971 | + |
809 | 972 | # Secrets are not passed to the runner when a workflow is triggered from a forked repository, |
810 | 973 | # see https://docs.github.com/en/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow |
811 | 974 | # |
|
0 commit comments