From 18beef47041b244383fe753e55e39f59e7506b01 Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Wed, 30 Aug 2023 16:14:18 -0400 Subject: [PATCH] Add Github Actions CI --- .github/workflows/ci.yml | 55 ++++++++++++++++++++++++++++++ .github/workflows/pypi-release.yml | 45 ++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pypi-release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e3a134f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: "Run Tests" +on: [push, pull_request, workflow_dispatch] + +defaults: + run: + shell: bash + +jobs: + unit-tests: + name: "Unit Tests" + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + + strategy: + matrix: + include: + - os: ubuntu-20.04 + python-version: "3.6" + - os: ubuntu-latest + python-version: "3.7" + - os: ubuntu-latest + python-version: "3.8" + - os: ubuntu-latest + python-version: "3.9" + - os: ubuntu-latest + python-version: "3.10" + - os: ubuntu-latest + python-version: "3.11" + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Upgrade pip + run: | + python -m pip install -U pip + + - name: Configure environments + run: | + python --version + + - name: Install dependencies + run: | + pip install -e ".[test]" + python -m imgcat --version + + - name: Run tests + run: | + pytest --color=yes -v -s + env: + PYTHONIOENCODING: UTF-8 diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml new file mode 100644 index 0000000..9af7c63 --- /dev/null +++ b/.github/workflows/pypi-release.yml @@ -0,0 +1,45 @@ +name: Publish to PyPI +on: + push: + tags: + - '*' + +jobs: + build-and-release: + name: Build and make a release + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: "3.11" + + - name: Upgrade pip + run: | + python -m pip install -U pip + + - name: Configure environments + run: | + python --version + + - name: Install dependencies + run: | + pip install -e ".[test]" + + - name: Run tests + run: | + pytest --color=yes -v -s + env: + PYTHONIOENCODING: UTF-8 + + - name: Build a source distribution + run: >- + GPUSTAT_VERSION=${{ steps.tag.outputs.TAG_NAME }} python setup.py sdist + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_API_TOKEN }}