Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add installation test CICD and pin ubuntu image #86

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs-rebuild.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: docs-rebuild-deploy
name: Documentation build & deploy trigger

on:
push:
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/images.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Dependencies images

on:
push:
tags:
Expand All @@ -10,7 +12,7 @@ on:
jobs:
generate-matrix:
name: Generate build matrix
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
Expand All @@ -22,7 +24,7 @@ jobs:

build-and-push-arena-images:
needs: [generate-matrix]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
if: ${{ needs.generate-matrix.outputs.matrix != '[]' }}
strategy:
fail-fast: true
Expand All @@ -31,7 +33,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Login to GHCR
uses: docker/login-action@v2
Expand Down Expand Up @@ -76,7 +78,7 @@ jobs:
build-and-push-agents-images:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [build-and-push-arena-images]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Build and Push Agents Images
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Python package Pypi release

on:
push:
tags:
Expand All @@ -8,7 +10,7 @@ on:

jobs:
release:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/reusable_agents_unit_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Reusable agents unit tests

on:
workflow_call:
inputs:
arena_branch:
required: true
type: string

jobs:
reusable_agents_unit_tests:
name: Reusable agents unit tests
uses: diambra/agents/.github/workflows/reusable-test.yaml@main
with:
arena_requirement_specifier: 'git+https://github.com/diambra/arena.git@${{ inputs.arena_branch }}#egg='
agents_ref: 'main'
68 changes: 68 additions & 0 deletions .github/workflows/reusable_arena_installation_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Reusable arena installation tests

on:
workflow_call:
inputs:
arena_branch:
required: true
type: string
package:
required: false
type: string

jobs:
reusable_arena_installation_tests:
name: Reusable arena installation tests
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
installation-option: ['basic', 'stable-baselines', 'stable-baselines3', 'ray-rllib']
python-packages-version: ['default', 'latest']

steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Setup environment configuration (default or latest)
run: |
if [ "${{ matrix.python-packages-version }}" == 'latest' ]; then
python3 -m pip install -U pip
python3 -m pip install -U setuptools
fi
pip list

- name: Pre-install packages needed because of various deprecations deprecation
run: |
python3 -m pip install -U wheel # Deprecated setup.py installation need to move to pyproject.toml
python3 -m pip install wheel==0.38.4 # Deprecated format of gym==0.21 setup.py
python3 -m pip install setuptools==66.0.0 # Deprecated format of gym==0.21 setup.py
pip list

- name: Define package path
id: set_package_path
run: |
if [ "${{ inputs.package }}" == "yes" ]; then
echo "package_path=diambra-arena" >> "$GITHUB_ENV"
else
echo "package_path=." >> "$GITHUB_ENV"
fi

- name: Checkout selected branch
if: ${{ inputs.package }} != "yes"
uses: actions/checkout@v3
with:
ref: "${{ inputs.arena_branch }}"

- name: Install Package via pip
if: ( ( ( matrix.installation-option == 'stable-baselines' || matrix.installation-option == 'basic' ) && matrix.python-version == '3.7' ) ||
( matrix.installation-option != 'stable-baselines' && matrix.python-version != '3.7' ) )
run: |
if [ "${{ matrix.installation-option }}" == "basic" ]; then
pip install ${{ env.package_path }}
else
pip install ${{ env.package_path }}[${{ matrix.installation-option }}]
fi
pip list
45 changes: 45 additions & 0 deletions .github/workflows/reusable_arena_unit_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Reusable arena unit tests

on:
workflow_call:
inputs:
arena_branch:
required: true
type: string

jobs:
reusable_arena_unit_tests:
name: Reusable arena unit tests
runs-on: ubuntu-22.04
strategy:
matrix:
python_version: ['3.7', '3.8', '3.9', '3.10']

steps:
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}

- name: Pre-install pinned packages for deprecations
run: |
python3 -m pip install wheel==0.38.4 setuptools==66.0.0
pip list

- name: Checkout target branch
uses: actions/checkout@v3
with:
ref: "${{ inputs.arena_branch }}"

- name: Install tests dependencies
run: |
python3 -m pip install .["tests"]
pip list

- name: Run tests
run: |
pytest tests/test_gym_settings.py
pytest tests/test_wrappers_settings.py
pytest tests/test_recording_settings.py
pytest tests/test_random.py
pytest tests/test_speed.py
18 changes: 0 additions & 18 deletions .github/workflows/test.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions .github/workflows/test_agents.yaml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/test_main_branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Main branch tests

on:
#push:
# branches:
# - main
#schedule:
# - cron: '30 2 * * *'
workflow_dispatch:
pull_request:

jobs:
arena-unit-tests:
name: Arena unit tests
uses: ./.github/workflows/reusable_arena_unit_tests.yaml
with:
arena_branch: 'main'
agents-unit-tests:
name: Agents unit tests
uses: ./.github/workflows/reusable_agents_unit_tests.yaml
with:
arena_branch: 'main'
arena-installation-tests:
name: Arena installation tests
uses: ./.github/workflows/reusable_arena_installation_tests.yaml
with:
arena_branch: 'main'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
install_requires=[
'pip>=21',
'importlib-metadata<=4.12.0; python_version <= "3.7"', # problem with gym for importlib-metadata==5.0.0 and python <=3.7
'setuptools<=66.0.0', # Required until we can upgrade to gym >= 0.22.0
'setuptools',
'distro>=1',
'gym<=0.21.0',
'inputs',
Expand Down
Loading