Install uwsgi in docker #42
This file contains 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: 'Pytest Docker' | |
on: | |
push: | |
paths: | |
- '**.py' | |
- '**.js' | |
- '**.scss' | |
- '**.jinja2' | |
- '.flaskenv' | |
- '.testenv' | |
- 'requirements/base.txt' | |
- 'requirements/test.txt' | |
- '.github/workflows/pytest-docker.yml' | |
- 'Dockerfile' | |
- 'Makefile' | |
- 'pyproject.toml' | |
- 'docker-compose.ci.yml' | |
- 'docker/entrypoints/ci.sh' | |
- 'docker/initdb.sh' | |
- 'package.json' | |
- 'package-lock.json' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build funnel-ci image | |
id: build-funnel-ci | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: Dockerfile | |
target: ci | |
tags: funnel-ci | |
load: true | |
push: false | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Set permissions for coverage | |
run: docker compose -f docker-compose.ci.yml run --rm -u root --entrypoint "" --no-deps --quiet-pull main chown -R 1000:1000 coverage | |
- name: Test with pytest | |
run: docker compose -f docker-compose.ci.yml up --quiet-pull --no-attach db --no-attach redis --no-log-prefix --exit-code-from main | |
- name: Upload coverage report to Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.github_token }} | |
path-to-lcov: coverage/funnel.lcov | |
flag-name: docker-3.11 | |
- name: Set short git commit SHA | |
if: ${{ github.ref_name == 'main' || github.ref_name == 'docker' }} | |
id: sha | |
run: | | |
short_sha=$(git rev-parse --short ${{ github.sha }}) | |
echo "short=$short_sha" >> "$GITHUB_OUTPUT" | |
- name: Login to Docker Hub | |
if: ${{ github.ref_name == 'main' || github.ref_name == 'docker' }} | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
if: ${{ github.ref_name == 'main' || github.ref_name == 'docker' }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GHCR_WRITE_TOKEN }} | |
- name: Build & push funnel image | |
if: ${{ github.ref_name == 'main' || github.ref_name == 'docker' }} | |
id: build-funnel | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: Dockerfile | |
target: app | |
tags: | | |
hasgeek/funnel:${{ github.ref_name }} | |
hasgeek/funnel:sha-${{ steps.sha.outputs.short }} | |
ghcr.io/hasgeek/funnel:${{ github.ref_name }} | |
ghcr.io/hasgeek/funnel:sha-${{ steps.sha.outputs.short }} | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |