Skip to content

Commit

Permalink
chore: port tests to just
Browse files Browse the repository at this point in the history
  • Loading branch information
madwort committed Sep 27, 2023
1 parent 5742c38 commit 784454d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 24 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build_and_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ jobs:
uses: actions/checkout@master
- name: Build image
run: make build
- uses: extractions/setup-just@69d82fb0233557aec017ef13706851d0694e0f1d
- name: Run tests
run: make test
run: just test
- name: Run lint
run: make lint
run: just lint
- name: Log into GitHub Container Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image to GitHub Container Registry
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:
uses: actions/checkout@master
- name: Build image
run: make build
- uses: extractions/setup-just@69d82fb0233557aec017ef13706851d0694e0f1d
- name: Run tests
run: make test
run: just test
- name: Run lint
run: make lint
run: just lint
26 changes: 26 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export ACTION_IMAGE_NAME := env_var_or_default('ACTION_IMAGE_NAME', "base-action")

_default:
@just --list

build:
make build

# hadolint the Dockerfile
lint:
@docker pull hadolint/hadolint
@docker run --rm -i hadolint/hadolint < Dockerfile

test: build
#!/bin/bash
set -euxo pipefail

if test -t 0
then
export RUN_ARGS=-it
else
export RUN_ARGS=
fi
docker run $RUN_ARGS --rm -v {{justfile_directory()}}:/tests -w /tests $ACTION_IMAGE_NAME:20.04 ./tests.sh
docker run $RUN_ARGS --rm -v {{justfile_directory()}}:/tests -w /tests $ACTION_IMAGE_NAME:22.04 ./tests.sh
./check.sh
20 changes: 0 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
BASE_IMAGE_NAME ?= base-docker
ACTION_IMAGE_NAME ?= base-action
INTERACTIVE:=$(shell [ -t 0 ] && echo 1)


export DOCKER_BUILDKIT=1
export BASE_BUILD_DATE=$(shell date +'%y-%m-%dT%H:%M:%S.%3NZ')
Expand All @@ -13,20 +10,3 @@ build:

clean-build: ARGS=--no-cache
clean-build: build


.PHONY: test
ifdef INTERACTIVE
test: RUN_ARGS=-it
else
test: RUN_ARGS=
endif
test:
docker run $(RUN_ARGS) --rm -v $(PWD):/tests -w /tests $(ACTION_IMAGE_NAME):20.04 ./tests.sh
docker run $(RUN_ARGS) --rm -v $(PWD):/tests -w /tests $(ACTION_IMAGE_NAME):22.04 ./tests.sh
./check.sh

.PHONY: lint
lint:
@docker pull hadolint/hadolint
@docker run --rm -i hadolint/hadolint < Dockerfile

0 comments on commit 784454d

Please sign in to comment.