From 5ee59c1350e33a880f3f7a59346832cada3327b6 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Sun, 21 May 2023 18:35:11 +0900 Subject: [PATCH 1/3] CI: Use GitHub Action instead of Travis-CI --- .github/workflows/test.yaml | 49 +++++++++++++++++++++++++++++++++++++ .gitignore | 4 ++- .travis.yml | 18 -------------- requirements.txt | 3 +++ 4 files changed, 55 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/test.yaml delete mode 100644 .travis.yml create mode 100644 requirements.txt diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..32624c6 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,49 @@ +name: Test + +on: + push: + branches: ["main"] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + env: + PIP_NO_PYTHON_VERSION_WARNING: 1 + PIP_DISABLE_PIP_VERSION_CHECK: 1 + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + cache-dependency-path: "requirements.txt" + + - name: Install dependencies + run: "pip install -r requirements.txt" + + - name: Install + run: "pip install ." + + - name: Run tests + env: + TESTDB: actions.cnf + run: | + pytest --cov=myloginpath.py test + + - uses: codecov/codecov-action@v3 + + - name: Build distribution + run: "python -m build ." + + - name: Upload distribution + uses: actions/upload-artifact@v3 + with: + name: myloginpath-dist + path: dist diff --git a/.gitignore b/.gitignore index 372b8bc..731f067 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.egg-info -*.pyc \ No newline at end of file +*.pyc +/build +/dist diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fc45922..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -sudo: false -language: python -python: - - 3.4 - - 3.5 - - 3.6 - - 3.7 - - 3.8 - - 3.9 - -before_install: - - python --version - - pip install -U pip - - pip install -U pytest -install: - - pip install ".[test]" . # install package + test dependencies -script: - - pytest diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2ec13a7 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +build +pytest +pytest-cov From 12a9f80ac13a0b3c662a210b5574e55ad1611a83 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Sun, 21 May 2023 18:39:48 +0900 Subject: [PATCH 2/3] Remove unused envvar --- .github/workflows/test.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 32624c6..89d0d6e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -32,10 +32,7 @@ jobs: run: "pip install ." - name: Run tests - env: - TESTDB: actions.cnf - run: | - pytest --cov=myloginpath.py test + run: "pytest --cov=myloginpath.py test" - uses: codecov/codecov-action@v3 From 61ae08a1645b317619c82e89a8ec03f2bb5e37db Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Sun, 21 May 2023 18:42:45 +0900 Subject: [PATCH 3/3] Fix pytest cov command --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 89d0d6e..fefaa2c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -32,7 +32,7 @@ jobs: run: "pip install ." - name: Run tests - run: "pytest --cov=myloginpath.py test" + run: "pytest --cov=myloginpath test" - uses: codecov/codecov-action@v3