Skip to content

Run linting and tests #356

Run linting and tests

Run linting and tests #356

name: lint-and-test
run-name: Run linting and tests
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup buildx
uses: docker/setup-buildx-action@v3
- name: Get USER_ID to env
run: echo "USER_ID=$(id -u)" >> $GITHUB_ENV
- name: Get GROUP_ID to env
run: echo "GROUP_ID=$(id -g)" >> $GITHUB_ENV
- name: Login to Docker Registry, bake/cache
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: docker buildx bake --file src/docker/testing-bake.yml --file src/docker/docker-compose-gha-cache.json
- run: |
docker compose --env-file src/docker/.compose.testing.env \
-f src/docker/docker-compose-testing.yml run web pylint \
-E --disable E1101,E0307 --ignore-paths \
'.*\/migrations\/[0-9]+.*.py' analysis datasets dashboard home jobs kantele rawstatus
integration-tests:
runs-on: ubuntu-latest
#needs: linting
steps:
- uses: actions/checkout@v4
- name: Setup buildx
uses: docker/setup-buildx-action@v3
- name: Get USER_ID to env
run: echo "USER_ID=$(id -u)" >> $GITHUB_ENV
- name: Get GROUP_ID to env
run: echo "GROUP_ID=$(id -g)" >> $GITHUB_ENV
- name: Login to Docker Registry to get bake cache
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: docker buildx bake --file src/docker/testing-bake.yml --file src/docker/docker-compose-gha-cache.json
- run: |
docker compose --env-file src/docker/.compose.testing.env -f src/docker/docker-compose-testing.yml \
up --detach db mq
sleep 5 # DB needs to be up or app crashes trying to connect
# docker compose --env-file src/docker/.compose.testing.env -f src/docker/docker-compose-testing.yml \
# run --use-aliases web python manage.py test --tag slow --exclude-tag mstulos
docker compose --env-file src/docker/.compose.testing.env -f src/docker/docker-compose-testing.yml \
run --use-aliases web python manage.py test rawstatus.tests.TestUploadScript || docker compose --env-file src/docker/.compose.testing.env -f src/docker/docker-compose-testing.yml \
logs storage_downloads storage_mvfiles tulos_ingester
# unit-tests:
# runs-on: ubuntu-latest
# needs: linting
# steps:
# - uses: actions/checkout@v4
# - name: Setup buildx
# uses: docker/setup-buildx-action@v3
# - name: Get USER_ID to env
# run: echo "USER_ID=$(id -u)" >> $GITHUB_ENV
# - name: Get GROUP_ID to env
# run: echo "GROUP_ID=$(id -g)" >> $GITHUB_ENV
# - name: Login to Docker Registry to get bake cache
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - run: docker buildx bake --file src/docker/testing-bake.yml --file src/docker/docker-compose-gha-cache.json
# - run: |
# docker compose --env-file src/docker/.compose.testing.env -f src/docker/docker-compose-testing.yml \
# up --detach db mq
# sleep 5 # DB needs to be up or app crashes trying to connect
# docker compose --env-file src/docker/.compose.testing.env -f src/docker/docker-compose-testing.yml \
# run --use-aliases web python manage.py test --exclude-tag slow