diff --git a/.gitea/workflows/prek.yml b/.gitea/workflows/prek.yml new file mode 100644 index 0000000..9e98750 --- /dev/null +++ b/.gitea/workflows/prek.yml @@ -0,0 +1,12 @@ +name: "Lint: prek" + +on: + pull_request: + workflow_call: + +jobs: + prek: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: j178/prek-action@v1 diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml new file mode 100644 index 0000000..8f46bad --- /dev/null +++ b/.gitea/workflows/tests.yml @@ -0,0 +1,36 @@ +name: Tests + +on: + pull_request: + workflow_call: + +jobs: + build_frontend: + runs-on: ubuntu-latest + container: node:20-alpine + steps: + - uses: actions/checkout@v4 + - name: Build frontend + working-directory: frontend + run: | + npm ci + npm run build + + tests: + runs-on: ubuntu-latest + container: nikolaik/python-nodejs:python3.11-nodejs20 + steps: + - uses: actions/checkout@v4 + + - name: Run migrations + run: uv run --locked manage.py migrate + - name: Run Django checks + run: uv run manage.py check + - name: Run tests with coverage + run: uv run pytest -v --cov bbs --cov-report term --cov-report xml:coverage.xml + + - name: Upload coverage reports + uses: actions/upload-artifact@v3 + with: + name: coverage-report + path: coverage.xml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index a4b6286..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,43 +0,0 @@ -variables: - PIP_CACHE_DIR: "${CI_PROJECT_DIR}/.cache/pip" - -default: - image: nikolaik/python-nodejs:python3.11-nodejs20 - cache: - paths: - - .cache/pip - - .venv - -django-checks: - stage: build - script: - - uv run manage.py migrate - - uv run manage.py check - -tests: - stage: test - script: - - uv run bin/test - -lint: - stage: test - script: - - uv run bin/pre-commit - -deploy: - stage: deploy - before_script: - # Install ssh if not already - - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )' - - eval $(ssh-agent -s) - # Make SSH key available - - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - - mkdir -p ~/.ssh - - chmod 700 ~/.ssh - # Add known host keys - - echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts - - chmod 644 ~/.ssh/known_hosts - script: - - ssh gitdeploy@dreamcast.neuf.no "$(< bin/deploy)" - only: - - main