From a2ff7e1d9e7efc863dae8977fa95254656189f11 Mon Sep 17 00:00:00 2001 From: damien Date: Mon, 29 May 2023 10:51:27 -0400 Subject: [PATCH] github workflow --- .github/workflows/build-webhapps.yml | 73 ++++++++++++++++++++++++++++ .github/workflows/release.yml | 42 ++++++++++++++++ .github/workflows/test.yml | 39 +++++++++++++++ 3 files changed, 154 insertions(+) create mode 100644 .github/workflows/build-webhapps.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build-webhapps.yml b/.github/workflows/build-webhapps.yml new file mode 100644 index 00000000..1af158d2 --- /dev/null +++ b/.github/workflows/build-webhapps.yml @@ -0,0 +1,73 @@ +name: build-webhapps + +on: + workflow_call: + +jobs: + build-webhapps: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + # Install npm dependencies + - name: Install npm dependencies + shell: bash + run: | + npm install + # Download submodules + - name: Download submodules + shell: bash + run: | + npm run install:submodules + # install rust tools + - name: install rust tools + shell: bash + run: | + npm run install:rust + # install hc tool + - name: Install hc tool + shell: bash + run: | + npm run install:hc + # Install hash-zome + - name: Install hash-zome + run: | + npm run install:hash-zome + # Build happ + - name: Build happ + shell: bash + run: | + npm run build:happ + # Build webapp + - name: Build webapp + run: | + npm run build:webapp + # Package web-happ + - name: Package web-happ + run: | + npm run package:webapp + # build we-applet + - name: build we-applet + shell: bash + run: | + npm run build -w we-applet + # Package we-applet + - name: Package we-applet + shell: bash + run: | + npm run package:we-applet + # Regroup artifacts + - name: Regroup artifacts + run: | + cp target/wasm32-unknown-unknown/release/threads_integrity_zome.wasm ./artifacts + cp target/wasm32-unknown-unknown/release/threads_zome.wasm ./artifacts + cp target/wasm32-unknown-unknown/release/profiles_zome.wasm ./artifacts + cp target/wasm32-unknown-unknown/release/profiles_integrity_zome.wasm ./artifacts + # List uploaded files + - name: List uploaded files + run: ls -R + working-directory: ./artifacts + # "upload" artifacts + - uses: actions/upload-artifact@master + with: + name: all-happ-artifact + path: artifacts/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..2c6314ba --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,42 @@ +name: Release x64 + +on: + push: + tags: + - v[0-9]+.* + +jobs: + call-build: + uses: ./.github/workflows/build-webhapps.yml + secrets: inherit + + # upload the artifacts + upload-assets: + needs: call-build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + # Download previously uploaded artifacts + - uses: actions/download-artifact@v3 + with: + name: all-happ-artifact + path: artifacts + # Display artifacts folder + - name: Display artifacts folder + run: ls + working-directory: artifacts + # upload all artifacts + - name: upload binary (ubuntu only) + if: ${{ runner.os == 'Linux' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + working-directory: artifacts + run: | + rm -f *.blockmap + echo threads* + gh release upload "${GITHUB_REF#refs/tags/}" threads* --clobber + echo Threads* + gh release upload "${GITHUB_REF#refs/tags/}" Threads* --clobber + echo profiles* + gh release upload "${GITHUB_REF#refs/tags/}" profiles_zome.wasm --clobber + gh release upload "${GITHUB_REF#refs/tags/}" profiles_integrity_zome.wasm --clobber diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..0623dbc9 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,39 @@ +name: test-workflow x64 + +on: workflow_dispatch + +jobs: + call-build: + uses: ./.github/workflows/build-webhapps.yml + secrets: inherit + + # upload the artifacts + upload-assets: + needs: call-build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + # Download previously uploaded artifacts + - uses: actions/download-artifact@v3 + with: + name: all-happ-artifact + path: artifacts + # Display artifacts folder + - name: Display artifacts folder + run: ls + working-directory: artifacts + # upload all artifacts + - name: upload binary (ubuntu only) + if: ${{ runner.os == 'Linux' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + working-directory: artifacts + run: | + rm -f *.blockmap + echo threads* + gh release upload "manual-release" threads* --clobber + echo Threads* + gh release upload "manual-release" Threads* --clobber + echo profiles* + gh release upload "manual-release" profiles_zome.wasm --clobber + gh release upload "manual-release" profiles_integrity_zome.wasm --clobber