From 9113f49bbd5e5e8ede82d8df0f8a32dd17bb91eb Mon Sep 17 00:00:00 2001 From: Feist Josselin Date: Wed, 2 Oct 2024 14:34:45 +0200 Subject: [PATCH 1/4] Reduce the number of CI tests on PR Everything is still run on a daily basis with cron, but this PR remove unecessary/problematic CI checks on every PR --- .github/workflows/ci.yml | 11 +++--- .github/workflows/ci_pr.yml | 72 +++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ci_pr.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d2ba83d0..24ce1154f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,12 +5,11 @@ defaults: run: shell: bash +# We run all the CI tests only on cron job +# This is to reduce the CI time, and prevent issues +# Like with the etherscan API +# All the test from ci_pr are run here + additional ones on: - push: - branches: - - master - - dev - pull_request: schedule: # run CI every day even if no PRs/merges occur - cron: '0 12 * * *' @@ -31,9 +30,7 @@ jobs: "dapp", "data_dependency", "path_filtering", - # "embark", "erc", - # "etherlime", "etherscan", "find_paths", "flat", diff --git a/.github/workflows/ci_pr.yml b/.github/workflows/ci_pr.yml new file mode 100644 index 000000000..95d088d2a --- /dev/null +++ b/.github/workflows/ci_pr.yml @@ -0,0 +1,72 @@ +--- +name: CI + +defaults: + run: + shell: bash + +on: + push: + branches: + - master + - dev + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + tests: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest", "windows-2022"] + python: ${{ (github.event_name == 'pull_request' && fromJSON('["3.8", "3.12"]')) || fromJSON('["3.8", "3.9", "3.10", "3.11", "3.12"]') }} + type: ["data_dependency", + "path_filtering", + "erc", + "find_paths", + "flat", + "interface", + "printers", + "slither_config", + "upgradability"] + exclude: + # Requires nix + - os: windows-2022 + type: dapp + # Requires nvm + - os: windows-2022 + type: truffle + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: | + pip install ".[test]" + solc-select use 0.4.25 --always-install + solc-select use 0.8.0 --always-install + solc-select use 0.5.1 --always-install + + - name: Set up nix + if: matrix.type == 'dapp' + uses: cachix/install-nix-action@V27 + + - name: Set up cachix + if: matrix.type == 'dapp' + uses: cachix/cachix-action@v15 + with: + name: dapp + + - name: Run Tests + env: + PYTHONUTF8: 1 + TEST_TYPE: ${{ matrix.type }} + GITHUB_ETHERSCAN: ${{ secrets.GITHUB_ETHERSCAN }} + run: | + bash "scripts/ci_test_${TEST_TYPE}.sh" From dfab5ae696a26c2efce9de6cc569d49663af8001 Mon Sep 17 00:00:00 2001 From: Feist Josselin Date: Wed, 2 Oct 2024 14:36:39 +0200 Subject: [PATCH 2/4] Remove windows tests from PR --- .github/workflows/ci_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_pr.yml b/.github/workflows/ci_pr.yml index 95d088d2a..a1a8aadc1 100644 --- a/.github/workflows/ci_pr.yml +++ b/.github/workflows/ci_pr.yml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-latest", "windows-2022"] + os: ["ubuntu-latest"] # Do not run on windows to save time. In practice not many users are on windows, and this is still run on the cron job python: ${{ (github.event_name == 'pull_request' && fromJSON('["3.8", "3.12"]')) || fromJSON('["3.8", "3.9", "3.10", "3.11", "3.12"]') }} type: ["data_dependency", "path_filtering", From 3a6888694d40267e869176d0e97da634b7949add Mon Sep 17 00:00:00 2001 From: Feist Josselin Date: Wed, 2 Oct 2024 14:42:03 +0200 Subject: [PATCH 3/4] Fix CI lint --- .github/workflows/ci_pr.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/ci_pr.yml b/.github/workflows/ci_pr.yml index a1a8aadc1..7ad7d34c8 100644 --- a/.github/workflows/ci_pr.yml +++ b/.github/workflows/ci_pr.yml @@ -33,13 +33,6 @@ jobs: "printers", "slither_config", "upgradability"] - exclude: - # Requires nix - - os: windows-2022 - type: dapp - # Requires nvm - - os: windows-2022 - type: truffle steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python }} From 9122cef24e7c11c7a2363074566d02c3e5085d2b Mon Sep 17 00:00:00 2001 From: Feist Josselin Date: Wed, 2 Oct 2024 15:38:47 +0200 Subject: [PATCH 4/4] Improvements --- .github/workflows/ci.yml | 28 ++++------------ .github/workflows/ci_pr.yml | 65 ------------------------------------- 2 files changed, 7 insertions(+), 86 deletions(-) delete mode 100644 .github/workflows/ci_pr.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24ce1154f..2ee7ee5fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,11 +5,12 @@ defaults: run: shell: bash -# We run all the CI tests only on cron job -# This is to reduce the CI time, and prevent issues -# Like with the etherscan API -# All the test from ci_pr are run here + additional ones on: + push: + branches: + - master + - dev + pull_request: schedule: # run CI every day even if no PRs/merges occur - cron: '0 12 * * *' @@ -24,24 +25,9 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-latest", "windows-2022"] + os: ${{ (github.event_name == 'pull_request' && fromJSON('["ubuntu-latest"]')) || fromJSON('["ubuntu-latest", "windows-2022"]') }} python: ${{ (github.event_name == 'pull_request' && fromJSON('["3.8", "3.12"]')) || fromJSON('["3.8", "3.9", "3.10", "3.11", "3.12"]') }} - type: ["cli", - "dapp", - "data_dependency", - "path_filtering", - "erc", - "etherscan", - "find_paths", - "flat", - "interface", - "kspec", - "printers", - # "prop" - "simil", - "slither_config", - "truffle", - "upgradability"] + type: ${{ (github.event_name == 'pull_request' && fromJSON('["data_dependency", "path_filtering","erc","find_paths","flat","interface", "printers","slither_config","upgradability"]')) || fromJSON('["data_dependency", "path_filtering","erc","find_paths","flat","interface", "printers","slither_config","upgradability", "cli", "dapp", "etherscan", "kspec", "simil", "truffle"]') }} exclude: # Requires nix - os: windows-2022 diff --git a/.github/workflows/ci_pr.yml b/.github/workflows/ci_pr.yml deleted file mode 100644 index 7ad7d34c8..000000000 --- a/.github/workflows/ci_pr.yml +++ /dev/null @@ -1,65 +0,0 @@ ---- -name: CI - -defaults: - run: - shell: bash - -on: - push: - branches: - - master - - dev - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - tests: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: ["ubuntu-latest"] # Do not run on windows to save time. In practice not many users are on windows, and this is still run on the cron job - python: ${{ (github.event_name == 'pull_request' && fromJSON('["3.8", "3.12"]')) || fromJSON('["3.8", "3.9", "3.10", "3.11", "3.12"]') }} - type: ["data_dependency", - "path_filtering", - "erc", - "find_paths", - "flat", - "interface", - "printers", - "slither_config", - "upgradability"] - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - - name: Install dependencies - run: | - pip install ".[test]" - solc-select use 0.4.25 --always-install - solc-select use 0.8.0 --always-install - solc-select use 0.5.1 --always-install - - - name: Set up nix - if: matrix.type == 'dapp' - uses: cachix/install-nix-action@V27 - - - name: Set up cachix - if: matrix.type == 'dapp' - uses: cachix/cachix-action@v15 - with: - name: dapp - - - name: Run Tests - env: - PYTHONUTF8: 1 - TEST_TYPE: ${{ matrix.type }} - GITHUB_ETHERSCAN: ${{ secrets.GITHUB_ETHERSCAN }} - run: | - bash "scripts/ci_test_${TEST_TYPE}.sh"