Development #31
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-latest-container | |
on: | |
pull_request: | |
branches: [master] | |
paths: | |
- '**.py' | |
- Dockerfile.prod | |
release: | |
types: [published] | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.0.2 | |
with: | |
fetch-depth: 0 | |
set-safe-directory: true | |
- name: Check git version and our path | |
run: | | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- uses: ptxmac/yapf-action@master | |
with: | |
args: --recursive --verbose | |
build: | |
runs-on: ubuntu-latest | |
needs: lint | |
container: | |
image: ghcr.io/${{ github.repository }}:base | |
credentials: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.REGISTRY_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3.0.2 | |
with: | |
fetch-depth: 0 | |
set-safe-directory: true | |
- name: Force directory safe | |
run: | | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip wheel setuptools setuptools-scm | |
python3 -m pip install virtualenv | |
python3 -m pip install build | |
- name: Build package | |
run: python3 -m build | |
- name: Build bdist package | |
run: python3 setup.py bdist_wheel | |
- name: Install snow | |
run: pip install dist/*.tar.gz | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist/* | |
- name: Run commands to test that everything is finished | |
run: | | |
pip3 freeze | grep "snow" | |
python3 -c "import snow" | |
build-latest-container: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v1 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.REGISTRY_TOKEN }} | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v2 | |
with: | |
file: ./Dockerfile.prod | |
push: true # Will only build if this is not here | |
tags: ${{ env.REGISTRY }}/${{ github.repository }}:latest |