ci: implement certificate caching in workflow

This commit is contained in:
ramvignesh-b
2026-04-16 05:34:08 +05:30
parent 3f761cfe7e
commit 2e0c4e557d
2 changed files with 18 additions and 5 deletions
+14 -1
View File
@@ -10,7 +10,8 @@ jobs:
setup-environment: setup-environment:
name: Generate Certificates name: Generate Certificates
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cert-key.outputs.key }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Generate SSL Certificates - name: Generate SSL Certificates
@@ -19,6 +20,11 @@ jobs:
mkdir -p certs mkdir -p certs
mkcert -install mkcert -install
mkcert -cert-file certs/localhost.pem -key-file certs/localhost-key.pem localhost 127.0.0.1 ::1 mkcert -cert-file certs/localhost.pem -key-file certs/localhost-key.pem localhost 127.0.0.1 ::1
echo "cert_path=certs/localhost.pem" >> $GITHUB_OUTPUT
echo "key_path=certs/localhost-key.pem" >> $GITHUB_OUTPUT
- id: cert-key
run: echo "key=${{ runner.os }}-certs-${{ github.sha }}" >> $GITHUB_OUTPUT
- name: Cache certificates - name: Cache certificates
uses: actions/cache/save@v4 uses: actions/cache/save@v4
@@ -63,6 +69,7 @@ jobs:
backend: backend:
name: Backend CI name: Backend CI
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: setup-environment
defaults: defaults:
run: run:
working-directory: ./backend working-directory: ./backend
@@ -84,6 +91,12 @@ jobs:
enable-cache: true enable-cache: true
cache-dependency-glob: backend/uv.lock cache-dependency-glob: backend/uv.lock
- name: Restore certificates
uses: actions/cache/restore@v4
with:
path: certs
key: ${{ runner.os }}-certs-${{ github.sha }}
- name: Setup Environment - name: Setup Environment
run: | run: |
cp ../.env.example ../.env cp ../.env.example ../.env
+4 -4
View File
@@ -32,10 +32,10 @@ class AuthTests(APITestCase):
self.assertIn("access", response.data) self.assertIn("access", response.data)
self.assertNotIn("refresh", response.data) self.assertNotIn("refresh", response.data)
self.assertIn(cookie_name, response.cookies) self.assertIn(cookie_name, response.cookies)
self.assertTrue(response.cookies[cookie_name].value) self.assertIsNotNone(response.cookies[cookie_name].value)
self.assertTrue(response.cookies[cookie_name].httponly) self.assertTrue(response.cookies[cookie_name].get("httponly"))
self.assertTrue(response.cookies[cookie_name].secure) self.assertTrue(response.cookies[cookie_name].get("secure"))
self.assertEqual(response.cookies[cookie_name]["samesite"], "Lax") self.assertEqual(response.cookies[cookie_name].get("samesite"), "Lax")
class ActivationTests(APITestCase): class ActivationTests(APITestCase):