Skip to content

Commit 9a9f5a8

Browse files
committed
Cleanup
1 parent 1fba478 commit 9a9f5a8

7 files changed

Lines changed: 128 additions & 12 deletions

File tree

.github/workflows/docker.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Docker Image Build and Publish
2+
3+
on:
4+
push: # * Run for every push
5+
branches: [ "*" ]
6+
tags: [ '*' ]
7+
schedule: # Run on Tuesday's at 12:00
8+
- cron: '0 12 * * 2'
9+
workflow_dispatch: # Run manually
10+
11+
env:
12+
# Use docker.io for Docker Hub if empty
13+
REGISTRY: ghcr.io
14+
# github.repository as <account>/<repo>
15+
IMAGE_NAME: ${{ github.repository }}
16+
17+
18+
jobs:
19+
build_and_publish:
20+
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
packages: write
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v3
29+
30+
- name: Set up QEMU
31+
uses: docker/setup-qemu-action@v2
32+
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v2
35+
36+
# Login against a Docker registry
37+
# https://github.com/docker/login-action
38+
- name: Log into registry ${{ env.REGISTRY }}
39+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
40+
with:
41+
registry: ${{ env.REGISTRY }}
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
45+
# Extract metadata (tags, labels) for Docker
46+
# https://github.com/docker/metadata-action
47+
- name: Extract Docker metadata
48+
id: meta
49+
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
50+
with:
51+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
52+
tags: |
53+
type=schedule
54+
type=ref,event=branch
55+
type=ref,event=tag
56+
type=ref,event=pr
57+
type=raw,value=latest,enable={{is_default_branch}}
58+
59+
# Build and push Docker image with Buildx
60+
# https://github.com/docker/build-push-action
61+
- name: Build and push Docker image
62+
id: build-and-push
63+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
64+
with:
65+
context: .
66+
push: true
67+
tags: ${{ steps.meta.outputs.tags }}
68+
labels: ${{ steps.meta.outputs.labels }}
69+
platforms: linux/amd64,linux/arm64
70+
cache-from: type=gha
71+
cache-to: type=gha,mode=max

.github/workflows/pre-commit.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Pre-Commit Checks
2+
3+
on:
4+
push: # Run for every push
5+
branches: ["*"]
6+
tags: ["*"]
7+
workflow_dispatch: # Run manually
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
name: Checkout code
15+
- uses: actions/setup-python@v4
16+
name: Setup Python
17+
with:
18+
python-version: 3.9
19+
- uses: pre-commit/action@v3.0.1
20+
name: Run Pre-Commit Checks

.justfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# List available commands
2+
default:
3+
@just --list --justfile {{justfile()}}
4+
5+
# initialize the project
6+
init:
7+
@which pdm || echo "pdm not found, you'll need to install it: https://github.com/pdm-project/pdm"
8+
@pdm install -G:all
9+
@OSTYPE="" . .venv/bin/activate
10+
@which pre-commit && pre-commit install && pre-commit autoupdate || true
11+
12+
# Build the project
13+
build: init dcb
14+
15+
# Run the pre-commit checks
16+
checks:
17+
@pre-commit run --all-files || { echo "Checking fixes\n" ; pre-commit run --all-files; }
18+
check: checks
19+
20+
# Run automated tests
21+
test:
22+
@pytest
23+
tests: test
24+
pytest: test
25+
26+
# Build docker image
27+
dcb:
28+
@docker compose build

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM madsci
1+
FROM ghcr.io/ad-sdl/madsci
22

33
LABEL org.opencontainers.image.source=https://github.com/AD-SDL/hudson_platecrane_module
44
LABEL org.opencontainers.image.description="Drivers and REST API's for the Hudson Platecrane and Sciclops robots"

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# sciclops_module
2-
A MADSci node module for interfacing with the Hudson Robotics Sciclops Platecrane
2+
3+
A MADSci Node module for interfacing with the Hudson Robotics Sciclops Platecrane.

compose.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,15 @@ name: sciclops_node
22
services:
33
sciclops:
44
container_name: sciclops
5-
image: sciclops
5+
image: ghcr.io/ad-sdl/sciclops_module
66
build:
77
context: .
88
dockerfile: Dockerfile
99
tags:
10-
- sciclops:latest
11-
- sciclops:0.0.1
12-
- sciclops:dev
10+
- ghcr.io/ad-sdl/sciclops_module:latest
11+
- ghcr.io/ad-sdl/sciclops_module:dev
1312
command: python -m sciclops_rest_node
1413
privileged: true
15-
env_file: .env
14+
network_mode: host
1615
volumes:
17-
- /dev:/dev
18-
- ./src:/home/app/sciclops_module/src
19-
ports:
20-
- 2000:2000
16+
- ./definitions:/home/madsci/definitions

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies = [
1616
"pyusb",
1717
"libusb",
1818
"pyserial",
19-
"madsci.node_module>=0.1.5",
19+
"madsci.node_module>=0.1.9",
2020
"pydantic>=2.7",
2121
"pytest"
2222
]

0 commit comments

Comments
 (0)