chore(ci): add js-waku test to pre-release workflow (#2017)

This commit is contained in:
Vaclav Pavlin 2023-09-11 16:16:53 +02:00 committed by GitHub
parent a4e783303c
commit e8776fd664
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 16 deletions

View File

@ -2,6 +2,10 @@ name: container-image-build
on: on:
workflow_call: workflow_call:
inputs:
image_tag:
type: string
default: ${{ github.event.number }}
outputs: outputs:
image: image:
description: The resulting image link description: The resulting image link
@ -60,7 +64,7 @@ jobs:
env: env:
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }} QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
QUAY_USER: ${{ secrets.QUAY_USER }} QUAY_USER: ${{ secrets.QUAY_USER }}
PR_NUMBER: ${{ github.event.number }} PR_NUMBER: ${{ inputs.image_tag}}
- name: Comment PR - name: Comment PR
uses: thollander/actions-comment-pull-request@v2 uses: thollander/actions-comment-pull-request@v2

View File

@ -16,7 +16,22 @@ env:
NIMFLAGS: "--parallelBuild:${NPROC}" NIMFLAGS: "--parallelBuild:${NPROC}"
jobs: jobs:
tag-name:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Vars
id: vars
run: |
TAG=$([[ "${{github.ref}}" == "refs/heads/master" ]] && echo "${{env.RELEASE_NAME}}" || echo ${{github.ref}} | sed 's#refs/tags/##')
echo "tag=${TAG}" >> $GITHUB_OUTPUT
outputs:
tag: ${{steps.vars.outputs.tag}}
build-and-publish: build-and-publish:
needs: tag-name
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest] os: [ubuntu-latest, macos-latest]
@ -33,12 +48,11 @@ jobs:
id: vars id: vars
run: | run: |
ARCH=${{matrix.arch}} ARCH=${{matrix.arch}}
TAG=$([[ "${{github.ref}}" == "refs/heads/master" ]] && echo "${{env.RELEASE_NAME}}" || echo ${{github.ref}} | sed 's#refs/tags/##')
echo "arch=${ARCH}" >> $GITHUB_OUTPUT echo "arch=${ARCH}" >> $GITHUB_OUTPUT
NWAKU_ARTIFACT_NAME=$(echo "nwaku-${ARCH}-${{runner.os}}-${TAG}.tar.gz" | tr "[:upper:]" "[:lower:]") NWAKU_ARTIFACT_NAME=$(echo "nwaku-${ARCH}-${{runner.os}}-${{ needs.tag-name.outputs.tag }}.tar.gz" | tr "[:upper:]" "[:lower:]")
NWAKU_TOOLS_ARTIFACT_NAME=$(echo "nwaku-tools-${ARCH}-${{runner.os}}-${TAG}.tar.gz" | tr "[:upper:]" "[:lower:]") NWAKU_TOOLS_ARTIFACT_NAME=$(echo "nwaku-tools-${ARCH}-${{runner.os}}-${{ needs.tag-name.outputs.tag }}.tar.gz" | tr "[:upper:]" "[:lower:]")
echo "nwaku=${NWAKU_ARTIFACT_NAME}" >> $GITHUB_OUTPUT echo "nwaku=${NWAKU_ARTIFACT_NAME}" >> $GITHUB_OUTPUT
echo "nwakutools=${NWAKU_TOOLS_ARTIFACT_NAME}" >> $GITHUB_OUTPUT echo "nwakutools=${NWAKU_TOOLS_ARTIFACT_NAME}" >> $GITHUB_OUTPUT
@ -57,8 +71,6 @@ jobs:
chat2\ chat2\
tools tools
tar -cvzf ${{steps.vars.outputs.nwaku}} ./build/wakunode2 ./build/chat2 tar -cvzf ${{steps.vars.outputs.nwaku}} ./build/wakunode2 ./build/chat2
tar -cvzf ${{steps.vars.outputs.nwakutools}} ./build/wakucanary ./build/networkmonitor tar -cvzf ${{steps.vars.outputs.nwakutools}} ./build/wakucanary ./build/networkmonitor
@ -76,9 +88,23 @@ jobs:
path: ${{steps.vars.outputs.nwakutools}} path: ${{steps.vars.outputs.nwakutools}}
retention-days: 2 retention-days: 2
build-docker-image:
needs: tag-name
uses: waku-org/nwaku/.github/workflows/container-image.yml@master
with:
image_tag: ${{ needs.tag-name.outputs.tag }}
secrets: inherit
js-waku:
needs: build-docker-image
uses: waku-org/js-waku/.github/workflows/ci.yml@master
with:
nim_wakunode_image: ${{ needs.build-docker-image.outputs.image }}
caller: nwaku
create-release-candidate: create-release-candidate:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [ build-and-publish ] needs: [ tag-name, build-and-publish ]
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -92,10 +118,8 @@ jobs:
- name: prep variables - name: prep variables
id: vars id: vars
run: | run: |
RELEASE=$([[ "${{github.ref}}" == "refs/heads/master" ]] && echo "${{env.RELEASE_NAME}}" || echo ${{github.ref}} | sed 's#refs/tags/##')
REF=$(echo ${{github.ref}} | sed 's#.*/##') REF=$(echo ${{github.ref}} | sed 's#.*/##')
echo "release=${RELEASE}" >> $GITHUB_OUTPUT
echo "ref=${REF}" >> $GITHUB_OUTPUT echo "ref=${REF}" >> $GITHUB_OUTPUT
- name: generate release notes - name: generate release notes
@ -103,11 +127,11 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
set -x set -x
gh release view ${{steps.vars.outputs.release}} &>/dev/null &&\ gh release view ${{ needs.tag-name.outputs.tag }} &>/dev/null &&\
gh release delete -y ${{steps.vars.outputs.release}} &&\ gh release delete -y ${{ needs.tag-name.outputs.tag }} &&\
[[ "${{steps.vars.outputs.release}}" == "nightly" ]] && git tag -d ${{steps.vars.outputs.release}} [[ "${{ needs.tag-name.outputs.tag }}" == "nightly" ]] && git tag -d ${{ needs.tag-name.outputs.tag }}
RELEASE_NOTES_TAG=$([[ "${{steps.vars.outputs.release}}" != "nightly" ]] && echo "-t ${{steps.vars.outputs.ref}}" || echo "") RELEASE_NOTES_TAG=$([[ "${{ needs.tag-name.outputs.tag }}" != "nightly" ]] && echo "-t ${{steps.vars.outputs.ref}}" || echo "")
docker run \ docker run \
-t \ -t \
@ -122,8 +146,8 @@ jobs:
cat release_notes.md cat release_notes.md
TARGET=$([[ "${{steps.vars.outputs.release}}" == "nightly" ]] && echo "--target ${{steps.vars.outputs.ref}}" || echo "") TARGET=$([[ "${{ needs.tag-name.outputs.tag }}" == "nightly" ]] && echo "--target ${{steps.vars.outputs.ref}}" || echo "")
gh release create ${{steps.vars.outputs.release}} --prerelease ${TARGET} \ gh release create ${{ needs.tag-name.outputs.tag }} --prerelease ${TARGET} \
--title ${{steps.vars.outputs.release}} --notes-file release_notes.md \ --title ${{ needs.tag-name.outputs.tag }} --notes-file release_notes.md \
wakunode2/* wakutools/* wakunode2/* wakutools/*