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

Standardized dependency installation for GitHub actions #921

Draft
wants to merge 57 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
89e00df
Merge pull request #6 from scap3yvt/884-feature-update-pytorch-depend…
scap3yvt Aug 15, 2024
f8e17fb
all should be at latest long-term stable tag
scap3yvt Aug 15, 2024
94df3a8
added dependency workflow
scap3yvt Aug 15, 2024
c6cc953
using the base actions for the rest
scap3yvt Aug 15, 2024
7128da9
Merge branch 'master' into 920-feature-standardize-dependency-install…
sarthakpati Aug 15, 2024
14c057f
checking if this syntax works
scap3yvt Aug 15, 2024
5acc9bf
fixed file name
scap3yvt Aug 15, 2024
e46dad8
actions/checkout should be in the main workflow
scap3yvt Aug 15, 2024
310816a
trying something
scap3yvt Aug 15, 2024
0e7e760
check again
scap3yvt Aug 15, 2024
2e6fb85
checking again
scap3yvt Aug 15, 2024
7709921
checking again
scap3yvt Aug 15, 2024
473fefc
checking again
scap3yvt Aug 15, 2024
7904fa5
check ls
scap3yvt Aug 15, 2024
3d81947
check again
scap3yvt Aug 15, 2024
cea3c63
check again
scap3yvt Aug 15, 2024
f73bb24
checking with same filename
scap3yvt Aug 15, 2024
31d9a54
checking again
scap3yvt Aug 15, 2024
dcee7fc
revert
scap3yvt Aug 15, 2024
ad91451
checking if this helps
scap3yvt Aug 15, 2024
c95c116
Merge branch 'master' into 920-feature-standardize-dependency-install…
scap3yvt Aug 16, 2024
51afcf5
trying another thing
scap3yvt Aug 16, 2024
c078629
checking if using composite action helps
scap3yvt Aug 16, 2024
3a8e32c
rename
scap3yvt Aug 16, 2024
4206de4
added shell
scap3yvt Aug 16, 2024
212b96c
testing another thing
scap3yvt Aug 16, 2024
a362bc1
let's see what happens here
scap3yvt Aug 16, 2024
1676656
updated version to use
scap3yvt Aug 16, 2024
dfc600b
updated action to show extra output, updated workflows to use new com…
scap3yvt Aug 16, 2024
5cb3f00
added more files to check
scap3yvt Aug 16, 2024
13869a4
revert
scap3yvt Aug 16, 2024
6b5739d
checking if full CI gets triggered --- should be reverted
scap3yvt Aug 16, 2024
1997dee
new version to ensure editable version
scap3yvt Aug 16, 2024
007bf0d
updated logic to test for changed non-doc files
scap3yvt Aug 16, 2024
d273d32
checking logic update
scap3yvt Aug 16, 2024
cee58bf
updated output variable
scap3yvt Aug 16, 2024
b13d589
checking another mechanism
scap3yvt Aug 16, 2024
bc3c349
checking by putting the variable saving in another step
scap3yvt Aug 16, 2024
1fa6581
testing outputs
scap3yvt Aug 16, 2024
625eac2
trying something else
scap3yvt Aug 16, 2024
3559fb4
trying another thing
scap3yvt Aug 16, 2024
eb2fb22
changing id
scap3yvt Aug 16, 2024
8ddad9a
debugging
scap3yvt Aug 16, 2024
4a71a89
checking different syntax
scap3yvt Aug 16, 2024
2535dd3
Merge branch 'master' into 920-feature-standardize-dependency-install…
Geeks-Sid Aug 21, 2024
7cfb2ac
Merge branch 'mlcommons:master' into 920-feature-standardize-dependen…
scap3yvt Sep 23, 2024
50abfd0
Merge branch 'master' into 920-feature-standardize-dependency-install…
scap3yvt Sep 24, 2024
0058078
trying solution in https://github.com/orgs/community/discussions/11771
scap3yvt Sep 24, 2024
6c98878
trying suggestion
scap3yvt Sep 26, 2024
6dcb535
trying copilot suggestion
scap3yvt Sep 26, 2024
01b644a
removed the specific lines altogether to see what happens
scap3yvt Sep 27, 2024
ac26401
let's add the shell
scap3yvt Sep 27, 2024
1cd823b
added a debug
scap3yvt Sep 27, 2024
c97e734
testing if `other_modified_files_count` gets picked up correctly or not
scap3yvt Sep 27, 2024
ad9f93e
trying another solution
scap3yvt Sep 30, 2024
b4fd967
copy-paste suggestion
scap3yvt Sep 30, 2024
0449d98
Merge branch 'master' into 920-feature-standardize-dependency-install…
scap3yvt Oct 1, 2024
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/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Extract black version from setup.py
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
103 changes: 103 additions & 0 deletions .github/workflows/dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: 'Install Dependencies'

description: 'Setup and install dependencies for GaNDLF'

outputs:
files-changed:
description: "Which files have changed"
value: ${{ steps.changed-files.outputs.other_modified_files_count }}
# on:
# workflow_call:

# jobs:
# install_dependencies:
# runs-on: ubuntu-latest
runs:
using: "composite"
steps:
- name: Free space
shell: bash
run: |
df -h
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf "$ANDROID_SDK_ROOT"
df -h

# - name: Checkout code
# uses: actions/checkout@v4

# Use changed-files-specific action to collect file changes.
# The following commented condition applied to a step will run that step only if non-docs files have changed.
# It should be applied to all functionality-related steps.
# if: ${{steps.dependencies.outputs.other_modified_files_count > 0}}
- name: Detect and screen file changes
# shell: bash
id: changed-files-specific
uses: tj-actions/changed-files@v44
with:
files: |
.github/*.md
.github/ISSUE_TEMPLATE/*.md
.github/workflows/devcontainer.yml
.github/workflows/docker-image.yml
.devcontainer/**
docs/**
mlcube/**
*.md
LICENSE
Dockerfile-*
# run: |
# echo "other_modified_files_count=$(echo ${{ steps.changed-files-specific.outputs.other_modified_files_count }})" >> $GITHUB_OUTPUT

- name: Summarize docs and non-docs modifications
id: changed-files
shell: bash
run: |
echo "List of docs files that have changed: ${{ steps.changed-files-specific.outputs.all_modified_files }}"
echo "Changed non-docs files: ${{ steps.changed-files-specific.outputs.other_modified_files }}"
echo "Count of non-docs files changed: ${{ steps.changed-files-specific.outputs.other_modified_files_count }}"
echo "If only-modified is triggered: ${{ steps.changed-files-specific.outputs.only_modified }}"
echo "other_modified_files_count=${{ steps.changed-files-specific.outputs.other_modified_files_count }}" >> $GITHUB_OUTPUT
echo "$GITHUB_OUTPUT"


## this did NOT work
# - name: Set output
# shell: bash
# run: echo "other_modified_files_count=${{ steps.changed-files-specific.outputs.other_modified_files_count }}" >> $GITHUB_OUTPUT

## this did NOT work
# - name: Check saved output
# shell: bash
# run: echo "GITHUB_OUTPUT:${{ GITHUB_OUTPUT }}"

# This second step is unnecessary but highly recommended because
# It will cache database and saves time re-downloading it if database isn't stale.
- name: Cache pip
# shell: bash
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Set up Python 3.9
# shell: bash
if: ${{steps.changed-files.outputs.other_modified_files_count > 0}} # Run on any non-docs change
uses: actions/setup-python@v5
with:
python-version: 3.9

- name: Install dependencies and package
shell: bash
if: ${{steps.changed-files.outputs.other_modified_files_count > 0}} # Run on any non-docs change
run: |
sudo apt-get update
sudo apt-get install libvips libvips-tools -y
python -m pip install --upgrade pip==24.0
python -m pip install wheel
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cpu
pip install -e .
2 changes: 1 addition & 1 deletion .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
df -h

- name: Checkout (GitHub)
uses: actions/checkout@v3
uses: actions/checkout@v4

# Use changed-files-specific action to collect file changes.
# The following commented condition applied to a step will run that step only if non-docs files have changed.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

steps:
- name: Check out the repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
lfs: true
submodules: 'recursive'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.x
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down
65 changes: 6 additions & 59 deletions .github/workflows/mlcube-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,68 +12,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Free space
run: |
df -h
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf "$ANDROID_SDK_ROOT"
df -h
- name: Checkout
uses: actions/checkout@v3

# Use changed-files-specific action to collect file changes.
# The following commented condition applied to a step will run that step only if non-docs files have changed.
# It should be applied to all functionality-related steps.
# if: steps.changed-files-specific.outputs.only_modified == 'false'
- name: Detect and screen file changes
id: changed-files-specific
uses: tj-actions/changed-files@v41
with:
files: |
.github/*.md
.github/ISSUE_TEMPLATE/*.md
.github/workflows/devcontainer.yml
.github/workflows/docker-image.yml
.devcontainer/**
docs/**
mlcube/**
*.md
LICENSE
Dockerfile-*
- name: Checkout code
uses: actions/checkout@v4

- name: Summarize docs and non-docs modifications
run: |
echo "List of docs files that have changed: ${{ steps.changed-files-specific.outputs.all_modified_files }}"
echo "Changed non-docs files: ${{ steps.changed-files-specific.outputs.other_modified_files }}"
- name: Call reusable workflow to install dependencies
id: dependencies
uses: ./.github/workflows/dependencies

# This second step is unnecessary but highly recommended because
# It will cache database and saves time re-downloading it if database isn't stale.
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python 3.9
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies and package
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change
run: |
sudo apt-get update
sudo apt-get install libvips libvips-tools -y
python -m pip install --upgrade pip==24.0
python -m pip install wheel
python -m pip install openvino-dev==2023.0.1 mlcube_docker
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cpu
pip install -e .
- name: Run mlcube deploy tests
working-directory: ./testing
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change
if: ${{steps.dependencies.outputs.other_modified_files_count > 0}} # Run on any non-docs change
run: |
sh test_deploy.sh
67 changes: 8 additions & 59 deletions .github/workflows/openfl-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,72 +17,21 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Free space
run: |
df -h
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf "$ANDROID_SDK_ROOT"
df -h
- name: Checkout
uses: actions/checkout@v3

# Use changed-files-specific action to collect file changes.
# The following commented condition applied to a step will run that step only if non-docs files have changed.
# It should be applied to all functionality-related steps.
# if: steps.changed-files-specific.outputs.only_modified == 'false'
- name: Detect and screen file changes
id: changed-files-specific
uses: tj-actions/changed-files@v41
with:
files: |
.github/*.md
.github/ISSUE_TEMPLATE/*.md
.github/workflows/devcontainer.yml
.github/workflows/docker-image.yml
.devcontainer/**
docs/**
mlcube/**
*.md
LICENSE
Dockerfile-*
- name: Checkout code
uses: actions/checkout@v4

- name: Summarize docs and non-docs modifications
run: |
echo "List of docs files that have changed: ${{ steps.changed-files-specific.outputs.all_modified_files }}"
echo "Changed non-docs files: ${{ steps.changed-files-specific.outputs.other_modified_files }}"
- name: Call reusable workflow to install dependencies
id: dependencies
uses: ./.github/workflows/dependencies

# This second step is unnecessary but highly recommended because
# It will cache database and saves time re-downloading it if database isn't stale.
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python 3.9
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies and package
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change
run: |
sudo apt-get update
sudo apt-get install libvips libvips-tools -y
python -m pip install --upgrade pip==24.0
python -m pip install wheel
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cpu
pip install -e .
- name: Run generic unit tests to download data and construct CSVs
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change
if: ${{steps.dependencies.outputs.other_modified_files_count > 0}} # Run on any non-docs change
run: |
pytest --cov=. --cov-report=xml -k "prepare_data_for_ci"

# openfl tests start here
- name: Run OpenFL tests
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change
if: ${{steps.dependencies.outputs.other_modified_files_count > 0}} # Run on any non-docs change
run: |
echo "Removing onnx because of protobuf version conflict"
pip uninstall onnx -y
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ossar-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# Ensure a compatible version of dotnet is installed.
# The [Microsoft Security Code Analysis CLI](https://aka.ms/mscadocs) is built with dotnet v3.1.201.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: master

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-install-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
Expand Down
Loading
Loading