From 3f9522b497b1540c0692e442fabdee480e991be4 Mon Sep 17 00:00:00 2001 From: Lorenzo Delgado Date: Thu, 1 Dec 2022 14:33:59 +0100 Subject: [PATCH] ci: merge test1 and tes2 github workflows --- .github/workflows/ci-experimental.yml | 122 ++++++++++++ .github/workflows/ci.yml | 180 ++++++++++++++++++ .github/workflows/test1-ignore.yml | 37 ---- .github/workflows/test1.yml | 66 ------- .../workflows/test2-experimental-ignore.yml | 41 ---- .github/workflows/test2-experimental.yml | 71 ------- .github/workflows/test2-ignore.yml | 41 ---- .github/workflows/test2.yml | 70 ------- 8 files changed, 302 insertions(+), 326 deletions(-) create mode 100644 .github/workflows/ci-experimental.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/test1-ignore.yml delete mode 100644 .github/workflows/test1.yml delete mode 100644 .github/workflows/test2-experimental-ignore.yml delete mode 100644 .github/workflows/test2-experimental.yml delete mode 100644 .github/workflows/test2-ignore.yml delete mode 100644 .github/workflows/test2.yml diff --git a/.github/workflows/ci-experimental.yml b/.github/workflows/ci-experimental.yml new file mode 100644 index 000000000..887c7cf69 --- /dev/null +++ b/.github/workflows/ci-experimental.yml @@ -0,0 +1,122 @@ +name: experimental + +on: + pull_request: + push: + branches: + - master + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +env: + NPROC: 2 + MAKEFLAGS: "-j${NPROC}" + NIMFLAGS: "--parallelBuild:${NPROC}" + EXPERIMENTAL: "true" + +jobs: + changes: # changes detection + runs-on: ubuntu-latest + permissions: + pull-requests: read + steps: + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + common: + - '.github/workflows/**' + - 'vendor/**' + - 'Makefile' + - 'waku.nimble' + + v2: + - 'waku/common/**' + - 'waku/v2/**' + - 'apps/**' + - 'tools/**' + - 'tests/all_tests_v2.nim' + - 'tests/v2/**' + + outputs: + common: ${{ steps.filter.outputs.common }} + v2: ${{ steps.filter.outputs.v2 }} + + + build-v2: + needs: changes + if: ${{ needs.changes.outputs.v2 == 'true' || needs.changes.outputs.common == 'true' }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + + name: build-v2-${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Get submodule versions + id: submodules + shell: bash + run: | + echo "nim-hash=$(git rev-parse HEAD:vendor/nimbus-build-system)" >> $GITHUB_OUTPUT + echo "zerokit-hash=$(git rev-parse HEAD:vendor/zerokit)" >> $GITHUB_OUTPUT + + - name: Cache nim compiler + uses: actions/cache@v3 + with: + path: vendor/nimbus-build-system/vendor/Nim/bin + key: ${{ runner.os }}-nim-${{ steps.submodules.outputs.nim-hash }} + + - name: Cache zerokit artifacts + uses: actions/cache@v3 + with: + path: vendor/zerokit/target/release + key: ${{ runner.os }}-zerokit-${{ steps.submodules.outputs.zerokit-hash }} + + - name: Build binaries + run: make V=1 LOG_LEVEL=TRACE v2 + + test-v2: + needs: changes + if: ${{ needs.changes.outputs.v2 == 'true' || needs.changes.outputs.common == 'true' }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + + name: test-v2-${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Get submodule versions + id: submodules + shell: bash + run: | + echo "nim-hash=$(git rev-parse HEAD:vendor/nimbus-build-system)" >> $GITHUB_OUTPUT + echo "zerokit-hash=$(git rev-parse HEAD:vendor/zerokit)" >> $GITHUB_OUTPUT + + - name: Cache nim compiler + uses: actions/cache@v3 + with: + path: vendor/nimbus-build-system/vendor/Nim/bin + key: ${{ runner.os }}-nim-${{ steps.submodules.outputs.nim-hash }} + + - name: Cache zerokit artifacts + uses: actions/cache@v3 + with: + path: vendor/zerokit/target/release + key: ${{ runner.os }}-zerokit-${{ steps.submodules.outputs.zerokit-hash }} + + - name: Run tests + run: make V=1 LOG_LEVEL=TRACE test2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..d2f927d2a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,180 @@ +name: ci + +on: + pull_request: + push: + branches: + - master + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +env: + NPROC: 2 + MAKEFLAGS: "-j${NPROC}" + NIMFLAGS: "--parallelBuild:${NPROC}" + +jobs: + changes: # changes detection + runs-on: ubuntu-latest + permissions: + pull-requests: read + steps: + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + common: + - '.github/workflows/**' + - 'vendor/**' + - 'Makefile' + - 'waku.nimble' + + v2: + - 'waku/common/**' + - 'waku/v2/**' + - 'apps/**' + - 'tools/**' + - 'tests/all_tests_v2.nim' + - 'tests/v2/**' + + legacy: + - 'waku/v1/**' + - 'tests/all_tests_v1.nim' + - 'tests/v1/**' + + - 'waku/whisper/**' + - 'tests/whisper/**' + - 'tests/all_tests_whisper.nim' + + outputs: + common: ${{ steps.filter.outputs.common }} + v2: ${{ steps.filter.outputs.v2 }} + legacy: ${{ steps.filter.outputs.legacy }} + + + build-v2: + needs: changes + if: ${{ needs.changes.outputs.v2 == 'true' || needs.changes.outputs.common == 'true' }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + + name: build-v2-${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Get submodules versions + id: submodules + shell: bash + run: | + echo "nim-hash=$(git rev-parse HEAD:vendor/nimbus-build-system)" >> $GITHUB_OUTPUT + + - name: Cache nim + uses: actions/cache@v3 + with: + path: vendor/nimbus-build-system/vendor/Nim/bin + key: ${{ runner.os }}-nim-${{ steps.submodules.outputs.nim-hash }} + + - name: Build binaries + run: make V=1 LOG_LEVEL=TRACE v2 + + test-v2: + needs: changes + if: ${{ needs.changes.outputs.v2 == 'true' || needs.changes.outputs.common == 'true' }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + + name: test-v2-${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Get submodules versions + id: submodules + shell: bash + run: | + echo "nim-hash=$(git rev-parse HEAD:vendor/nimbus-build-system)" >> $GITHUB_OUTPUT + + - name: Cache nim + uses: actions/cache@v3 + with: + path: vendor/nimbus-build-system/vendor/Nim/bin + key: ${{ runner.os }}-nim-${{ steps.submodules.outputs.nim-hash }} + + - name: Run tests + run: make V=1 LOG_LEVEL=TRACE test2 + + + build-legacy: + needs: changes + if: ${{ needs.changes.outputs.legacy == 'true' || needs.changes.outputs.common == 'true' }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + + name: build-legacy-${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Get submodule versions + id: submodules + shell: bash + run: | + echo "nim-hash=$(git rev-parse HEAD:vendor/nimbus-build-system)" >> $GITHUB_OUTPUT + + - name: Cache nim + uses: actions/cache@v3 + with: + path: vendor/nimbus-build-system/vendor/Nim/bin + key: ${{ runner.os }}-nim-${{ steps.submodules.outputs.nim-hash }} + + - name: Build binaries + run: make V=1 LOG_LEVEL=TRACE v1 + + test-legacy: + needs: changes + if: ${{ needs.changes.outputs.legacy == 'true' || needs.changes.outputs.common == 'true' }} + strategy: + matrix: + platform: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + + name: test-legacy-${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Get submodule vesions + id: submodules + shell: bash + run: | + echo "nim-hash=$(git rev-parse HEAD:vendor/nimbus-build-system)" >> $GITHUB_OUTPUT + + - name: Cache nim + uses: actions/cache@v3 + with: + path: vendor/nimbus-build-system/vendor/Nim/bin + key: ${{ runner.os }}-nim-${{ steps.submodules.outputs.nim-hash }} + + - name: Run tests + run: make V=1 LOG_LEVEL=TRACE test1 diff --git a/.github/workflows/test1-ignore.yml b/.github/workflows/test1-ignore.yml deleted file mode 100644 index cb456cf11..000000000 --- a/.github/workflows/test1-ignore.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: test1 - -on: - pull_request: - paths: - - 'waku/v2/**' - - 'tests/all_tests_v2.nim' - - 'tests/v2/**' - - - 'ci/**' - - 'metrics/**' - - 'docs/**' - - '**.md' - push: - branches: - - master - paths: - - 'ci/**' - - 'metrics/**' - - 'docs/**' - - '**.md' - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - - -jobs: - test: - strategy: - matrix: - platform: [ubuntu-latest, macos-latest] - runs-on: ${{ matrix.platform }} - - name: ${{ github.workflow }}-${{ matrix.platform }} - steps: - - run: 'echo "No test required"' \ No newline at end of file diff --git a/.github/workflows/test1.yml b/.github/workflows/test1.yml deleted file mode 100644 index 3e58face6..000000000 --- a/.github/workflows/test1.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: test1 - -on: - pull_request: - paths-ignore: - - 'waku/v2/**' - - 'tests/all_tests_v2.nim' - - 'tests/v2/**' - - - 'ci/**' - - 'metrics/**' - - 'docs/**' - - '**.md' - push: - branches: - - master - paths-ignore: - - 'ci/**' - - 'metrics/**' - - 'docs/**' - - '**.md' - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - - -jobs: - test: - strategy: - matrix: - env: - - NPROC: 2 - MAKEFLAGS: "-j${NPROC}" - NIMFLAGS: "--parallelBuild:${NPROC}" - platform: [ubuntu-latest, macos-latest] - runs-on: ${{ matrix.platform }} - env: ${{ matrix.env }} - timeout-minutes: 60 - - name: ${{ github.workflow }}-${{ matrix.platform }} - steps: - - name: Checkout code - uses: actions/checkout@v3 - - # We need to do this because of how github cache works - # I am not sure we can move the cache file, so if we do not do this - # make update breaks because the cached compiler is there where the submodules - # are meant to go. - - name: Submodules - run: git submodule update --init --recursive - - - name: Cache nim - uses: actions/cache@v3 - with: - path: vendor/nimbus-build-system/vendor/Nim/bin - key: ${{ runner.os }}-${{ matrix.env.NPROC }}-nim-${{ hashFiles('.gitmodules') }} - - - name: Update dependencies - run: make V=1 update - - - name: Build V1 binaries - run: make LOG_LEVEL=TRACE v1 - - - name: Run V1 Tests - run: make test1 diff --git a/.github/workflows/test2-experimental-ignore.yml b/.github/workflows/test2-experimental-ignore.yml deleted file mode 100644 index 779180947..000000000 --- a/.github/workflows/test2-experimental-ignore.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: test2-experimental - -on: - pull_request: - paths: - - 'waku/v1/**' - - 'tests/all_tests_v1.nim' - - 'tests/v1/**' - - - 'waku/whisper/**' - - 'tests/whisper/**' - - 'tests/all_tests_whisper.nim' - - - 'ci/**' - - 'metrics/**' - - 'docs/**' - - '**.md' - push: - branches: - - master - paths: - - 'ci/**' - - 'metrics/**' - - 'docs/**' - - '**.md' - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - - -jobs: - test: - strategy: - matrix: - platform: [ubuntu-latest, macos-latest] - runs-on: ${{ matrix.platform }} - - name: ${{ github.workflow }}-${{ matrix.platform }} - steps: - - run: 'echo "No test required"' diff --git a/.github/workflows/test2-experimental.yml b/.github/workflows/test2-experimental.yml deleted file mode 100644 index e46db0c27..000000000 --- a/.github/workflows/test2-experimental.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: test2-experimental - -on: - pull_request: - paths-ignore: - - 'waku/v1/**' - - 'tests/all_tests_v1.nim' - - 'tests/v1/**' - - - 'waku/whisper/**' - - 'tests/whisper/**' - - 'tests/all_tests_whisper.nim' - - - 'ci/**' - - 'metrics/**' - - 'docs/**' - - '**.md' - push: - branches: - - master - paths-ignore: - - 'ci/**' - - 'metrics/**' - - 'docs/**' - - '**.md' - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - - -jobs: - test: - strategy: - matrix: - env: - - NPROC: 2 - MAKEFLAGS: "-j${NPROC}" - NIMFLAGS: "--parallelBuild:${NPROC}" - EXPERIMENTAL: "true" - platform: [ubuntu-latest, macos-latest] - runs-on: ${{ matrix.platform }} - env: ${{ matrix.env }} - timeout-minutes: 60 - - name: ${{ github.workflow }}-${{ matrix.platform }} - steps: - - name: Checkout code - uses: actions/checkout@v3 - - # We need to do this because of how github cache works - # I am not sure we can move the cache file, so if we do not do this - # make update breaks because the cached compiler is there where the submodules - # are meant to go. - - name: Submodules - run: git submodule update --init --recursive - - - name: Cache nim - uses: actions/cache@v3 - with: - path: vendor/nimbus-build-system/vendor/Nim/bin - key: ${{ runner.os }}-${{ matrix.env.NPROC }}-nim-${{ hashFiles('.gitmodules') }} - - - name: Update dependencies - run: make V=1 update - - - name: Build V2 binaries - run: make LOG_LEVEL=TRACE v2 - - - name: Run V2 Tests - run: make test2 diff --git a/.github/workflows/test2-ignore.yml b/.github/workflows/test2-ignore.yml deleted file mode 100644 index 5484d1956..000000000 --- a/.github/workflows/test2-ignore.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: test2 - -on: - pull_request: - paths: - - 'waku/v1/**' - - 'tests/all_tests_v1.nim' - - 'tests/v1/**' - - - 'waku/whisper/**' - - 'tests/whisper/**' - - 'tests/all_tests_whisper.nim' - - - 'ci/**' - - 'metrics/**' - - 'docs/**' - - '**.md' - push: - branches: - - master - paths: - - 'ci/**' - - 'metrics/**' - - 'docs/**' - - '**.md' - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - - -jobs: - test: - strategy: - matrix: - platform: [ubuntu-latest, macos-latest] - runs-on: ${{ matrix.platform }} - - name: ${{ github.workflow }}-${{ matrix.platform }} - steps: - - run: 'echo "No test required"' diff --git a/.github/workflows/test2.yml b/.github/workflows/test2.yml deleted file mode 100644 index d093d373a..000000000 --- a/.github/workflows/test2.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: test2 - -on: - pull_request: - paths-ignore: - - 'waku/v1/**' - - 'tests/all_tests_v1.nim' - - 'tests/v1/**' - - - 'waku/whisper/**' - - 'tests/whisper/**' - - 'tests/all_tests_whisper.nim' - - - 'ci/**' - - 'metrics/**' - - 'docs/**' - - '**.md' - push: - branches: - - master - paths-ignore: - - 'ci/**' - - 'metrics/**' - - 'docs/**' - - '**.md' - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - - -jobs: - test: - strategy: - matrix: - env: - - NPROC: 2 - MAKEFLAGS: "-j${NPROC}" - NIMFLAGS: "--parallelBuild:${NPROC}" - platform: [ubuntu-latest, macos-latest] - runs-on: ${{ matrix.platform }} - env: ${{ matrix.env }} - timeout-minutes: 60 - - name: ${{ github.workflow }}-${{ matrix.platform }} - steps: - - name: Checkout code - uses: actions/checkout@v3 - - # We need to do this because of how github cache works - # I am not sure we can move the cache file, so if we do not do this - # make update breaks because the cached compiler is there where the submodules - # are meant to go. - - name: Submodules - run: git submodule update --init --recursive - - - name: Cache nim - uses: actions/cache@v3 - with: - path: vendor/nimbus-build-system/vendor/Nim/bin - key: ${{ runner.os }}-${{ matrix.env.NPROC }}-nim-${{ hashFiles('.gitmodules') }} - - - name: Update dependencies - run: make V=1 update - - - name: Build V2 binaries - run: make LOG_LEVEL=TRACE v2 - - - name: Run V2 Tests - run: make test2