Skip to content

Commit

Permalink
Use CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
vd2org committed Feb 26, 2024
1 parent ef2eb69 commit 3a768bf
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 8 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: PUBLISH

on:
push:
tags:
- v*

jobs:

publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: "Set up Python 3.12"
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: "Install dependencies"
run: |
python3 -m pip install --upgrade pip
pip3 install pdm
- name: "Build"
run: |
pdm install --no-self
pdm build
- name: "Publish pypi"
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
pdm config repository.pypi.username "__token__"
pdm config repository.pypi.password "$PYPI_TOKEN"
pdm publish
- name: "Create release"
run: |
pdm run python tools/create_release.py ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.ref_name }} README.md
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: TEST

on: [ push ]

jobs:

code:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: [ "3.11", "3.12" ]

steps:
- uses: actions/checkout@v4

- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: "Install dependencies"
run: |
python3 -m pip install --upgrade pip
pip3 install pdm
pdm install --no-self
- name: "Run tests"
run: |
pdm run pytest
99 changes: 95 additions & 4 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ distribution = true
[tool.pdm.dev-dependencies]
dev = [
"pytest~=8.0.1",
"requests>=2.31.0",
]

[project.scripts]
Expand Down
10 changes: 6 additions & 4 deletions tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Copyright (C) 2024 by Vd <ubump@vd2.org>.
# This file is part of ubump project.
# ubump is released under the MIT License (see LICENSE).


from unittest import mock

from ubump import main


def test_config():
with mock.patch("builtins.open", mock.mock_open(read_data=b'file content'), side_effect=FileNotFoundError):
config = main.Config()

print(config.file)
pass

0 comments on commit 3a768bf

Please sign in to comment.