From 2f7ad5aec8f27b4a9835087113d51ec370dd63d7 Mon Sep 17 00:00:00 2001 From: Merlin Ran Date: Sat, 12 Mar 2022 17:59:11 -0500 Subject: [PATCH] try pushing image to ghcr.io --- .github/workflows/test.yaml | 16 +++++++++++++--- Dockerfile | 2 +- Makefile | 12 ++++++++---- vehicle/requirements.txt | 4 ++++ 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3b9fca9..f20429d 100755 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,16 +1,26 @@ name: test -on: [pull_request, push, workflow_dispatch] +on: [pull_request, workflow_dispatch] concurrency: group: test-${{github.ref}} cancel-in-progress: true jobs: + image: + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v2 + + - name: push image + run: GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}} make push-image + test: runs-on: ubuntu-latest + needs: image # To create and push new image: make push-image - container: docker://merlinran/acorn_docker:latest + container: ghcr.io/twisted-fields/acorn_docker:latest strategy: fail-fast: true @@ -19,7 +29,7 @@ jobs: uses: actions/checkout@v2 - name: Run tests - run: coverage run -m pytest + run: make test - name: Upload Coverage to Codecov uses: codecov/codecov-action@v1 diff --git a/Dockerfile b/Dockerfile index 8941d35..4b510a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,7 +54,7 @@ RUN apt update && apt install -y libffi-dev \ bash \ iputils-ping RUN python3 -m pip install --upgrade pip -RUN python3 -m pip install wheel certifi==2020.06.20 pytest coverage[toml] +RUN python3 -m pip install wheel certifi==2020.06.20 pytest~=7.0.1 coverage[toml]~=6.3.2 COPY server/requirements.txt /install/server/ RUN python3 -m pip install -r /install/server/requirements.txt COPY vehicle/requirements.txt /install/vehicle/ diff --git a/Makefile b/Makefile index a2a06ac..82ce555 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ LOCAL_IMAGE = acorn_docker:1.0 -REMOTE_IMAGE = merlinran/acorn_docker +REMOTE_IMAGE = ghcr.io/twisted-fields/acorn_docker:latest ACORN_NAMES ?= simulation-1 .PHONY: list @@ -40,8 +40,12 @@ docker-test: docker-image @docker-compose -f docker-compose-test.yml up --remove-orphans -d && \ docker exec -it acorn_vehicle make test -.PHONY: push-image # Build and push image to Docker Hub to be used by CI. -push-image: docker-image +.PHONY: push-image # Build and push image to GitHub Container Registry to be used by CI. +push-image: + echo $(GITHUB_TOKEN) | docker login ghcr.io -u twisted-fields --password-stdin && make do-push-image + +.PHONY: do-push-image +do-push-image: docker-image ifeq ($(shell uname -m),arm64) docker buildx build -t $(REMOTE_IMAGE) --platform linux/amd64,linux/arm64 --push . else @@ -50,7 +54,7 @@ endif .PHONY: test # Run tests on Linux (if the Python dependencies are installed) or inside Docker. Otherwise, you probably want to try `make docker-test` instead. test: - coverage run -m pytest --log-cli-level DEBUG && coverage report --skip-covered --skip-empty + python3 -m coverage run -m pytest --log-cli-level DEBUG && python3 -m coverage report --skip-covered --skip-empty .PHONY: docker-vehicle docker-vehicle: docker-image diff --git a/vehicle/requirements.txt b/vehicle/requirements.txt index 32f27ea..e18059c 100644 --- a/vehicle/requirements.txt +++ b/vehicle/requirements.txt @@ -6,3 +6,7 @@ click coloredlogs csaps rpi_ws281x +geopy +psutil +evdev +fibre