Skip to content

Add latest version, upgraded and simplified #719

Add latest version, upgraded and simplified

Add latest version, upgraded and simplified #719

Workflow file for this run

name: Python package
on:
push:
paths-ignore:
- 'papers/**'
- '.github/workflows/daily-workflow.yml'
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
steps:
- uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./script/Dockerfile
push: true
tags: ghcr.io/doruirimescu/python-trading:${{ github.ref_name }}
cache-from: type=registry,ref=ghcr.io/doruirimescu/python-trading:master
cache-to: type=inline
build-args: |
GH_USERNAME=${{ secrets.GH_USERNAME }}
CLONE_TOKEN=${{ secrets.CLONE_TOKEN }}
test:
runs-on: ubuntu-latest
needs: build-and-push
steps:
- uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull the latest Docker image
run: docker pull ghcr.io/doruirimescu/python-trading:${{ github.ref_name }}
- name: Run pytest
run: docker run --rm ghcr.io/doruirimescu/python-trading:${{ github.ref_name }} python3 -m pytest
tag:
runs-on: ubuntu-latest
needs: [build-and-push, test]
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull the Docker image
run: docker pull ghcr.io/doruirimescu/python-trading:${{ github.ref_name }}
- name: Tag the Docker image as 'latest'
run: docker tag ghcr.io/doruirimescu/python-trading:${{ github.ref_name }} ghcr.io/doruirimescu/python-trading:latest
- name: Push the 'latest' tag to GitHub Container Registry
run: docker push ghcr.io/doruirimescu/python-trading:latest