fix bruteforce not checking every stock sorting, use sorted set for b… #82
Workflow file for this run
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, Test, Deploy | |
on: | |
push: | |
branches: | |
- "main" | |
tags: | |
- "v*" | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
packages: write ## Github container registry | |
# deployments: write ## Github Pages | |
concurrency: ci-${{ github.ref }} | |
jobs: | |
build-and-test: | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest] #, windows-latest ] # windows takes ~3x longer, not worth the cost for larger projects | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- name: Set up Python ⚙️ | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" # keep in sync with pipfile | |
- name: Install dependencies ⚙️ | |
run: | | |
pip install pipenv | |
pipenv install --dev -q | |
- name: Lint with flake8 🔍 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
pipenv run flake8 tests/ app/ --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings | |
pipenv run flake8 tests/ app/ --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics | |
- name: Test with mypy 🔍 | |
run: | | |
# stop the build if there are typing errors | |
pipenv run python -m mypy app/ tests/ | |
- name: Test with pytest 🔍 | |
run: | | |
# stop the build if there are failed tests | |
pipenv run python -m pytest --durations=10 | |
build-and-push-docker: | |
needs: build-and-test | |
if: github.ref == 'refs/heads/{{ github.event.repository.default_branch }}' || startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
with: | |
exclude: "docs/*" | |
# https://github.com/docker/metadata-action | |
- name: Export Metadata for Docker 🖊️ | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
modischfabrications/cutsolver | |
ghcr.io/${{ github.repository_owner }}/cutsolver | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU ⚙ | |
uses: docker/setup-qemu-action@v3 | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx ⚙ | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Report Buildx platforms 🖊️ | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: Login to DH 👤 | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GHCR 👤 | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# https://github.com/docker/build-push-action | |
- name: Build and push to DH & GHCR 📦 | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=registry,ref=user/app:latest | |
cache-to: type=inline | |
- name: Update DH description 🖊️ | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: modischfabrications/cutsolver | |
readme-filepath: ./README.md | |
short-description: ${{ github.event.repository.description }} |