Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github Actions - Windows #352

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
test:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, ubuntu-18.04]
platform: [ubuntu-latest, macos-latest, ubuntu-18.04, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ tests/trash\ directory.*
done.txt
report.txt
todo.txt
todo.txt_cli-*.tar.gz
todo.txt_cli-*.zip
54 changes: 30 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ INSTALL_DATA = $(INSTALL) -m 644

prefix = /usr/local

ifeq ($(OS), Windows_NT)
ZIP_PROGRAM=7z a -r
else
ZIP_PROGRAM=zip -r -9
endif

# ifdef check allows the user to pass custom dirs
# as per the README

Expand Down Expand Up @@ -48,38 +54,38 @@ DISTFILES := todo.cfg todo_completion

DISTNAME=todo.txt_cli-$(VERSION)
dist: $(DISTFILES) todo.sh
mkdir -p $(DISTNAME)
cp -f $(DISTFILES) $(DISTNAME)/
sed -e 's/@DEV_VERSION@/'$(VERSION)'/' todo.sh > $(DISTNAME)/todo.sh
chmod +x $(DISTNAME)/todo.sh
tar cf $(DISTNAME).tar $(DISTNAME)
gzip -f -9 $(DISTNAME).tar
zip -r -9 $(DISTNAME).zip $(DISTNAME)
rm -r $(DISTNAME)
mkdir -p "$(DISTNAME)"
cp -f $(DISTFILES) "$(DISTNAME)/"
sed -e 's/@DEV_VERSION@/'$(VERSION)'/' todo.sh > "$(DISTNAME)/todo.sh"
chmod +x "$(DISTNAME)/todo.sh"
tar cf $(DISTNAME).tar "$(DISTNAME)"
gzip -f -9 "$(DISTNAME).tar"
$(ZIP_PROGRAM) "$(DISTNAME).zip" "$(DISTNAME)"
rm -r "$(DISTNAME)"

.PHONY: clean
clean: test-pre-clean
rm -f $(DISTNAME).tar.gz $(DISTNAME).zip
rm VERSION-FILE
rm -f "$(DISTNAME).tar.gz" "$(DISTNAME).zip"
rm "VERSION-FILE"

install: installdirs
$(INSTALL_PROGRAM) todo.sh $(DESTDIR)$(bindir)/todo.sh
$(INSTALL_DATA) todo_completion $(DESTDIR)$(datarootdir)/todo
[ -e $(DESTDIR)$(sysconfdir)/todo/config ] || \
sed "s/^\(export[ \t]*TODO_DIR=\).*/\1~\/.todo/" todo.cfg > $(DESTDIR)$(sysconfdir)/todo/config
$(INSTALL_PROGRAM) todo.sh "$(DESTDIR)$(bindir)/todo.sh"
$(INSTALL_DATA) todo_completion "$(DESTDIR)$(datarootdir)/todo"
[ -e "$(DESTDIR)$(sysconfdir)/todo/config" ] || \
sed "s/^\(export[ \t]*TODO_DIR=\).*/\1~\/.todo/" todo.cfg > "$(DESTDIR)$(sysconfdir)/todo/config"

uninstall:
rm -f $(DESTDIR)$(bindir)/todo.sh
rm -f $(DESTDIR)$(datarootdir)/todo
rm -f $(DESTDIR)$(sysconfdir)/todo/config
rm -f "$(DESTDIR)$(bindir)/todo.sh"
rm -f "$(DESTDIR)$(datarootdir)/todo"
rm -f "$(DESTDIR)$(sysconfdir)/todo/config"

rmdir $(DESTDIR)$(datarootdir)
rmdir $(DESTDIR)$(sysconfdir)/todo
rmdir "$(DESTDIR)$(datarootdir)"
rmdir "$(DESTDIR)$(sysconfdir)/todo"

installdirs:
mkdir -p $(DESTDIR)$(bindir) \
$(DESTDIR)$(sysconfdir)/todo \
$(DESTDIR)$(datarootdir)
mkdir -p "$(DESTDIR)$(bindir)" \
"$(DESTDIR)$(sysconfdir)/todo" \
"$(DESTDIR)$(datarootdir)"

#
# Testing
Expand All @@ -88,7 +94,7 @@ TESTS = $(wildcard tests/t[0-9][0-9][0-9][0-9]-*.sh)
#TEST_OPTIONS=--verbose

test-pre-clean:
rm -rf tests/test-results "tests/trash directory"*
rm -rf "tests/test-results" "tests/trash directory"*

aggregate-results: $(TESTS)

Expand All @@ -98,7 +104,7 @@ $(TESTS): test-pre-clean
test: aggregate-results
tests/aggregate-results.sh tests/test-results/t*-*
rm -rf tests/test-results

# Force tests to get run every time
.PHONY: test test-pre-clean aggregate-results $(TESTS)