-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sara Veldhoen
committed
Apr 15, 2024
1 parent
56f62b6
commit 429b36f
Showing
8 changed files
with
196 additions
and
5 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Build image (with docker cache) and push to ECR | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: arn:aws:iam::917951871879:role/GitHubActionsBgOrg | ||
aws-region: eu-west-1 | ||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
- name: Compile metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ steps.login-ecr.outputs.registry }}/dane-video-segmentation-worker | ||
tags: | | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
type=sha | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
push: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Deploy dane-example-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 ghcr | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Deploy | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
target: | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
deploy-ecr: | ||
if: ${{ inputs.target == 'ecr' }} | ||
uses: ./.github/workflows/_build-push-cached-ecr.yml | ||
permissions: | ||
id-token: write | ||
contents: read | ||
deploy-ghrc: | ||
if: ${{ inputs.target == 'ghcr' }} | ||
uses: ./.github/workflows/_build-push-cached-ghcr.yml | ||
permissions: | ||
contents: read | ||
packages: write |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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@v5" | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: "Install poetry" | ||
run: "pip install --user poetry" | ||
|
||
- name: "Install dev environment" | ||
run: poetry install --no-interaction --no-ansi | ||
|
||
- name: install libgl1 | ||
run: sudo apt-get install -y libgl1 | ||
|
||
- name: install ffmpeg | ||
run: sudo apt-get update && sudo apt-get install -y ffmpeg --fix-missing | ||
|
||
- name: "pytest" | ||
run: | | ||
cp config/config.yml config.yml | ||
poetry run pytest | ||
- name: "flake8" | ||
run: "poetry run flake8" | ||
|
||
- name: "black" | ||
run: "poetry run black --check ." | ||
|
||
- name: "mypy" | ||
run: "poetry run mypy ." |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
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 | ||
|
||
deploy: | ||
uses: ./.github/workflows/_deploy.yml | ||
secrets: inherit | ||
needs: [test] | ||
with: | ||
target: ghcr |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Manual deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
target: | ||
type: choice | ||
required: true | ||
default: ghcr | ||
options: | ||
- ghcr | ||
|
||
jobs: | ||
deploy: | ||
uses: ./.github/workflows/_deploy.yml | ||
secrets: inherit | ||
with: | ||
target: ${{ inputs.target }} |
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
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" |