Merge pull request #330 from ImageMonkey/dependabot/go_modules/tests/… #308
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run Unittests & Integration Tests | |
| on: | |
| push: | |
| branches: | |
| - '**' #every branch | |
| pull_request: | |
| branches: | |
| - '**' #every branch | |
| 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-labels" | |
| git clone https://github.com/bbernhard/imagemonkey-labels.git wordlists | |
| rm -rf wordlists/.github | |
| echo "Creating avatars directory" | |
| mkdir -p avatars | |
| cp img/default.png avatars/default.png | |
| echo "Creating data directory" | |
| mkdir -p data/donations | |
| mkdir -p data/quarantine | |
| mkdir -p data/unverified_donations | |
| echo "Preparing env file for github actions job" | |
| cp env/env.ci env/env_api_tests.ci | |
| echo "TEST_MODE=only-api" >> env/env_api_tests.ci | |
| docker compose -f env/docker/docker-compose.ci.yml up --abort-on-container-exit --exit-code-from testing | |
| ui-test: | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| steps: | |
| - uses: actions/checkout@master | |
| with: | |
| ref: ${{ github.ref }} | |
| - name: Run UI tests | |
| env: | |
| ENV_FILE_LOCATION: ../env_ui_tests.ci | |
| run: | | |
| echo "Cloning imagemonkey-labels" | |
| git clone https://github.com/bbernhard/imagemonkey-labels.git wordlists | |
| rm -rf wordlists/.github | |
| echo "Creating avatars directory" | |
| mkdir -p avatars | |
| cp img/default.png avatars/default.png | |
| echo "Creating data directory" | |
| mkdir -p data/donations | |
| mkdir -p data/quarantine | |
| mkdir -p data/unverified_donations | |
| mkdir -p test_output | |
| echo "Preparing env file for github actions job" | |
| cp env/env.ci env/env_ui_tests.ci | |
| echo "TEST_MODE=only-ui" >> env/env_ui_tests.ci | |
| docker compose -f env/docker/docker-compose.ci.yml up --abort-on-container-exit --exit-code-from testing | |
| - name: Upload cypress screenshots and videos of failed tests | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cypress-screenshots-and-videos-of-failed-tests | |
| path: test_output/* | |
| retention-days: 5 | |
| 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-labels.git wordlists | |
| rm -rf wordlists/.github | |
| echo "Creating avatars directory" | |
| mkdir -p avatars | |
| cp img/default.png avatars/default.png | |
| echo "Creating data directory" | |
| mkdir -p data/donations | |
| mkdir -p data/quarantine | |
| mkdir -p data/unverified_donations | |
| echo "Preparing env file for github actions job" | |
| cp env/env.ci env/env_unit_tests.ci | |
| echo "TEST_MODE=only-unittest" >> env/env_unit_tests.ci | |
| docker compose -f env/docker/docker-compose.ci.yml up --abort-on-container-exit --exit-code-from testing |