From dfca921fa73217e171c885aa07a686b132479be8 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Mon, 15 Feb 2021 14:41:09 -0500 Subject: [PATCH] Refactor GitHub actions --- .github/workflows/build.yml | 86 ------------------------------------- .github/workflows/test.yml | 76 ++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 86 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index bab9bb8..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: Build - -on: - pull_request: - push: - branches: - - "main" - tags: - - "v*" - -jobs: - build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macOS-latest] - - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - name: Install cibuildwheel - run: python -m pip install cibuildwheel~=1.9.0 - - name: Build wheels - run: python -m cibuildwheel --output-dir wheelhouse - - uses: actions/upload-artifact@v2 - with: - name: wheelhouse - path: ./wheelhouse/*.whl - - build_sdist: - name: Build sdist - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - run: pip install "poetry~=1.1.4" - - run: poetry config experimental.new-installer false - name: Disable new installer - - run: poetry check - - run: poetry install - - run: poetry build --format sdist - - uses: actions/upload-artifact@v2 - with: - name: wheelhouse - path: ./dist/*.tar.gz - - test_install: - name: Test install on ${{ matrix.os }} / ${{ matrix.python-version }} - needs: [build_wheels, build_sdist] - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macOS-latest] - python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "pypy-2.7", "pypy-3.6", "pypy-3.7"] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - uses: actions/download-artifact@v2 - with: - name: wheelhouse - path: dist - - run: pip install --no-index --find-links=./dist sysaudit - name: Install sysaudit from wheels - - run: python -c "import sysaudit; sysaudit.audit('event')" - name: Check module is importable - - upload_pypi: - needs: [test_install] - runs-on: ubuntu-latest - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - steps: - - uses: actions/download-artifact@v2 - with: - name: wheelhouse - path: dist - - - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.PYPI_TOKEN }} - # To test: repository_url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aebb6d4..b780213 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -63,3 +63,79 @@ jobs: with: name: docs path: ./docs/_build/ + + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macOS-latest] + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - name: Install cibuildwheel + run: python -m pip install cibuildwheel~=1.9.0 + - name: Build wheels + run: python -m cibuildwheel --output-dir wheelhouse + - uses: actions/upload-artifact@v2 + with: + name: wheelhouse + path: ./wheelhouse/*.whl + + build_sdist: + name: Build sdist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + - run: pip install "poetry~=1.1.4" + - run: poetry config experimental.new-installer false + name: Disable new installer + - run: poetry check + - run: poetry install + - run: poetry build --format sdist + - uses: actions/upload-artifact@v2 + with: + name: wheelhouse + path: ./dist/*.tar.gz + + test_install: + name: Test install on ${{ matrix.os }} / ${{ matrix.python-version }} + needs: [black, mypy, test, build_wheels, build_sdist] + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macOS-latest] + python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "pypy-2.7", "pypy-3.6", "pypy-3.7"] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - uses: actions/download-artifact@v2 + with: + name: wheelhouse + path: dist + - run: pip install --no-index --find-links=./dist sysaudit + name: Install sysaudit from wheels + - run: python -c "import sysaudit; sysaudit.audit('event')" + name: Check module is importable + + upload_pypi: + needs: [test_install] + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + steps: + - uses: actions/download-artifact@v2 + with: + name: wheelhouse + path: dist + + - uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + # To test: repository_url: https://test.pypi.org/legacy/