-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): configure github action ci
- Loading branch information
Showing
6 changed files
with
179 additions
and
30 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,148 @@ | ||
name: 🚀 CI/CD | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
test_and_build: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Load Cached Poetry | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.local | ||
key: poetry-dependencies-v2 | ||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-in-project: true | ||
|
||
- name: Load Cached Python Dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: .venv | ||
key: python-dependencies-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install Python Dependencies | ||
run: poetry install | ||
|
||
- name: Install APT Dependencies | ||
uses: upciti/wakemeops-action@v1 | ||
with: | ||
packages: | | ||
debhelper | ||
fakeroot | ||
- name: Run black | ||
run: poetry run black src tests --check | ||
|
||
- name: Run isort | ||
run: poetry run isort src tests --check | ||
|
||
- name: Run flake8 | ||
run: poetry run flake8 src tests | ||
|
||
- name: Run pytest | ||
run: poetry run pytest --cov=src --cov-report=term-missing tests | ||
|
||
- name: Generate coverage report | ||
shell: bash | ||
run: poetry run coverage xml | ||
|
||
- uses: codecov/codecov-action@v2 | ||
with: | ||
files: ./coverage.xml | ||
|
||
- name: Build single binary application | ||
run: | | ||
poetry install --extras pyinstaller | ||
poetry run poetry-dynamic-versioning | ||
poetry run pyinstaller --onefile src/wheel2deb.py --name wheel2deb -s | ||
dist/wheel2deb | ||
mv dist/wheel2deb wheel2deb_linux_amd64 | ||
- name: Upload build artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheel2deb_linux_amd64 | ||
path: wheel2deb_linux_amd64 | ||
retention-days: 2 | ||
|
||
publish_release: | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
needs: [test_and_build] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install clog-cli | ||
uses: upciti/wakemeops-action@v1 | ||
with: | ||
packages: clog-cli | ||
|
||
- name: Build Release Changelog | ||
run: | | ||
clog --setversion $(git tag --sort=creatordate | tail -n1) \ | ||
--from $(git tag --sort=creatordate | tail -n2 | head -n1) \ | ||
-o changelog.md \ | ||
-r https://github.com/upciti/wheel2deb | ||
- name: Download build artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: wheel2deb_linux_amd64 | ||
|
||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body_path: changelog.md | ||
files: wheel2deb_linux_amd64 | ||
|
||
publish_pypi: | ||
runs-on: ubuntu-18.04 | ||
needs: [test_and_build] | ||
if: startsWith(github.ref, 'refs/tags') | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Load Cached Poetry | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.local | ||
key: poetry-dependencies-v2 | ||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
|
||
- name: Get Release Version | ||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
|
||
- name: Build Distribution | ||
run: | | ||
poetry version "$RELEASE_VERSION" | ||
poetry build | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "0" |