From fd3ca2a5a4af0bee36086b9024ee277d10280f94 Mon Sep 17 00:00:00 2001 From: Yasser Tahiri Date: Sat, 16 Dec 2023 00:22:36 +0100 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=91=B7=20remove=20the=20cache=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cache.yml | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 .github/workflows/cache.yml diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml deleted file mode 100644 index 66dd47d9..00000000 --- a/.github/workflows/cache.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: cleanup caches by a branch - -on: - pull_request: - types: - - closed - -jobs: - cleanup: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: Cleanup - run: | - gh extension install actions/gh-actions-cache - - REPO=${{ github.repository }} - BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" - - echo "Fetching list of cache key" - cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) - - ## Setting this to not fail the workflow while deleting cache keys. - set +e - echo "Deleting caches..." - for cacheKey in $cacheKeysForPR - do - gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm - done - echo "Done" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c9811c5f4188263d53dccb3b92f468def8b34a0d Mon Sep 17 00:00:00 2001 From: Yasser Tahiri Date: Sat, 16 Dec 2023 00:22:53 +0100 Subject: [PATCH 2/4] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor=20the=20workf?= =?UTF-8?q?low=20for=20release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eccc8ae0..6f1f5d5c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,14 +18,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.10" - cache-dependency-path: pyproject.toml - - uses: actions/cache@v3 - id: cache - with: - path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-publish - name: Install build dependencies - if: steps.cache.outputs.cache-hit != 'true' run: pip install build - name: Build distribution run: python -m build @@ -33,7 +26,3 @@ jobs: uses: pypa/gh-action-pypi-publish@v1.8.11 with: password: ${{ secrets.PYPI_API_TOKEN }} - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" From 2a833879508623596ad9a40af32490e8a6448cef Mon Sep 17 00:00:00 2001 From: Yasser Tahiri Date: Sat, 16 Dec 2023 00:23:21 +0100 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=94=A8=20Update=20the=20CI=20&=20incl?= =?UTF-8?q?ude=20the=20testing=20in=20different=20OS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28b6d9fa..094a9fe6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,19 +15,26 @@ jobs: fail-fast: false steps: + - uses: actions/checkout@v4 + - name: Set up Python uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + - name: Install Dependencies run: pip install -r requirements/pyproject.txt && pip install -r requirements/linting.txt + - uses: pre-commit/action@v3.0.0 with: extra_args: --all-files --verbose + test: - name: test on python ${{ matrix.python-version }} - runs-on: ubuntu-latest + name: test py${{ matrix.python-version }} on ${{ matrix.os }} + + runs-on: ${{ matrix.os }}-latest + services: redis: image: redis @@ -43,28 +50,33 @@ jobs: fail-fast: false matrix: python-version: ["3.8","3.9", "3.10", "3.11", "3.12"] + os: [ubuntu, macos, windows] steps: - uses: actions/checkout@v4 + - name: Set up Python uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - uses: actions/cache@v3 - id: cache - with: - path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test + - name: Install Dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: pip install -r requirements/all.txt + run: | + pip install -r requirements/pyproject.txt && pip install -r requirements/testing.txt + + - name: Freeze Dependencies + run: pip freeze + - name: Test + run: pytest --cov=authx --cov-report=xml -xv --disable-warnings --cov-fail-under=90 env: ENV: test REDIS_URL: "redis://0.0.0.0:6379" - run: pytest --cov=authx --cov-report=html -xv --color=yes --disable-warnings --cov-fail-under=80 + CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}-with-deps + - name: Upload coverage uses: codecov/codecov-action@v3 + # https://github.com/marketplace/actions/alls-green#why used for branch protection checks check: if: always() From d8ddc90782bc6c8a59c793303788163d09d75f4c Mon Sep 17 00:00:00 2001 From: Yasser Tahiri Date: Tue, 19 Dec 2023 00:09:47 +0100 Subject: [PATCH 4/4] :bug: change to use `supercharge/redis-github-action` --- .github/workflows/ci.yml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 094a9fe6..5152c6cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,26 +35,22 @@ jobs: runs-on: ${{ matrix.os }}-latest - services: - redis: - image: redis - ports: - - 6379:6379 - options: >- - --health-cmd "redis-cli ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - strategy: fail-fast: false matrix: python-version: ["3.8","3.9", "3.10", "3.11", "3.12"] os: [ubuntu, macos, windows] + redis-version: ["6"] steps: - uses: actions/checkout@v4 + - name: Start Redis + uses: supercharge/redis-github-action@1.7.0 + with: + redis-version: ${{ matrix.redis-version }} + redis-port: 12345 + - name: Set up Python uses: actions/setup-python@v4 with: