Skip to content

Commit

Permalink
Merge pull request #9 from beeldengeluid/gh-actions
Browse files Browse the repository at this point in the history
GH Actions
  • Loading branch information
Veldhoen authored Feb 6, 2024
2 parents 11b62c9 + f23913c commit db4174b
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy dane-visual-feature-extraction-worker to ghcr

on:
workflow_call:

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=edge,enable={{is_default_branch}}
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
38 changes: 38 additions & 0 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Test

on:
workflow_call:

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: "Checkout Repository"
uses: "actions/checkout@v4"

- name: "Install Python"
uses: "actions/setup-python@v4"
with:
python-version: "3.10"

- name: "Install poetry"
run: "pip install --user poetry"

- name: "Install dev environment"
run: poetry install --no-interaction --no-ansi

### COMMENTED FOR NOW UNTIL WE START WITH TESTING
# - name: "pytest"
# run: |
# cp config/config.yml config.yml
# poetry run pytest -k 'not test_extract_features and not test_batches'

- name: "flake8"
run: "poetry run flake8"

- name: "black"
run: "poetry run black --check ."

- name: "mypy"
run: "poetry run mypy ."
22 changes: 22 additions & 0 deletions .github/workflows/main-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: main branch - test; deploy (ecr, tst, acc, aws)

on:
push:
branches:
- "main"
paths-ignore:
- README.md
- LICENSE
- docker-compose.yml

jobs:
test:
uses: ./.github/workflows/_test.yml

### TO BE UNCOMMENTED ONCE DOCKER IS SET UP
# deploy:
# uses: ./.github/workflows/_deploy.yml
# permissions:
# contents: read
# packages: write
# needs: [test]
16 changes: 16 additions & 0 deletions .github/workflows/manual-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Manual deploy

on:
workflow_dispatch:

jobs:
test:
uses: ./.github/workflows/_test.yml

### TO BE UNCOMMENTED ONCE DOCKER IS SET UP
# deploy:
# uses: ./.github/workflows/_deploy.yml
# permissions:
# contents: read
# packages: write
# needs: [test]
14 changes: 14 additions & 0 deletions .github/workflows/not-main-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: All branches but main - test only

on:
push:
branches-ignore:
- "main"
paths-ignore:
- README.md
- LICENSE
- docker-compose.yml

jobs:
test:
uses: "./.github/workflows/_test.yml"
Empty file added main_data_processor.py
Empty file.

0 comments on commit db4174b

Please sign in to comment.