Skip to content

Commit

Permalink
Add installation test CICD, pin ubuntu image, add python env controll…
Browse files Browse the repository at this point in the history
…ed setup, add packages pre-installation
  • Loading branch information
alexpalms committed Jul 30, 2023
1 parent 628ceb4 commit c65367a
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 8 deletions.
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
71 changes: 71 additions & 0 deletions .github/workflows/installation_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Installation tests

on:
push:
tags:
- "v*.*.*"
branches:
- main
pull_request: {}
schedule:
- cron: '30 2 * * *'

jobs:
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 [ "${{ github.event_name }}" == "schedule" ]; then
echo "package_path=diambra-arena" >> "$GITHUB_ENV"
else
echo "package_path=." >> "$GITHUB_ENV"
fi
- name: Checkout Main Branch and Install Package
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
uses: actions/checkout@v3

- name: Checkout Pull Request Branch and Install Package
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}

- 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
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
4 changes: 3 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: DIAMBRA Arena tests

on:
pull_request: {}

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test_agents.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: DIAMBRA Agents tests

on:
pull_request: {}

Expand Down
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

0 comments on commit c65367a

Please sign in to comment.