Merge pull request #34 from akretion/ci #15
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: Build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
schedule: | |
- cron: "0 4 * * 0" | |
jobs: | |
build-boleto-cnab-api: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
cache-from: type=registry,ref=ghcr.io/build-boleto-cnab-api-latest | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
load: true | |
- name: Install test pre-requisites | |
run: pip install pytest | |
- name: Test | |
run: pytest -v | |
- name: Push image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=inline | |
push: true | |
if: ${{ github.repository_owner == 'akretion' && github.ref == 'refs/heads/master' }} |