forked from seomoz/qless-py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github action to check style and tests
- Loading branch information
Showing
5 changed files
with
148 additions
and
21 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,79 @@ | ||
name: Test, build, and publish the package | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
test-build-and-publish: | ||
name: Test, build, and publish the package | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
with: | ||
path: qless-py | ||
submodules: true | ||
token: ${{ secrets.PAT_GITHUB_ACTIONS }} | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update && sudo apt-get install -y redis-server | ||
python -m venv venv | ||
source venv/bin/activate | ||
pip install -r requirements.txt | ||
working-directory: qless-py | ||
|
||
- name: Check style | ||
run: | | ||
source venv/bin/activate | ||
make style | ||
working-directory: qless-py | ||
|
||
- name: Run tests and build package | ||
run: | | ||
source venv/bin/activate | ||
make nose | ||
python -m build | ||
working-directory: qless-py | ||
|
||
- name: Checkout tdg5/github-action-pack | ||
uses: actions/checkout@v4 | ||
with: | ||
path: .github/actions/tdg5/github-action-pack | ||
ref: v0.0.2 | ||
repository: tdg5/github-action-pack | ||
|
||
- name: Increment version | ||
uses: ./.github/actions/tdg5/github-action-pack/packages/increment-version-file-action/src | ||
with: | ||
authorEmail: dannyguinther@gmail.com | ||
authorName: Danny Guinther | ||
commitMessage: "[skip actions] Increment version for next development cycle" | ||
repoPath: qless-py | ||
versionFilePath: VERSION | ||
versionFormat: python | ||
|
||
- name: Publish package to pypi | ||
env: | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
TWINE_USERNAME: __token__ | ||
run: | | ||
source venv/bin/activate | ||
python -m twine upload dist/* | ||
working-directory: qless-py | ||
|
||
# Add the tag after publishing the package so it is more likely that we | ||
# end up with a package without a tag than a tag without a package. | ||
- name: Create and push tag for published version | ||
run: | | ||
VERSION="$(git show HEAD~1:VERSION)" | ||
TAG_NAME="v${VERSION}" | ||
git tag "$TAG_NAME" HEAD~1 | ||
git push origin "$TAG_NAME" | ||
working-directory: qless-py |
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,47 @@ | ||
name: Style, test, build, and publish the package | ||
|
||
on: | ||
push: | ||
branches-ignore: [main] | ||
|
||
jobs: | ||
style-test-and-build: | ||
name: Test, build, and publish the package | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
with: | ||
path: qless-py | ||
submodules: true | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update && sudo apt-get install -y redis-server | ||
python -m venv venv | ||
source venv/bin/activate | ||
pip install -r requirements.txt | ||
working-directory: qless-py | ||
|
||
- name: Check style | ||
run: | | ||
source venv/bin/activate | ||
make style | ||
git diff --quiet | ||
if [ ! $? -eq 0 ]; then | ||
echo "make style caused file changes, failing!" | ||
exit 1 | ||
fi | ||
working-directory: qless-py | ||
|
||
- name: Run tests and build package | ||
run: | | ||
source venv/bin/activate | ||
make nose | ||
python -m build | ||
working-directory: qless-py |
This file was deleted.
Oops, something went wrong.
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