modified: README.md #6
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: ci | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
permissions: | |
checks: write | |
pull-requests: write | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- id: prep | |
uses: t0ster/gh-action@master | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: | | |
/tmp/.buildx-cache | |
/tmp/.buildx-cache-test | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: "Build for Test" | |
uses: docker/build-push-action@v2 | |
with: | |
tags: t0ster/binance-order-book:test | |
cache-from: | | |
type=local,src=/tmp/.buildx-cache-test | |
type=local,src=/tmp/.buildx-cache | |
# For some reason for proper caching we need separate cache for test image | |
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-test | |
load: true | |
target: dev | |
- name: "Run Tests" | |
run: docker run --rm -v $(pwd):/test-results t0ster/binance-order-book:test pytest --junitxml /test-results/test-results/test-results.xml | |
- name: Publish Tests | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() # Or use "continue-on-error: true" in previous test step | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
files: test-results/*.xml | |
- name: "Build and Push" | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
target: prod | |
tags: | | |
t0ster/binance-order-book:${{ steps.prep.outputs.shortsha }} | |
t0ster/binance-order-book:latest | |
cache-from: | | |
type=local,src=/tmp/.buildx-cache | |
type=local,src=/tmp/.buildx-cache-test | |
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache |