From 0251195fd31044f10e9bfeed3aa4162ac03e2c6f Mon Sep 17 00:00:00 2001 From: paulzierep Date: Tue, 5 Nov 2024 12:11:08 +0100 Subject: [PATCH 1/2] update CI, only run on internal PR and Dev push --- .github/workflows/run_tests.yaml | 62 +++++++++++++++++++++++++++++--- sources/README.md | 9 +++++ 2 files changed, 67 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml index 5ca93a36..38d40e0a 100644 --- a/.github/workflows/run_tests.yaml +++ b/.github/workflows/run_tests.yaml @@ -1,9 +1,47 @@ name: Run tests -on: [push, pull_request] + +# This GitHub Actions workflow is designed to automate testing for the project. +# It triggers under two conditions: +# 1. Pull requests targeting the main branch, ensuring that internal changes +# are validated before merging. +# 2. Pushes to the dev branch, allowing for continuous integration +# as changes are made directly to the development branch. +# +# The workflow consists of three main jobs: +# - **test-tools**: Runs tests for tools extracted from the repository. +# - **test-tutorials**: Runs tests for community tutorials. +# - **test-workflows**: Runs tests for workflow scripts. +# +# Each job includes the following steps: +# - Checkout the repository code. +# - Set up the Python environment using the specified version. +# - Install required dependencies. +# - Execute scripts for extraction and filtering of tools, tutorials, or workflows. +# +# This ensures that the code remains reliable and functional as new changes are introduced. + +on: + pull_request: + branches: + - main # Trigger on pull requests targeting the main branch + push: + branches: + - dev # Trigger on pushes to the dev branch jobs: test-tools: runs-on: ubuntu-20.04 + # This job runs tests for tools. + # It checks for internal pull requests targeting the main branch, + # as well as pushes to the dev branch. + # The workflow performs the following steps: + # 1. Checkout the repository code. + # 2. Set up Python environment using the specified version. + # 3. Install required Python packages. + # 4. Extract tools using a provided script. + # 5. Filter community tools using a provided script. + # 6. Format tools into an interactive table and generate a word cloud. + if: github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/dev' strategy: matrix: python-version: ['3.11'] @@ -14,7 +52,7 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install requirement + - name: Install requirements run: python -m pip install -r requirements.txt - name: Tool extraction run: | @@ -27,8 +65,19 @@ jobs: - name: Create interactive table and wordcloud run: | bash sources/bin/format_tools.sh + test-tutorials: runs-on: ubuntu-20.04 + # This job runs tests for tutorials. + # Similar to the tools job, it checks for internal pull requests + # to the main branch and pushes to the dev branch. + # The workflow performs the following steps: + # 1. Checkout the repository code. + # 2. Set up Python environment using the specified version. + # 3. Install required Python packages. + # 4. Extract tutorials using a provided script. + # 5. Filter community tutorials using a provided script. + if: github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/dev' strategy: matrix: python-version: ['3.11'] @@ -38,7 +87,7 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install requirement + - name: Install requirements run: python -m pip install -r requirements.txt - name: Tutorial extraction run: | @@ -48,8 +97,13 @@ jobs: - name: Tutorial filtering run: | bash sources/bin/get_community_tutorials.sh test + test-workflows: runs-on: ubuntu-20.04 + # This job runs tests for workflows. + # It performs the same checks as the other jobs, ensuring + # quality for workflow scripts. + if: github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/dev' strategy: matrix: python-version: ['3.11'] @@ -59,7 +113,7 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install requirement + - name: Install requirements run: python -m pip install -r requirements.txt - name: Workflow extraction run: | diff --git a/sources/README.md b/sources/README.md index 6d353ea7..2cb84a39 100644 --- a/sources/README.md +++ b/sources/README.md @@ -202,6 +202,15 @@ $ python sources/bin/create_interactive_table.py \ ## Development +### Contributing + +To contribute to the CoDex Source code fork the repository, create a branch and add your changes. Then make a +pull request to the **dev branch** of the CoDex repository. Upon review the maintainer will merge your pull request. +Automatic tests will run on the dev branch. +When the tests succeed a maintainer will merge the dev branch into main. Feel free to ping the maintainers to speed up the process. +The reason we are not running the tests directly on the pull request branch is, that this does not allow to access the +GitHub secrets, that are required to run the tests. + ### Tools To make a test run of the tool to check its functionalities follow [Usage](#Usage) to set-up the environnement and the API key, then run From 52cfb80e25870104f4e5496ec233480f02539c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9r=C3=A9nice=20Batut?= Date: Tue, 5 Nov 2024 17:22:46 +0100 Subject: [PATCH 2/2] Update sources/README.md --- sources/README.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sources/README.md b/sources/README.md index 2cb84a39..53b7bd16 100644 --- a/sources/README.md +++ b/sources/README.md @@ -204,12 +204,17 @@ $ python sources/bin/create_interactive_table.py \ ### Contributing -To contribute to the CoDex Source code fork the repository, create a branch and add your changes. Then make a -pull request to the **dev branch** of the CoDex repository. Upon review the maintainer will merge your pull request. +To contribute to the CoDex Source code: +1. fork the repository, +2. create a branch and add your changes +3. make a pull request to the **dev branch** of the CoDex repository. + +Upon review the maintainer will merge your pull request. Automatic tests will run on the dev branch. + When the tests succeed a maintainer will merge the dev branch into main. Feel free to ping the maintainers to speed up the process. -The reason we are not running the tests directly on the pull request branch is, that this does not allow to access the -GitHub secrets, that are required to run the tests. + +The reason we are not running the tests directly on the pull request branch is, that this does not allow to access the GitHub secrets, that are required to run the tests. ### Tools