Skip to content

Commit

Permalink
ci: Migrate to GitHub Actions
Browse files Browse the repository at this point in the history
I wanted to use the same CI server in my projects for easier
maintenance.
  • Loading branch information
macie committed Nov 10, 2023
1 parent 9390e12 commit 38637da
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 39 deletions.
18 changes: 0 additions & 18 deletions .circleci/config.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Quality check
on:
push:
branches:
- "*"
pull_request:

jobs:
static-analysis:
name: Static analysis
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v4

- run: make check

tests:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v4

- run: make test
20 changes: 11 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
# Ignore everything
*

# But not these files...
# Allow CI configs
!/.gitignore
!README.md
!CONTRIBUTING.md
!LICENSE

!.circleci/*
!Makefile
!/Makefile
!/.github/workflows/*.yml

# Allow source code...
!unittest
!tests/
!tests/*.sh
!*.sh

!README.md
!LICENSE
!CONTRIBUTING.md

# ...also in subdirectories
!*/
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,25 @@ TEST=./unittest

# MAIN TARGETS

all: test check
all:

debug:
@printf '> OS info: '
info:
@printf '# OS info: '
@uname -rsv;
@printf '> Development dependencies:\n'
@printf '# Development dependencies:\n'
@echo; $(LINT) -V
@echo; $(TEST) -v

check: $(LINT)
@printf '> Static analysis: $(LINT) unittest tests/*.sh' >&2
@printf '# Static analysis: $(LINT) unittest tests/*.sh' >&2
@$(LINT) unittest tests/*.sh

test:
@echo '> Unit tests: $(TEST)' >&2
@echo '# Unit tests: $(TEST)' >&2
@$(TEST)

# HELPERS

$(LINT):
@printf '> $@ installation path: ' >&2
@printf '# $@ installation path: ' >&2
@command -v $@ >&2 || { echo 'ERROR: Cannot find $@' >&2; exit 1; }

16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# unittest

[![Build Status](https://dl.circleci.com/status-badge/img/gh/macie/unittest.sh/tree/master.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/macie/unittest.sh/tree/master)
[![Quality check status](https://github.com/macie/unittest.sh/actions/workflows/check.yml/badge.svg)](https://github.com/macie/unittest.sh/actions/workflows/check.yml)

_Unittest is the standard test runner._

Expand All @@ -16,7 +16,7 @@ in any language.

## Usage

With a basic call, it searches inside `tests\` directory for `test_*.sh` files with `test_*` functions:
With a basic call, it searches inside `tests/` directory for `test_*.sh` files with `test_*` functions:

```bash
$ unittest
Expand Down Expand Up @@ -57,7 +57,7 @@ tests/test_output.sh:test_status_fail PASS

For example, tests see files inside the [tests directory](./tests).

## Install
## Installation

Using `curl`:
```bash
Expand All @@ -72,6 +72,15 @@ wget https://raw.githubusercontent.com/macie/unittest.sh/master/unittest
chmod +x unittest
```

## Development

Use `make` (GNU or BSD):

- `make` - check dependencies
- `make test` - runs test
- `make check` - static code analysis
- `make info` - print system info (useful for debugging).

## Alternatives

Robert Lehmann created a list of [the most popular shell testing tools](https://github.com/lehmannro/assert.sh#related-projects).
Expand Down Expand Up @@ -122,4 +131,3 @@ PASS
```

Finally, all tests from a file can be run with some `grep` and loop. And this is basically `unittest`.

0 comments on commit 38637da

Please sign in to comment.