From ced68f0cb264557780acaf66f824b4c474a51b21 Mon Sep 17 00:00:00 2001 From: Artem Makarov Date: Wed, 23 Dec 2020 16:44:15 +0100 Subject: [PATCH] Update ci --- .github/workflows/ci.yml | 43 +++++++++++++++++----------------------- Makefile | 11 ++++++---- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce5063b..db61e75 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,30 +4,23 @@ on: push jobs: test: + name: test & release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python 2.7 - uses: actions/setup-python@v2 - with: - python-version: 2.7 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - name: Test - run: python -m unittest ns_schedule - release: - runs-on: ubuntu-latest - needs: test - if: startsWith(github.ref, 'refs/tags/') - steps: - - uses: actions/checkout@v2 - - name: Build artifacts - run: make - - name: Create release - uses: softprops/action-gh-release@v1 - with: - files: '*.alfredworkflow' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v2 + - name: Set up Python 2.7 + uses: actions/setup-python@v2 + with: + python-version: 2.7 + - name: Test + run: make test + - name: Build artifact + if: startsWith(github.ref, 'refs/tags/') + run: make build + - name: Create release + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: '*.alfredworkflow' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index e45df99..a593237 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,21 @@ PYTHON=python2 +PIP=pip NS_SCHEDULE_PY=ns_schedule.py NS_SCHEDULE_TEST_PY=ns_schedule_test.py ALFRED_FILE_NAME=NS_Schedule ALFRED_PACKAGE_FILES=./alfred/* -.PHONY: clean build alfred +.PHONY: clean test build -all: clean test alfred +all: clean test build clean: rm -fr out *.alfredworkflow test: + $(PYTHON) -m pip install --upgrade pip + $(PIP) install -r requirements.txt $(PYTHON) $(NS_SCHEDULE_TEST_PY) -alfred: - zip -j -r $(ALFRED_FILE_NAME).alfredworkflow $(ALFRED_PACKAGE_FILES) $(NS_SCHEDULE_PY) +build: + zip -j -r $(ALFRED_FILE_NAME).alfredworkflow $(ALFRED_PACKAGE_FILES) $(NS_SCHEDULE_PY) \ No newline at end of file