Skip to content

Commit

Permalink
Add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-piles committed May 28, 2024
1 parent 58915eb commit 5be66d1
Show file tree
Hide file tree
Showing 23 changed files with 943 additions and 769 deletions.
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 5
labels:
- "dependencies"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
49 changes: 49 additions & 0 deletions .github/workflows/push_docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Create and publish Docker image

on:
push:
branches:
- 'main'
tags:
- 'v*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: huridocs/pdf-document-layout-analysis

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
43 changes: 43 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install venv
run: make install_venv

- name: Lint with black
run: make check_format

- name: Start service
run: make start

- name: Check API ready
uses: emilioschepis/[email protected]
with:
url: http://localhost:5060
method: GET
expected-status: 200
timeout: 120000
interval: 500

- name: Test with unittest
run: make test
4 changes: 1 addition & 3 deletions src/bros/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,4 @@
else:
import sys

sys.modules[__name__] = _LazyModule(
__name__, globals()["__file__"], _import_structure
)
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure)
1 change: 1 addition & 0 deletions src/bros/configuration_bros.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class BrosConfig(PretrainedConfig):
>>> # Accessing the model configuration
>>> configuration = model.config
"""

model_type = "bros"

def __init__(
Expand Down
Loading

0 comments on commit 5be66d1

Please sign in to comment.