diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index d902cc4b..00000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - schedule: - - cron: "3 13 * * 0" - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ javascript, python ] - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - queries: +security-and-quality - - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - if: ${{ matrix.language == 'javascript' || matrix.language == 'python' }} - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..7aa9c950 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,45 @@ +name: Run tests + +on: + push: + branches: + - "*" + pull_request: + branches: ["master"] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.9" + - uses: snok/install-poetry@v1 + with: + version: 1.6.1 + virtualenvs-create: true + virtualenvs-in-project: true + - uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ hashFiles('poetry.lock') }} + + - run: poetry install --no-interaction --no-root + + - name: Run formatting check + run: | + poetry run black . --check + + - name: Run unit tests + run: | + poetry run coverage run + poetry run coverage report + + - name: Deploy + run: | + poetry run fab deploy + + - name: Run end-to-end tests + run: | + poetry run curl -f localhost:8000 diff --git a/.github/workflows/test_deploy.yaml b/.github/workflows/test_deploy.yaml deleted file mode 100644 index 4847a553..00000000 --- a/.github/workflows/test_deploy.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: Deployment and end to end tests - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Setup environment - run: bash ./scripts/setup_env.sh hknweb-dev - - name: Deploy - run: | - eval "$(conda shell.bash hook)" - conda activate hknweb-dev - fab deploy - - name: End to end tests - run: | - eval "$(conda shell.bash hook)" - curl -f localhost:8000 diff --git a/.github/workflows/test_formatting.yaml b/.github/workflows/test_formatting.yaml deleted file mode 100644 index 168c7277..00000000 --- a/.github/workflows/test_formatting.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: Formatting check for Python files - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Setup environment - run: bash ./scripts/setup_env.sh hknweb-dev - - name: Run formatting check - run: | - eval "$(conda shell.bash hook)" - conda activate hknweb-dev - black . --check diff --git a/.github/workflows/test_logic_and_coverage.yaml b/.github/workflows/test_logic_and_coverage.yaml deleted file mode 100644 index 02f2ed5a..00000000 --- a/.github/workflows/test_logic_and_coverage.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: Run Django tests and enforce test coverage - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Setup environment - run: bash ./scripts/setup_env.sh hknweb-dev - - name: Run Django unit tests - run: | - eval "$(conda shell.bash hook)" - conda activate hknweb-dev - coverage run - coverage report