-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: grapebaba <[email protected]>
- Loading branch information
Showing
8 changed files
with
106 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Build the project | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
source scripts/install.sh | ||
- name: Check with ruff | ||
run: | | ||
make check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/optimism | ||
/__pycache__ | ||
/.idea | ||
/venv | ||
/.ruff_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
linter: ## Run linter | ||
@ruff check . | ||
.PHONY: linter | ||
|
||
check: linter ## Run check | ||
.PHONY: check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
line-length = 110 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Description: This script is used to setup the development environment for the project. | ||
|
||
|
||
check_python_version() { | ||
# Check python version if greater or equal than 3.10, otherwise exit | ||
python_version=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') | ||
if python3 -c "import sys; sys.exit(not (sys.version_info >= (3, 10)))"; then | ||
echo "Python version is $python_version" | ||
else | ||
echo "Python version is $python_version, but 3.10 or greater is required" | ||
exit 1 | ||
fi | ||
} | ||
|
||
activate_venv() { | ||
# Check if venv directory exists, otherwise create it. Then activate venv | ||
if [ -d "venv" ]; then | ||
echo "venv directory exists" | ||
else | ||
echo "venv directory does not exist, creating it now" | ||
python3 -m venv venv | ||
fi | ||
echo "activating venv" | ||
source ./venv/bin/activate | ||
} | ||
|
||
install_dev_dependencies() { | ||
# Install development dependencies | ||
echo "installing development dependencies" | ||
# Check if pip3 version is greater or equal than 21.2.4, otherwise upgrade it | ||
pip3_version=$(pip3 --version | awk '{print $2}') | ||
if python3 -c "import sys; sys.exit(not (sys.version_info >= (21, 2, 4)))"; then | ||
echo "pip3 version is $pip3_version" | ||
else | ||
echo "pip3 version is $pip3_version, but 21.2.4 or greater is required" | ||
pip3 install --upgrade pip | ||
fi | ||
# Check if ruff is installed, otherwise install it | ||
if ! command -v ruff &> /dev/null | ||
then | ||
echo "ruff could not be found, installing it now" | ||
pip3 install ruff | ||
else | ||
echo "ruff is installed" | ||
fi | ||
} | ||
|
||
check_python_version | ||
activate_venv | ||
install_dev_dependencies | ||
|