refactor: replace IS_GITHUB environment variable with inline server URL checks
This commit is contained in:
+14
-14
@@ -11,8 +11,6 @@ env:
|
||||
DB_NAME: piku_test_db
|
||||
DB_USER: test
|
||||
DB_PASSWORD: password123
|
||||
# WHY?: different configuration for gitea and github becasue of GHES no support check
|
||||
IS_GITHUB: ${{ github.server_url == 'https://github.com' }}
|
||||
|
||||
jobs:
|
||||
setup-environment:
|
||||
@@ -27,8 +25,9 @@ jobs:
|
||||
mkcert -install
|
||||
mkcert -cert-file certs/localhost.pem -key-file certs/localhost-key.pem localhost 127.0.0.1 ::1
|
||||
|
||||
# WHY?: different configuration for gitea and github becasue of GHES no support check
|
||||
- name: Upload certificates (GitHub)
|
||||
if: env.IS_GITHUB == 'true'
|
||||
if: ${{ github.server_url == 'https://github.com' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ssl-certs
|
||||
@@ -36,7 +35,7 @@ jobs:
|
||||
retention-days: 1
|
||||
|
||||
- name: Upload certificates (Gitea)
|
||||
if: env.IS_GITHUB != 'true'
|
||||
if: ${{ github.server_url != 'https://github.com' }}
|
||||
uses: christopherHX/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: ssl-certs
|
||||
@@ -55,14 +54,14 @@ jobs:
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
|
||||
- name: Download certificates (GitHub)
|
||||
if: env.IS_GITHUB == 'true'
|
||||
if: ${{ github.server_url == 'https://github.com' }}
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ssl-certs
|
||||
path: certs/
|
||||
|
||||
- name: Download certificates (Gitea)
|
||||
if: env.IS_GITHUB != 'true'
|
||||
if: ${{ github.server_url != 'https://github.com' }}
|
||||
uses: christopherHX/gitea-download-artifact@v4
|
||||
with:
|
||||
name: ssl-certs
|
||||
@@ -108,14 +107,14 @@ jobs:
|
||||
cache-dependency-glob: "backend/uv.lock"
|
||||
|
||||
- name: Download certificates (GitHub)
|
||||
if: env.IS_GITHUB == 'true'
|
||||
if: ${{ github.server_url == 'https://github.com' }}
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ssl-certs
|
||||
path: certs/
|
||||
|
||||
- name: Download certificates (Gitea)
|
||||
if: env.IS_GITHUB != 'true'
|
||||
if: ${{ github.server_url != 'https://github.com' }}
|
||||
uses: christopherHX/gitea-download-artifact@v4
|
||||
with:
|
||||
name: ssl-certs
|
||||
@@ -128,10 +127,11 @@ jobs:
|
||||
# Use internal networking for Gitea
|
||||
if [ "$GITEA_ACTIONS" = "true" ]; then
|
||||
export DB_HOST="postgres"
|
||||
export DB_PORT="5432"
|
||||
else
|
||||
export DB_HOST="127.0.0.1"
|
||||
export DB_PORT="5442"
|
||||
fi
|
||||
export DB_PORT="5442"
|
||||
uv run ruff check
|
||||
uv run python manage.py test
|
||||
|
||||
@@ -144,14 +144,14 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download Certificates (GitHub)
|
||||
if: env.IS_GITHUB == 'true'
|
||||
if: ${{ github.server_url == 'https://github.com' }}
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ssl-certs
|
||||
path: certs/
|
||||
|
||||
- name: Download Certificates (Gitea)
|
||||
if: env.IS_GITHUB != 'true'
|
||||
if: ${{ github.server_url != 'https://github.com' }}
|
||||
uses: christopherHX/gitea-download-artifact@v4
|
||||
with:
|
||||
name: ssl-certs
|
||||
@@ -163,7 +163,7 @@ jobs:
|
||||
|
||||
- name: Cache Playwright
|
||||
id: playwright-cache
|
||||
if: env.IS_GITHUB == 'true'
|
||||
if: ${{ github.server_url == 'https://github.com' }}
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
@@ -185,7 +185,7 @@ jobs:
|
||||
CI: "true"
|
||||
|
||||
- name: Upload Playwright Report (GitHub)
|
||||
if: always() && env.IS_GITHUB == 'true'
|
||||
if: always() && ${{ github.server_url == 'https://github.com' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: playwright-report
|
||||
@@ -193,7 +193,7 @@ jobs:
|
||||
retention-days: 10
|
||||
|
||||
- name: Upload Playwright Report (Gitea)
|
||||
if: always() && env.IS_GITHUB != 'true'
|
||||
if: always() && ${{ github.server_url != 'https://github.com' }}
|
||||
uses: christopherHX/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: playwright-report
|
||||
|
||||
Reference in New Issue
Block a user