From 3d943bccb65ba96b9a9d70702b920de7029574dd Mon Sep 17 00:00:00 2001 From: Aaryamann Challani <43716372+rymnc@users.noreply.github.com> Date: Tue, 15 Nov 2022 16:35:29 +0530 Subject: [PATCH] feat(rln): publish rln artifacts nightly (#72) * feat(rln): publish rln artifacts on push to master * test(ci): check if artifacts are built on push to temp branch * fix(ci): run tests only on changes to src * fix(ci): add paths-ignore to prs * fix(ci): make paths more explicit * fix(ci): make publish workflow run * fix(ci): revert back to master ref * fix(ci): add os and sha to artifact name * test(ci): trigger publish * feat(ci): tar the artifacts * test(ci): split ci and publish * test(ci): only on master runs * feat(ci): replace with nightly releaser * chore(ci): extra newlines * fix(ci): Spelling Co-authored-by: G. <28568419+s1fr0@users.noreply.github.com> * feat(ci): build and publish rln wasm Co-authored-by: G. <28568419+s1fr0@users.noreply.github.com> --- .github/workflows/ci.yml | 17 +++ .github/workflows/nightly-release.yml | 165 ++++++++++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 .github/workflows/nightly-release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 906b705..4433a6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,24 @@ on: push: branches: - master + paths-ignore: + - '**.md' + - '!.github/workflows/*.yml' + - '!multiplier/src/**' + - '!private-settlement/src/**' + - '!rln/src/**' + - '!rln-wasm/**' + - '!semaphore/src/**' pull_request: + paths-ignore: + - '**.md' + - '!.github/workflows/*.yml' + - '!multiplier/src/**' + - '!private-settlement/src/**' + - '!rln/src/**' + - '!rln-wasm/**' + - '!semaphore/src/**' + name: Tests diff --git a/.github/workflows/nightly-release.yml b/.github/workflows/nightly-release.yml new file mode 100644 index 0000000..6c9c838 --- /dev/null +++ b/.github/workflows/nightly-release.yml @@ -0,0 +1,165 @@ +name: Nightly build +on: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + +jobs: + linux: + name: Linux build + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Declare short sha + id: vars + shell: bash + run: | + echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + - name: Install nightly toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - name: Update git submodules + run: git submodule update --init --recursive + - name: cargo build + run: | + cargo build --release --workspace + mkdir release + cp target/release/librln* release/ + tar -czvf linux-rln-${{steps.vars.outputs.sha_short}}.tar.gz release/ + + - name: Upload archive artifact + uses: actions/upload-artifact@v2 + with: + name: linux-archive + path: linux-rln-${{steps.vars.outputs.sha_short}}.tar.gz + retention-days: 2 + + macos: + name: MacOS build + runs-on: macos-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + with: + ref: master + - name: Declare short sha + id: vars + shell: bash + run: | + echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + - name: Install nightly toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - name: Update git submodules + run: git submodule update --init --recursive + - name: cargo build + run: | + cargo build --release --workspace + mkdir release + cp target/release/librln* release/ + tar -czvf macos-rln-${{steps.vars.outputs.sha_short}}.tar.gz release/ + + - name: Upload archive artifact + uses: actions/upload-artifact@v2 + with: + name: macos-archive + path: macos-rln-${{steps.vars.outputs.sha_short}}.tar.gz + retention-days: 2 + + browser-rln-wasm: + name: Browser build (RLN WASM) + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + with: + ref: master + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: Declare short sha + id: vars + shell: bash + run: | + echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + - run: git submodule update --init --recursive + - name: Install wasm-pack + uses: jetli/wasm-pack-action@v0.3.0 + - name: Install cargo-make + run: cargo install cargo-make + - name: cargo make build + run: | + cargo make build + mkdir release + cp pkg/** release/ + tar -czvf browser-rln-wasm-${{steps.vars.outputs.sha_short}}.tar.gz release/ + working-directory: rln-wasm + + - name: Upload archive artifact + uses: actions/upload-artifact@v2 + with: + name: browser-rln-wasm-archive + path: browser-rln-wasm-${{steps.vars.outputs.sha_short}}.tar.gz + retention-days: 2 + + + prepare-prerelease: + name: Prepare pre-release + needs: [linux, macos, browser-rln-wasm] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + ref: master + - name: Download artifacts + uses: actions/download-artifact@v2 + - name: Create release notes + run: | + echo "## Release notes" > release-notes.md + echo "### Linux" >> release-notes.md + tar -xvf linux-rln-*.tar.gz + ls -l release >> release-notes.md + echo "### MacOS" >> release-notes.md + tar -xvf macos-rln-*.tar.gz + ls -l release >> release-notes.md + echo "### Browser (RLN WASM)" >> release-notes.md + tar -xvf browser-rln-wasm-*.tar.gz + ls -l release >> release-notes.md + + - name: Delete tag + uses: dev-drprasad/delete-tag-and-release@v0.2.0 + with: + delete_release: true + tag_name: nightly + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create prerelease + run: | + gh release create nightly --prerelease --target master \ + --title 'Nightly build ("master" branch)' --notes-file release_notes.md \ + linux-archive/* \ + macos-archive/* \ + browser-rln-wasm-archive/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Delete artifacts + uses: geekyeggo/delete-artifact@v1 + with: + failOnError: false + name: | + linux-archive + macos-archive + browser-rln-wasm-archive