From f37fa9c3807d740479ab97610c42fc2dfc531f7d Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Thu, 19 Oct 2023 14:27:16 -0400 Subject: [PATCH] cleanup workflows --- .github/workflows/analyze.yml | 2 +- .github/workflows/build.yml | 34 ++++++++++++------- .github/workflows/release.yml | 64 ++++++----------------------------- 3 files changed, 33 insertions(+), 67 deletions(-) diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml index 25ddf321..c4c5db76 100644 --- a/.github/workflows/analyze.yml +++ b/.github/workflows/analyze.yml @@ -37,7 +37,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6b971629..14616b4c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,10 +1,5 @@ name: build -on: - workflow_dispatch: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push, pull_request, workflow_dispatch] env: PACKAGE_DIR: adbnx_adapter TESTS_DIR: tests @@ -16,31 +11,44 @@ jobs: python: ["3.8", "3.9", "3.10", "3.11"] name: Python ${{ matrix.python }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + - name: Setup Python ${{ matrix.python }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} - - name: Set up ArangoDB Instance via Docker - run: docker create --name adb -p 8529:8529 -e ARANGO_ROOT_PASSWORD= arangodb/arangodb:3.9.1 - - name: Start ArangoDB Instance - run: docker start adb + cache: 'pip' + cache-dependency-path: setup.py + - name: Setup pip run: python -m pip install --upgrade pip setuptools wheel + - name: Install packages run: pip install .[dev] + - name: Run black run: black --check --verbose --diff --color ${{env.PACKAGE_DIR}} ${{env.TESTS_DIR}} + - name: Run flake8 run: flake8 ${{env.PACKAGE_DIR}} ${{env.TESTS_DIR}} + - name: Run isort run: isort --check --profile=black ${{env.PACKAGE_DIR}} ${{env.TESTS_DIR}} + - name: Run mypy run: mypy ${{env.PACKAGE_DIR}} + + - name: Set up ArangoDB Instance via Docker + run: docker create --name adb -p 8529:8529 -e ARANGO_ROOT_PASSWORD= arangodb/arangodb + + - name: Start ArangoDB Instance + run: docker start adb + - name: Run pytest run: pytest --cov=${{env.PACKAGE_DIR}} --cov-report xml --cov-report term-missing -v --color=yes --no-cov-on-fail --code-highlight=yes + - name: Publish to coveralls.io - if: matrix.python == '3.8' + if: matrix.python == '3.10' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: coveralls --service=github \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 323fc1c8..73b81f3d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,76 +3,34 @@ on: workflow_dispatch: release: types: [published] -env: - PACKAGE_DIR: adbnx_adapter - TESTS_DIR: tests jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - python: ["3.8", "3.9", "3.10", "3.11"] - name: Python ${{ matrix.python }} - steps: - - uses: actions/checkout@v2 - - name: Setup Python ${{ matrix.python }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python }} - - name: Set up ArangoDB Instance via Docker - run: docker create --name adb -p 8529:8529 -e ARANGO_ROOT_PASSWORD= arangodb/arangodb:3.9.1 - - name: Start ArangoDB Instance - run: docker start adb - - name: Setup pip - run: python -m pip install --upgrade pip setuptools wheel - - name: Install packages - run: pip install .[dev] - - name: Run black - run: black --check --verbose --diff --color ${{env.PACKAGE_DIR}} ${{env.TESTS_DIR}} - - name: Run flake8 - run: flake8 ${{env.PACKAGE_DIR}} ${{env.TESTS_DIR}} - - name: Run isort - run: isort --check --profile=black ${{env.PACKAGE_DIR}} ${{env.TESTS_DIR}} - - name: Run mypy - run: mypy ${{env.PACKAGE_DIR}} - - name: Run pytest - run: pytest --cov=${{env.PACKAGE_DIR}} --cov-report xml --cov-report term-missing -v --color=yes --no-cov-on-fail --code-highlight=yes - - name: Publish to coveralls.io - if: matrix.python == '3.8' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: coveralls --service=github - release: - needs: build runs-on: ubuntu-latest name: Release package steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Fetch complete history for all tags and branches run: git fetch --prune --unshallow - - name: Setup python - uses: actions/setup-python@v2 + - name: Setup Python + uses: actions/setup-python@v4 with: - python-version: "3.8" + python-version: "3.10" - name: Install release packages run: pip install setuptools wheel twine setuptools-scm[toml] - - name: Install dependencies - run: pip install .[dev] - - name: Build distribution run: python setup.py sdist bdist_wheel - - name: Publish to PyPI Test + - name: Publish to Test PyPi env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_TEST }} run: twine upload --repository testpypi dist/* #--skip-existing - - name: Publish to PyPI + + - name: Publish to PyPi env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} @@ -83,7 +41,7 @@ jobs: runs-on: ubuntu-latest name: Update Changelog steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -95,10 +53,10 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Setup python - uses: actions/setup-python@v2 + - name: Setup Python + uses: actions/setup-python@v4 with: - python-version: "3.8" + python-version: "3.10" - name: Install release packages run: pip install wheel gitchangelog pystache