diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..8847bc9 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,29 @@ +name: docker + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + name: ${{ matrix.service }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + service: [fetcher, generator, edge] + steps: + - uses: actions/checkout@v4 + + - uses: docker/setup-buildx-action@v3 + + - name: Build ${{ matrix.service }} image + uses: docker/build-push-action@v6 + with: + context: ./${{ matrix.service }} + push: false + tags: ghstats-${{ matrix.service }}:ci + cache-from: type=gha,scope=${{ matrix.service }} + cache-to: type=gha,mode=max,scope=${{ matrix.service }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..b86860d --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,33 @@ +name: tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + pytest: + name: ${{ matrix.service }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + service: [fetcher, generator, edge] + defaults: + run: + working-directory: ${{ matrix.service }} + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: pip + cache-dependency-path: ${{ matrix.service }}/requirements.txt + + - name: Install dependencies + run: pip install -r requirements.txt + + - name: Run pytest + run: pytest -v diff --git a/README.md b/README.md index a3269ba..d213b04 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # github-readme-stats +[![tests](https://github.com/ShayManor/github-readme-stats/actions/workflows/tests.yml/badge.svg)](https://github.com/ShayManor/github-readme-stats/actions/workflows/tests.yml) +[![docker](https://github.com/ShayManor/github-readme-stats/actions/workflows/docker.yml/badge.svg)](https://github.com/ShayManor/github-readme-stats/actions/workflows/docker.yml) + A monorepo of three independent Python services plus a React frontend, each self-contained. See each service's README for details.