Skip to content

Commit

Permalink
Use requirements.txt in workflows
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 704732399
Change-Id: I535d649eb91d50aa3278d2939e967999499b6f84
  • Loading branch information
jagapiou authored and copybara-github committed Dec 10, 2024
1 parent 9175e28 commit 31c8c60
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 73 deletions.
57 changes: 0 additions & 57 deletions .github/actions/install-examples/action.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: install-meltingpot
name: install

inputs:
python-version:
Expand Down Expand Up @@ -34,16 +34,16 @@ runs:
else
exit 1
fi
echo "key=${name}-${version}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('setup.py') }}" >> $GITHUB_OUTPUT
echo "key=${name}-${version}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}" >> $GITHUB_OUTPUT
- name: Restore Melting Pot installation
- name: Restore installation
id: restore
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
with:
path: |
meltingpot/assets
venv
key: install-meltingpot-${{ steps.cache-key.outputs.key }}
key: install-${{ steps.cache-key.outputs.key }}

- name: Create venv
if: steps.restore.outputs.cache-hit != 'true'
Expand All @@ -56,11 +56,12 @@ runs:
run: |
echo "${PWD}/venv/bin" >> $GITHUB_PATH
- name: Install Melting Pot
- name: Install
if: steps.restore.outputs.cache-hit != 'true'
shell: bash
run: |
pip install --editable .[dev]
pip install --require-virtualenv --require-hashes -r requirements.txt
pip install --require-virtualenv --no-deps --no-index --no-build-isolation --editable .
- name: Show installation
shell: bash
Expand All @@ -77,7 +78,7 @@ runs:
pytype --version
pip list
- name: Save Melting Pot installation
- name: Save installation
if: steps.restore.outputs.cache-hit != 'true'
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ on:
branches:
- main
paths:
- '.github/actions/install-examples/action.yml'
- '.github/actions/install-meltingpot/action.yml'
- '.github/actions/install/action.yml'
- '.github/workflows/test-examples.yml'
- '.pylintrc'
- 'examples/**'
- 'meltingpot/**'
- 'pyproject.toml'
- 'requirements.txt'
- 'setup.py'
pull_request:
branches:
- main
paths:
- '.github/actions/install-examples.yml'
- '.github/actions/install-meltingpot.yml'
- '.github/actions/install/action.yml'
- '.github/workflows/test-examples.yml'
- '.pylintrc'
- 'examples/**'
- 'meltingpot/**'
- 'pyproject.toml'
- 'requirements.txt'
- 'setup.py'
workflow_dispatch:

Expand All @@ -42,8 +42,8 @@ jobs:
- name: Checkout Melting Pot
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938

- name: Install examples
uses: ./.github/actions/install-examples
- name: Install Melting Pot
uses: ./.github/actions/install

- name: Test examples
run: pytest examples
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/test-meltingpot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@ on:
branches:
- main
paths:
- '.github/actions/install-meltingpot/action.yml'
- '.github/actions/install/action.yml'
- '.github/workflows/test-meltingpot.yml'
- '.pylintrc'
- 'meltingpot/**'
- 'pyproject.toml'
- 'requirements.txt'
- 'setup.py'
pull_request:
branches:
- main
paths:
- '.github/actions/install-meltingpot/action.yml'
- '.github/actions/install/action.yml'
- '.github/workflows/test-meltingpot.yml'
- '.pylintrc'
- 'meltingpot/**'
- 'pyproject.toml'
- 'requirements.txt'
- 'setup.py'
workflow_dispatch:

Expand All @@ -38,7 +40,7 @@ jobs:
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938

- name: Install Melting Pot
uses: ./.github/actions/install-meltingpot
uses: ./.github/actions/install

- name: Test Melting Pot
run: pytest meltingpot
Expand Down

0 comments on commit 31c8c60

Please sign in to comment.