Skip to content

Run Unittests & Integration Tests #70

Run Unittests & Integration Tests

Run Unittests & Integration Tests #70

Workflow file for this run

name: Run Unittests & Integration Tests
on:
workflow_dispatch:
jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
ref: ${{ github.ref }}
- name: Install dependencies
run: |
echo "Installing docker compose"
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
echo "Downloading existing images (for caching)"
docker pull bbernhard/imagemonkey-api:latest
docker pull bbernhard/imagemonkey-db:latest
docker pull bbernhard/imagemonkey-testing:latest
api-test:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@master
with:
ref: ${{ github.ref }}
- name: Run API tests
env:
ENV_FILE_LOCATION: ../env_api_tests.ci
run: |
echo "Cloning imagemonkey-core"
git clone https://github.com/bbernhard/imagemonkey-core.git imagemonkey-core
rm -f wordlists/.github
echo "Updating labels"
mkdir -p imagemonkey-core/wordlists
cp -r en imagemonkey-core/wordlists/
echo "Creating avatars directory"
mkdir -p imagemonkey-core/avatars
cp imagemonkey-core/img/default.png imagemonkey-core/avatars/default.png
echo "Creating data directory"
mkdir -p imagemonkey-core/data/donations
mkdir -p imagemonkey-core/data/quarantine
mkdir -p imagemonkey-core/data/unverified_donations
echo "Preparing env file for github actions job"
cp imagemonkey-core/env/env.ci imagemonkey-core/env/env_api_tests.ci
echo "TEST_MODE=only-api" >> imagemonkey-core/env/env_api_tests.ci
docker compose -f imagemonkey-core/env/docker/docker-compose.ci.yml up --abort-on-container-exit --exit-code-from testing
unit-test:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@master
with:
ref: ${{ github.ref }}
- name: Run unittests
env:
ENV_FILE_LOCATION: ../env_unit_tests.ci
run: |
echo "Cloning imagemonkey-labels"
git clone https://github.com/bbernhard/imagemonkey-core.git imagemonkey-core
rm -f wordlists/.github
echo "Updating labels"
mkdir -p imagemonkey-core/wordlists
cp -r en imagemonkey-core/wordlists/
echo "Creating avatars directory"
mkdir -p avatars
cp imagemonkey-core/img/default.png avatars/default.png
echo "Creating data directory"
mkdir -p imagemonkey-core/data/donations
mkdir -p imagemonkey-core/data/quarantine
mkdir -p imagemonkey-core/data/unverified_donations
echo "Preparing env file for github actions job"
cp imagemonkey-core/env/env.ci imagemonkey-core/env/env_unit_tests.ci
echo "TEST_MODE=only-unittest" >> imagemonkey-core/env/env_unit_tests.ci
docker compose -f imagemonkey-core/env/docker/docker-compose.ci.yml up --abort-on-container-exit --exit-code-from testing