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

convert circleci jobs to github actions #2900

Open
wants to merge 1 commit 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
21 changes: 21 additions & 0 deletions .github/actions/setup-linux/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: setup-linux
description: Setup Miniconda and Java on linux
inputs:
py_version:
description: 'Python version'
required: false
runs:
using: composite
steps:
- uses: "./.github/actions/setup-miniconda"
with:
py_version: "${{ matrix.py_version }}"
- uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '11'
- name: Preparing environment - Other dependency
shell: bash
run: |-
sudo apt-get update
sudo apt-get install -y expect fish zsh
36 changes: 36 additions & 0 deletions .github/actions/setup-macos/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: setup-macos
description: Setup macOS environment
inputs:
py_version:
description: 'Python version'
required: false
runs:
using: composite
steps:
- uses: maxim-lobanov/[email protected]
with:
xcode-version: 13.4.1
- name: Homebrew cache
uses: actions/[email protected]
with:
key: "v1-macos-sys-${{ github.head_ref }}"
path: ~/Library/Caches/Homebrew
- uses: "./.github/actions/setup-miniconda"
with:
py_version: "${{ matrix.py_version }}"
- uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '11'
- name: Preparing environment - Brew
shell: bash
run: |-
brew update
brew upgrade git
brew install fish
brew install zsh
brew cleanup
- name: Preparing environment - Hydra
shell: bash -el {0}
run: |-
conda run -n hydra pip install nox --progress-bar off
27 changes: 27 additions & 0 deletions .github/actions/setup-miniconda/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: setup-miniconda
description: 'Setup Miniconda'
inputs:
py_version:
description: 'Python version'
required: true
runs:
using: composite
steps:
# use my fork of the conda-incubator/setup-miniconda@v3 action
# until this PR is merged: https://github.com/conda-incubator/setup-miniconda/pull/350
- uses: robandpdx-org/setup-miniconda@fix-conda-env-var
with:
activate-environment: hydra
python-version: ${{ inputs.py_version }}
- name: Get Date
shell: bash
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Cache conda
uses: actions/cache@v3
env:
CACHE_NUMBER: 1
with:
path: ${{ env.CONDA }}/envs
key:
v${{ env.CACHE_NUMBER }}-conda-${{ runner.os }}-${{ runner.arch }}-${{ steps.get-date.outputs.today }}
20 changes: 20 additions & 0 deletions .github/actions/setup-windows/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: setup-windows
description: Setup windows environment
inputs:
py_version:
description: 'Python version'
required: false
runs:
using: composite
steps:
- uses: "./.github/actions/setup-miniconda"
with:
py_version: "${{ matrix.py_version }}"
- uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '11'
- name: Preparing environment - Hydra
shell: bash -el {0}
run: |-
pip install nox dataclasses --progress-bar off
194 changes: 194 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
name: facebookresearch/hydra/tests
on:
pull_request:
branches:
- main
jobs:
test_macos:
runs-on: macos-12
strategy:
fail-fast: false
matrix:
py_version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-macos"
with:
py_version: "${{ matrix.py_version }}"
- name: Testing Hydra
run: |-
export NOX_PYTHON_VERSIONS=${{ matrix.py_version }}
pip install nox dataclasses --progress-bar off
if [ -n "${{ github.event.number }}" ]; then
nox -s lint test_tools test_core \
test_jupyter_notebooks lint_plugins test_plugins test_plugins_vs_core -ts
else
nox -s lint test_tools test_core test_jupyter_notebooks -ts
fi
test_linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
py_version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-linux"
with:
py_version: "${{ matrix.py_version }}"
- name: Testing Hydra
run: |-
export NOX_PYTHON_VERSIONS=${{ matrix.py_version }}
pip install nox dataclasses --progress-bar off
if [ -n "${{ github.event.number }}" ]; then
nox -s lint test_tools test_core \
test_jupyter_notebooks lint_plugins test_plugins test_plugins_vs_core -ts
else
nox -s lint test_tools test_core test_jupyter_notebooks -ts
fi
test_win:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
py_version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-windows"
with:
py_version: "${{ matrix.py_version }}"
- name: Testing Hydra
run: |-
$env:NOX_PYTHON_VERSIONS="${{ matrix.py_version }}"
$env:ConEmuDefaultCp=65001
$env:PYTHONIOENCODING="utf_8"
conda activate hydra
If ($env:${{ github.event.number }}) {
nox -s lint test_tools test_core test_jupyter_notebooks lint_plugins test_plugins test_plugins_vs_core -ts
} else {
nox -s lint test_tools test_core test_jupyter_notebooks -ts
}
exit $LASTEXITCODE
## plugin tests
test_plugin_linux:
# True if PR is not from a fork
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
py_version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
plugin:
- hydra_joblib_launcher
- hydra_optuna_sweeper
- hydra_ax_sweeper
- hydra_submitit_launcher
- hydra_nevergrad_sweeper
- hydra_rq_launcher
- hydra_ray_launcher
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-linux"
with:
py_version: "${{ matrix.py_version }}"
- name: "${{ matrix.plugin }}"
run: |-
export PATH="$HOME/miniconda3/envs/hydra/bin:$PATH"
export NOX_PYTHON_VERSIONS=${{ matrix.py_version }}
export PLUGINS=${{ matrix.plugin }}
pip install nox dataclasses --progress-bar off
nox -s lint_plugins test_plugins test_plugins_vs_core -ts
test_plugin_macos:
# True if PR is not from a fork
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: macos-12
strategy:
fail-fast: false
matrix:
py_version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
plugin:
- hydra_joblib_launcher
- hydra_optuna_sweeper
- hydra_ax_sweeper
- hydra_submitit_launcher
- hydra_nevergrad_sweeper
- hydra_rq_launcher
- hydra_ray_launcher
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/[email protected]
- uses: "./.github/actions/setup-macos"
with:
py_version: "${{ matrix.py_version }}"
- name: "${{ matrix.plugin }}"
run: |-
export NOX_PYTHON_VERSIONS=${{ matrix.py_version }}
export PLUGINS=${{ matrix.plugin }}
conda activate hydra
pip install nox dataclasses --progress-bar off
nox -s lint_plugins test_plugins test_plugins_vs_core -ts
test_plugin_win:
# True if PR is not from a fork
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
py_version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
test_plugin:
- hydra_joblib_launcher
- hydra_optuna_sweeper
- hydra_ax_sweeper
- hydra_submitit_launcher
- hydra_nevergrad_sweeper
- hydra_rq_launcher
- hydra_ray_launcher
steps:
- uses: actions/[email protected]
- uses: "./.github/actions/setup-windows"
with:
py_version: "${{ matrix.py_version }}"
- name: "${{ matrix.plugin }}"
run: |-
$env:NOX_PYTHON_VERSIONS="${{ matrix.py_version }}"
$env:ConEmuDefaultCp=65001
$env:PYTHONIOENCODING="utf_8"
$env:PLUGINS="${{ matrix.plugin }}"
conda activate hydra
nox -s lint_plugins test_plugins test_plugins_vs_core -ts
exit $LASTEXITCODE