Update GitHub workflows

pull/443/head
Wyatt Stanke 9 months ago
parent f565953899
commit f17bb15c70
No known key found for this signature in database
GPG Key ID: CE6BA5FFF135536D

@ -1,23 +0,0 @@
---
name: Run pytest
on:
schedule:
# This will run the job every day at a random minute past the hour
- cron: '0 0 * * *'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install swarms
- name: Run tests
run: pytest

@ -24,3 +24,10 @@ jobs:
- run: pip install ruff - run: pip install ruff
- run: ruff format . - run: ruff format .
- run: ruff check --fix . - run: ruff check --fix .
pylint-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: pip install pylint
- run: pylint .

@ -1,22 +0,0 @@
---
name: Pylint
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')

@ -1,35 +0,0 @@
---
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest swarms
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest

@ -1,38 +0,0 @@
---
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade swarms
python -m pip install flake8 pytest swarms
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |-
pytest

@ -7,23 +7,33 @@ on:
branches: [main] branches: [main]
schedule: schedule:
# Runs at 3:00 AM UTC every day # Runs at 3:00 AM UTC every day
- cron: '0 3 * * *' - cron: "0 3 * * *"
jobs: jobs:
run-examples: run-examples:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup Python - name: Install Python
uses: actions/setup-python@v5 uses: actions/setup-python@v4
with: - name: Install Poetry
python-version: '3.9' uses: snok/install-poetry@v1
- name: Install dependencies - name: Setup a local virtual environment
run: | run: |
pip install -r requirements.txt poetry config virtualenvs.create true --local
# Assuming your script might also need pytest and swarms poetry config virtualenvs.in-project true --local
pip install pytest - uses: actions/cache@v3
pip install swarms name: Define a cache for the virtual environment
file
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install
- name: Install OpenCV
run: sudo apt-get install python3-opencv
- name: Enter the virtual environment
run: source $VENV
- name: Make Script Executable and Run - name: Make Script Executable and Run
run: |- run: |-
chmod +x ./swarms/scripts/run_examples.sh chmod +x ./scripts/run_examples.sh
./swarms/scripts/run_examples.sh ./scripts/run_examples.sh

@ -7,7 +7,8 @@
name: Mark stale issues and pull requests name: Mark stale issues and pull requests
on: on:
schedule: schedule:
- cron: '26 12 * * *' # Scheduled to run at 1.30 UTC everyday
- cron: '30 1 * * *'
jobs: jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -18,7 +19,31 @@ jobs:
- uses: actions/stale@v9 - uses: actions/stale@v9
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Stale issue message' days-before-issue-stale: 14
stale-pr-message: 'Stale pull request message' days-before-issue-close: 14
stale-issue-label: 'no-issue-activity' stale-issue-label: "status:stale"
stale-pr-label: 'no-pr-activity' close-issue-reason: not_planned
any-of-labels: "status:awaiting user response,status:more data needed"
stale-issue-message: >
Marking this issue as stale since it has been open for 14 days with no
activity. This issue will be closed if no further activity occurs.
close-issue-message: >
This issue was closed because it has been inactive for 28 days. Please
post a new issue if you need further assistance. Thanks!
days-before-pr-stale: 14
days-before-pr-close: 14
stale-pr-label: "status:stale"
stale-pr-message: >
Marking this pull request as stale since it has been open for 14 days
with no activity. This PR will be closed if no further activity occurs.
close-pr-message: >
This pull request was closed because it has been inactive for 28 days.
Please open a new pull request if you need further assistance. Thanks!
# Label that can be assigned to issues to exclude them from being marked as stale
exempt-issue-labels: 'override-stale'
# Label that can be assigned to PRs to exclude them from being marked as stale
exempt-pr-labels: "override-stale"

@ -1,49 +0,0 @@
---
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests
on:
schedule:
# Scheduled to run at 1.30 UTC everyday
- cron: '30 1 * * *'
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-issue-stale: 14
days-before-issue-close: 14
stale-issue-label: "status:stale"
close-issue-reason: not_planned
any-of-labels: "status:awaiting user response,status:more data needed"
stale-issue-message: >
Marking this issue as stale since it has been open for 14 days with no
activity. This issue will be closed if no further activity occurs.
close-issue-message: >
This issue was closed because it has been inactive for 28 days. Please
post a new issue if you need further assistance. Thanks!
days-before-pr-stale: 14
days-before-pr-close: 14
stale-pr-label: "status:stale"
stale-pr-message: >
Marking this pull request as stale since it has been open for 14 days
with no activity. This PR will be closed if no further activity occurs.
close-pr-message: >
This pull request was closed because it has been inactive for 28 days.
Please open a new pull request if you need further assistance. Thanks!
# Label that can be assigned to issues to exclude them from being marked as stale
exempt-issue-labels: 'override-stale'
# Label that can be assigned to PRs to exclude them from being marked as stale
exempt-pr-labels: "override-stale"

@ -1,5 +1,8 @@
name: Tests name: Tests
on: [push] on:
push:
schedule:
- cron: "0 0 * * *"
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest

@ -9,10 +9,10 @@ for f in /swarms/playground/examples/example_*.py; do
echo "Skipping ${f} as it ran successfully in a previous run." echo "Skipping ${f} as it ran successfully in a previous run."
else else
# Run the script if not previously successful # Run the script if not previously successful
if /home/kye/miniconda3/envs/swarms/bin/python "$f" 2>>errors.txt; then if python "$f" 2>>errors.txt; then
echo "(${f}) ran successfully without errors." echo "(${f}) ran successfully without errors."
# Log the successful script execution # Log the successful script execution
echo "$f" >> "$SUCCESS_LOG" echo "$f" >>"$SUCCESS_LOG"
else else
echo "Error encountered in ${f}. Check errors.txt for details." echo "Error encountered in ${f}. Check errors.txt for details."
break break

Loading…
Cancel
Save