@@ -127,7 +127,7 @@ jobs:
127
127
shell : bash
128
128
run : |
129
129
cp LICENSE ./mithril-client-wasm/
130
- wasm-pack build mithril-client-wasm --release --target bundler --out-dir ./pkg --scope mithril-dev --out-name index
130
+ wasm-pack build mithril-client-wasm --release --target web --out-dir ./pkg --scope mithril-dev --out-name index
131
131
132
132
- name : Prepare 'mithril-client-wasm' package
133
133
shell : bash
@@ -635,3 +635,187 @@ jobs:
635
635
loki_ingest_username : ${{ secrets.LOKI_INGEST_USERNAME }}
636
636
loki_ingest_password : ${{ secrets.LOKI_INGEST_PASSWORD }}
637
637
638
+ cargo-doc :
639
+ runs-on : ubuntu-22.04
640
+ steps :
641
+ - name : Checkout sources
642
+ uses : actions/checkout@v3
643
+
644
+ - name : Install stable toolchain and restore cache
645
+ uses : ./.github/workflows/actions/toolchain-and-cache
646
+ with :
647
+ cache-version : ${{ secrets.CACHE_VERSION }}
648
+ cargo-tools : clippy-sarif sarif-fmt
649
+
650
+ - name : Generate cargo doc
651
+ run : |
652
+ cargo doc --no-deps -p mithril-stm -p mithril-common -p mithril-aggregator \
653
+ -p mithril-signer -p mithril-client -p mithril-client-cli \
654
+ --all-features --message-format=json \
655
+ | clippy-sarif | tee rust-cargo-doc-results.sarif | sarif-fmt
656
+
657
+ # Update tool sarif metadata from "clippy" to "cargo-doc" (since it's set this way by clippy-sarif)
658
+ contents=$(cat rust-cargo-doc-results.sarif \
659
+ | jq '.runs[].tool.driver.name = "cargo-doc"' \
660
+ | jq '.runs[].tool.driver.informationUri = "https://doc.rust-lang.org/cargo/commands/cargo-doc.html"' \
661
+ )
662
+ echo -E "${contents}" > rust-cargo-doc-results.sarif
663
+
664
+ # Make this step fail if any warning has been found
665
+ if [[ $(cat rust-cargo-doc-results.sarif | jq '.runs[0].results') != "[]" ]]; then
666
+ false
667
+ fi
668
+
669
+ - name : Upload cargo-doc results to GitHub
670
+ if : success() || failure()
671
+ uses : github/codeql-action/upload-sarif@v2
672
+ with :
673
+ sarif_file : rust-cargo-doc-results.sarif
674
+ wait-for-processing : true
675
+
676
+ - name : Publish Mithril-rust-doc
677
+ uses : actions/upload-artifact@v3
678
+ with :
679
+ name : mithril-rust-doc
680
+ if-no-files-found : error
681
+ path : |
682
+ target/doc/
683
+
684
+ build-docusaurus :
685
+ runs-on : ubuntu-22.04
686
+ steps :
687
+ - name : Checkout sources
688
+ uses : actions/checkout@v3
689
+
690
+ - name : Setup Node.js
691
+ uses : actions/setup-node@v3
692
+ with :
693
+ node-version : 18
694
+ cache : ' yarn'
695
+ cache-dependency-path : docs/website/yarn.lock
696
+
697
+ - name : Build Docusaurus site
698
+ working-directory : docs/website
699
+ run : |
700
+ yarn && yarn build
701
+
702
+ - name : Publish Docusaurus build
703
+ uses : actions/upload-artifact@v3
704
+ with :
705
+ name : docusaurus-build
706
+ if-no-files-found : error
707
+ path : |
708
+ docs/website/build/*
709
+
710
+ build-test-explorer :
711
+ runs-on : ubuntu-22.04
712
+ needs : build-test-wasm
713
+ steps :
714
+ - name : Checkout sources
715
+ uses : actions/checkout@v3
716
+
717
+ - name : Download built artifacts
718
+ uses : actions/download-artifact@v3
719
+ with :
720
+ name : mithril-distribution-wasm
721
+ path : mithril-client-wasm
722
+
723
+ - name : Unpack 'mithril-client-wasm' package
724
+ working-directory : mithril-client-wasm
725
+ run :
726
+ tar -xvzf pkg/*.tgz -C pkg/ && mv pkg/package/* pkg/
727
+
728
+ - name : Setup Node.js
729
+ uses : actions/setup-node@v3
730
+ with :
731
+ node-version : 18
732
+ cache : ' yarn'
733
+ cache-dependency-path : mithril-explorer/yarn.lock
734
+
735
+ - name : Install dependencies
736
+ working-directory : mithril-explorer
737
+ run : yarn install --frozen-lockfile
738
+
739
+ - name : Test explorer
740
+ working-directory : mithril-explorer
741
+ run : make test
742
+
743
+ - name : Check explorer
744
+ working-directory : mithril-explorer
745
+ run : make lint
746
+
747
+ - name : Build Explorer
748
+ working-directory : mithril-explorer
749
+ run : make build
750
+
751
+ - name : Publish Explorer build
752
+ uses : actions/upload-artifact@v3
753
+ with :
754
+ name : explorer-build
755
+ if-no-files-found : error
756
+ path : |
757
+ mithril-explorer/out/*
758
+
759
+ build-open-api-ui :
760
+ runs-on : ubuntu-22.04
761
+ steps :
762
+ - name : Checkout sources
763
+ uses : actions/checkout@v3
764
+
765
+ - name : Build OpenAPI UI
766
+ uses : Legion2/swagger-ui-action@v1
767
+ with :
768
+ output : out/
769
+ spec-file : ./openapi.yaml
770
+
771
+ - name : Publish OpenAPI UI build
772
+ uses : actions/upload-artifact@v3
773
+ with :
774
+ name : openapi-ui-build
775
+ if-no-files-found : error
776
+ path : |
777
+ out/*
778
+
779
+ publish-docs :
780
+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
781
+ runs-on : ubuntu-22.04
782
+ needs :
783
+ - cargo-doc
784
+ - build-docusaurus
785
+ - build-test-explorer
786
+ - build-open-api-ui
787
+ steps :
788
+ - name : Download mithril-rust-doc artifact
789
+ uses : actions/download-artifact@v3
790
+ with :
791
+ name : mithril-rust-doc
792
+ path : ./github-pages/rust-doc
793
+
794
+ - name : Download Docusaurus build
795
+ uses : actions/download-artifact@v3
796
+ with :
797
+ name : docusaurus-build
798
+ path : ./github-pages/doc
799
+
800
+ - name : Download Explorer build
801
+ uses : actions/download-artifact@v3
802
+ with :
803
+ name : explorer-build
804
+ path : ./github-pages/explorer
805
+
806
+ - name : Download OpenAPI UI build
807
+ uses : actions/download-artifact@v3
808
+ with :
809
+ name : openapi-ui-build
810
+ path : ./github-pages/openapi-ui
811
+
812
+ - name : Add CNAME & Redirect
813
+ run : |
814
+ echo "mithril.network" > ./github-pages/CNAME
815
+ echo '<!DOCTYPE html><html><head><meta http-equiv="Refresh" content="0; URL=https://mithril.network/doc"></head></html>' > ./github-pages/index.html
816
+
817
+ - name : Mithril / Publish GitHub Pages
818
+ uses : peaceiris/actions-gh-pages@v3
819
+ with :
820
+ github_token : ${{ secrets.GITHUB_TOKEN || github.token }}
821
+ publish_dir : ./github-pages
0 commit comments