-
Notifications
You must be signed in to change notification settings - Fork 6
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
Github workflow for PRs #13
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3d61313
Github workflow for PRs
eatpk 33271c1
workflow fix
eatpk 0210b9a
endl
eatpk 958986e
msgpack?
eatpk 91c87e8
3.8 -> 3.9
eatpk 1ff4592
remove msgpack direct install
eatpk 8f8cca3
3.9?
eatpk 3d9ff8b
bugfix
eatpk 53ec81c
3.8
eatpk d49df5e
3.6
eatpk 11fee9c
todo
eatpk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,50 @@ | ||
name: Black Auto-Reformat | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- '**.py' | ||
|
||
jobs: | ||
black-format: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install Black | ||
run: | | ||
pip install --upgrade pip | ||
pip install black | ||
|
||
- name: Format with Black | ||
run: | | ||
CHANGED_FILES=$(git diff --name-only HEAD^..HEAD | grep -E '\.(py)$' || true) | ||
echo "Changed files: ${CHANGED_FILES}" | ||
if [ ! -z "$CHANGED_FILES" ]; then | ||
black $CHANGED_FILES | ||
fi | ||
|
||
- name: Commit and Push Changes | ||
if: success() && github.ref != 'refs/heads/main' | ||
run: | | ||
git config --global user.name 'github-actions' | ||
git config --global user.email 'github-actions@github.com' | ||
git add . | ||
# Check if there are any changes to commit | ||
if git diff --staged --quiet; then | ||
echo "No changes to commit" | ||
else | ||
git commit -m "Apply Black Formatting" | ||
BRANCH_NAME=${GITHUB_HEAD_REF:-$(git rev-parse --abbrev-ref HEAD)} | ||
git push origin HEAD:$BRANCH_NAME | ||
fi |
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,32 @@ | ||
name: Python Unit Tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install Dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install msgpack # TODO: Update this as we update requirements.txt | ||
python setup.py install | ||
|
||
- name: Run All Tests | ||
run: | | ||
python -m unittest discover -s tests -p '*_test.py' |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for some reason, if I leave pip install msgpack out, it fails:
https://github.com/sangkeun00/analog/actions/runs/6919422313/job/18822772616
hence, I am installing this separately. When we give versioning to the requirements.txt we would have to change it here to. I am leaving TODO.