From fba694f61a401f335b123502610fe9a620426c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Walther?= Date: Thu, 21 Sep 2023 16:52:01 +0200 Subject: [PATCH] Add a separate nightly workflow with a trigger --- .github/workflows/nightly_build.yml | 1 - .../nightly_build_matrix_on_dispatch.json | 50 +++++ .../workflows/nightly_build_on_dispatch.yml | 174 ++++++++++++++++++ 3 files changed, 224 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/nightly_build_matrix_on_dispatch.json create mode 100644 .github/workflows/nightly_build_on_dispatch.yml diff --git a/.github/workflows/nightly_build.yml b/.github/workflows/nightly_build.yml index 28606c2f81..84ea9fabec 100644 --- a/.github/workflows/nightly_build.yml +++ b/.github/workflows/nightly_build.yml @@ -3,7 +3,6 @@ name: Nightly builds on: schedule: - cron: '14 1 * * *' - workflow_dispatch: jobs: matrix_prep: runs-on: ubuntu-20.04 diff --git a/.github/workflows/nightly_build_matrix_on_dispatch.json b/.github/workflows/nightly_build_matrix_on_dispatch.json new file mode 100644 index 0000000000..56c6c72cdb --- /dev/null +++ b/.github/workflows/nightly_build_matrix_on_dispatch.json @@ -0,0 +1,50 @@ +[ + { + "os":"ubuntu-20.04", + "rust":"stable", + "runOnEvent":"workflow_dispatch" + }, + + { + "os":"windows10", + "rust":"stable", + "runOnEvent":"workflow_dispatch" + }, + { + "os":"macos-latest", + "rust":"stable", + "runOnEvent":"workflow_dispatch" + }, + + { + "os":"ubuntu-20.04", + "rust":"beta", + "runOnEvent":"workflow_dispatch" + }, + { + "os":"windows10", + "rust":"beta", + "runOnEvent":"workflow_dispatch" + }, + { + "os":"macos-latest", + "rust":"beta", + "runOnEvent":"workflow_dispatch" + }, + + { + "os":"ubuntu-20.04", + "rust":"nightly", + "runOnEvent":"workflow_dispatch" + }, + { + "os":"windows10", + "rust":"nightly", + "runOnEvent":"workflow_dispatch" + }, + { + "os":"macos-latest", + "rust":"nightly", + "runOnEvent":"workflow_dispatch" + } +] diff --git a/.github/workflows/nightly_build_on_dispatch.yml b/.github/workflows/nightly_build_on_dispatch.yml new file mode 100644 index 0000000000..f21913ba75 --- /dev/null +++ b/.github/workflows/nightly_build_on_dispatch.yml @@ -0,0 +1,174 @@ +name: Nightly builds on dispatch + +on: workflow_dispatch +jobs: + matrix_prep: + runs-on: ubuntu-20.04 + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + # creates the matrix strategy from nightly_build_matrix_includes.json + - uses: actions/checkout@v3 + - id: set-matrix + uses: JoshuaTheMiller/conditional-build-matrix@main + with: + inputFile: '.github/workflows/nightly_build_matrix_on_dispatch.json' + filter: '[?runOnEvent==`${{ github.event_name }}` || runOnEvent==`always`]' + build: + needs: matrix_prep + strategy: + matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}} + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.rust == 'nightly' || matrix.rust == 'beta' || matrix.rust == 'stable' }} + steps: + - name: Install Dependencies (Linux) + run: sudo apt-get update && sudo apt-get install libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libudev-dev squashfs-tools protobuf-compiler + continue-on-error: true + if: matrix.os == 'ubuntu-20.04' + + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Install rust toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + components: rustfmt, clippy + + - name: Check formatting + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + - name: Build all binaries + uses: actions-rs/cargo@v1 + with: + command: build + args: --workspace + + - name: Reclaim some disk space + uses: actions-rs/cargo@v1 + if: ${{ matrix.os == 'windows-latest' || matrix.os == 'ubuntu-20.04' }} + with: + command: clean + + - name: Build all examples + uses: actions-rs/cargo@v1 + with: + command: build + args: --workspace --examples + + - name: Reclaim some disk space + uses: actions-rs/cargo@v1 + if: ${{ matrix.os == 'windows-latest' || matrix.os == 'ubuntu-20.04' }} + with: + command: clean + + - name: Run all tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --workspace + + - name: Reclaim some disk space + uses: actions-rs/cargo@v1 + if: ${{ matrix.os == 'windows-latest' || matrix.os == 'ubuntu-20.04' }} + with: + command: clean + + - name: Run expensive tests + if: github.ref == 'refs/heads/develop' || github.event.pull_request.base.ref == 'develop' || github.event.pull_request.base.ref == 'master' + uses: actions-rs/cargo@v1 + with: + command: test + args: --workspace -- --ignored + + - name: Reclaim some disk space + uses: actions-rs/cargo@v1 + if: ${{ matrix.os == 'windows-latest' || matrix.os == 'ubuntu-20.04' }} + with: + command: clean + + - uses: actions-rs/clippy-check@v1 + name: Clippy checks + continue-on-error: true + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --workspace + + - name: Run clippy + uses: actions-rs/cargo@v1 + if: ${{ matrix.rust != 'nightly' }} + with: + command: clippy + args: --workspace --all-targets -- -D warnings + + - name: Reclaim some disk space + uses: actions-rs/cargo@v1 + if: ${{ matrix.os == 'windows-latest' || matrix.os == 'ubuntu-20.04' }} + with: + command: clean + + # nym-wallet (the rust part) + - name: Build nym-wallet rust code + uses: actions-rs/cargo@v1 + with: + command: build + args: --manifest-path nym-wallet/Cargo.toml --workspace + + - name: Run nym-wallet tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --manifest-path nym-wallet/Cargo.toml --workspace + + - name: Check nym-wallet formatting + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --manifest-path nym-wallet/Cargo.toml --all -- --check + + - name: Run clippy for nym-wallet + uses: actions-rs/cargo@v1 + if: ${{ matrix.rust != 'nightly' }} + with: + command: clippy + args: --manifest-path nym-wallet/Cargo.toml --workspace --all-targets -- -D warnings + + notification: + needs: build + runs-on: custom-runner-linux + steps: + - name: Collect jobs status + uses: technote-space/workflow-conclusion-action@v2 + - name: Check out repository code + uses: actions/checkout@v3 + - name: install npm + uses: actions/setup-node@v3 + if: env.WORKFLOW_CONCLUSION == 'failure' + with: + node-version: 18 + - name: Matrix - Node Install + if: env.WORKFLOW_CONCLUSION == 'failure' + run: npm install + working-directory: .github/workflows/support-files + - name: Matrix - Send Notification + if: env.WORKFLOW_CONCLUSION == 'failure' + env: + NYM_NOTIFICATION_KIND: nightly + NYM_PROJECT_NAME: "Nym nightly build" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GIT_COMMIT_MESSAGE: "${{ github.event.head_commit.message }}" + GIT_BRANCH: "${GITHUB_REF##*/}" + IS_SUCCESS: "${{ env.WORKFLOW_CONCLUSION == 'success' }}" + MATRIX_SERVER: "${{ secrets.MATRIX_SERVER }}" + MATRIX_ROOM: "${{ secrets.MATRIX_ROOM_NIGHTLY }}" + MATRIX_USER_ID: "${{ secrets.MATRIX_USER_ID }}" + MATRIX_TOKEN: "${{ secrets.MATRIX_TOKEN }}" + MATRIX_DEVICE_ID: "${{ secrets.MATRIX_DEVICE_ID }}" + uses: docker://keybaseio/client:stable-node + with: + args: .github/workflows/support-files/notifications/entry_point.sh