To make the test logs more readable, we should fold the
output per test into a group.
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This prevented JetBrains GoLand from recognising subtests and treated
it all as single big test, VSCode seems to be still broken in that regard
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Casey Lee <cplee@nektos.com>
Prevents random failing of all other runs when qemu binfmt
is not set up
Signed-off-by: Ryan <me@hackerc.at>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* don't merge env var if it exists already
* remove test workflow
* add some tests
* change mergeMaps order instead of checking for existence
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* fix: copy ignored tracked files
* fix
* refactor: Extract callback to fileCollector
fix: temporary tar archive not deletable on windows
fix: `.*` in gitignore ignores all files
* Move nolint: gocyclo
* pass context as parameter
* goimport
* Add fs interface + one test
* fix lint, also test for ignored non tracked file
* fix filename
* Apply suggestions from code review
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* deps: bump go.mod to go1.18
* deps: go mod tidy
* docs: update Go version requirement
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This change reduces the interfaces by removing
obsolete parameters from functions.
Obsolete parameters does not means unused ones, but
parameters which could be retrieved from other parameters
instead.
This should simplify logic and maintainability for these
functions.
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* refactor: split step_context into separate files
This commit moves functions from the step_context.go file into different
files, but does otherwise not change anything.
This is done to make it easier to review the changes made to these
functions in the next commit, where we introduce a step factory to
facilitate better unit testing of steps.
Co-authored-by: Marcus Noll <marcus.noll@new-work.se>
Co-authored-by: Björn Brauer <bjoern.brauer@new-work.se>
Co-authored-by: Robert Kowalski <robert.kowalski@new-work.se>
Co-authored-by: Philipp Hinrichsen <philipp.hinrichsen@new-work.se>
Co-authored-by: Jonas Holland <jonas.holland@new-work.se>
* refactor: introduce step factory and make steps testable
With this commit we're introducing the `stepFactory` and interfaces
and implementations for each different kind of step (run, docker,
local and remote actions).
Separating each step kind into its own interface and implementation
makes it easier to reason about and to change behaviour of the step.
By introducing interfaces we enable better unit testability as now
each step implementation, the step factory and the job executor can
be tested on their own by mocking out parts that are irrelevant.
This commits prepares us for implementing pre/post actions in a
later PR.
Co-authored-by: Marcus Noll <marcus.noll@new-work.se>
Co-authored-by: Björn Brauer <bjoern.brauer@new-work.se>
Co-authored-by: Robert Kowalski <robert.kowalski@new-work.se>
Co-authored-by: Philipp Hinrichsen <philipp.hinrichsen@new-work.se>
Co-authored-by: Jonas Holland <jonas.holland@new-work.se>
* fix: run post steps in reverse order
* test: add missing asserts for mocks
* refactor: use local reference instead of function
This may make code more easy to follow.
* refactor: correct typo in function name
* test: use named structs
* test: only expected valid calls
There are mocks which are only called on certain conditions.
* refactor: use step-model to get step name
Using the step-logger we have to get the logger name from the
step model.
* test: only mock stopContainer if required
Co-authored-by: Björn Brauer <bjoern.brauer@new-work.se>
Co-authored-by: Marcus Noll <marcus.noll@new-work.se>
Co-authored-by: Robert Kowalski <robert.kowalski@new-work.se>
Co-authored-by: Philipp Hinrichsen <philipp.hinrichsen@new-work.se>
Co-authored-by: Jonas Holland <jonas.holland@new-work.se>
Co-authored-by: Casey Lee <cplee@nektos.com>
Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
* Fix: panic: reflect: slice index out of range
* Update interpreter.go
* [no ci] Return null for negative indexes
* Add tests for index access
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
act has a feature that skips the checkout action to do a remote
checkout when a local checkout exists. in some cases, e.g. when
running act in a CI, you always want to clone the repository.
The function `WithTestContext` is never called in the project, and
there is just one usage of `TestContext`, inside one of our loggers
Co-authored-by: Casey Lee <cplee@nektos.com>
Co-authored-by: Björn Brauer <bjoern.brauer@new-work.se>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* feat: add step name to logger field
This change does add the step name to the logger fields. This does
not change the output for our users, but for the json logger, it
does make each step output traceable.
* fix: remove new logger
Since logrus and context both are immutable for our case, we
can just add a new field and store the logger in the context.
Co-authored-by: Casey Lee <cplee@nektos.com>
Co-authored-by: Björn Brauer <bjoern.brauer@new-work.se>
Co-Authored-By: Markus Wolf <markus.wolf@new-work.se>
Co-authored-by: Markus Wolf <markus.wolf@new-work.se>
Co-authored-by: Casey Lee <cplee@nektos.com>
* feat: add json logger output
This will allow to format log output as json.
This is helpful in cases where act is not executed on a 'local' machine.
* refactor: use runner config
Using the runner config to configure logging is cleaner.
Co-authored-by: Casey Lee <cplee@nektos.com>