-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
96 additions
and
40 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 |
---|---|---|
@@ -1,32 +1,34 @@ | ||
name: Publish to PyPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'release*' # Only run this workflow when a version tag is pushed | ||
workflow_run: | ||
workflows: ["tests"] # The name of your tests workflow | ||
types: | ||
- completed # This will trigger the workflow when the tests workflow completes | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' && startsWith(github.ref, 'refs/tags/release') }} # Only run if tests passed and the tag matches | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.8' # Specify the Python version you want to use | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.8' # Specify the Python version you want to use | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel twine | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel twine | ||
- name: Build the package | ||
run: python setup.py sdist bdist_wheel | ||
- name: Build the package | ||
run: python setup.py sdist bdist_wheel | ||
|
||
- name: Publish to PyPI | ||
env: | ||
TWINE_USERNAME: __token__ # Use the username __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
run: twine upload dist/* | ||
- name: Publish to PyPI | ||
env: | ||
TWINE_USERNAME: __token__ # Use the username __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} # Ensure you have this secret set up | ||
run: twine upload dist/* |
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,33 +1,34 @@ | ||
name: Publish to TestPyPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'test*' | ||
- 'release*' # Only run this workflow when a test or release tag is pushed | ||
workflow_run: | ||
workflows: ["tests"] # The name of your tests workflow | ||
types: | ||
- completed # Trigger when the tests workflow completes | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' && (startsWith(github.ref, 'refs/tags/test') || startsWith(github.ref, 'refs/tags/release')) }} # Only run if tests passed and the tag matches | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.8' # Specify the Python version you want to use | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.8' # Specify the Python version you want to use | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel twine | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel twine | ||
- name: Build the package | ||
run: python setup.py sdist bdist_wheel | ||
- name: Build the package | ||
run: python setup.py sdist bdist_wheel | ||
|
||
- name: Publish to TestPyPI | ||
env: | ||
TWINE_USERNAME: __token__ # Use the username __token__ | ||
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} | ||
run: twine upload --repository testpypi dist/* | ||
- name: Publish to TestPyPI | ||
env: | ||
TWINE_USERNAME: __token__ # Use the username __token__ | ||
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} | ||
run: twine upload --repository testpypi dist/* |
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,31 @@ | ||
name: Unit Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out the code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' # Change this to your project's Python version | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Run unit tests | ||
run: | | ||
python -m unittest discover -s tests |
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
Empty file.
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,22 @@ | ||
import unittest | ||
from idlegame.data import AutosavedPlayer | ||
|
||
class TestAutosavedPlayer(unittest.TestCase): | ||
|
||
def setUp(self): | ||
"""Set up a fresh AutosavedPlayer instance before each test.""" | ||
self.player = AutosavedPlayer() | ||
|
||
def test_initial_gold(self): | ||
"""Test that a new player starts with 0 gold.""" | ||
self.assertEqual(self.player.gold, 0) | ||
|
||
def test_add_gold(self): | ||
"""Test adding gold to the player.""" | ||
self.player.gold += 50 | ||
self.assertEqual(self.player.gold, 50) | ||
|
||
# Add more tests here for other functionalities | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |