Skip to content

Commit

Permalink
adds ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
christophkloeffel committed Apr 11, 2024
1 parent 666f8af commit 568a058
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 17 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: LOBSTER CI

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

permissions:
contents: read

jobs:
lint:
name: PyLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements_dev.txt
make lobster/html/assets.py
- name: Executing Linter
run: |
make lint
test:
name: TestSuite
needs: lint
if: success()
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
py-version: ["3.8", "3.9", "3.10", "3.11"]
include:
- os: macos-13
brew: "/usr/local"
- os: macos-14
brew: "/opt/homebrew"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install python version
if: matrix.os != 'macos-14' || matrix.py-version == '3.10' || matrix.py-version == '3.11' || matrix.py-version == '3.12'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py-version }}
- name: Install python (3.8, 3.9) on macOS-arm64
if: matrix.os == 'macos-14' && matrix.py-version == '3.8' || matrix.py-version == '3.9'
run: |
brew install python@${{ matrix.py-version }}
echo "${{ matrix.brew }}/opt/python@${{ matrix.py-version }}/libexec/bin" >> $GITHUB_PATH
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python${{ matrix.py-version }} get-pip.py
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Install GNU Make on macOS
if: startsWith(matrix.os, 'macos')
run: |
brew install make
echo "${{ matrix.brew }}/opt/make/libexec/gnubin" >> $GITHUB_PATH
- name: Executing System Tests
run: |
make system-tests
- name: Executing Unit Tests
run: |
make unit-tests
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,37 +40,37 @@ packages:
diff -Naur test_install/lib/python*/site-packages/lobster test_install_monolithic/lib/python*/site-packages/lobster -x "*.pyc"
diff -Naur test_install/bin test_install_monolithic/bin

integration_tests: packages
integration-tests: packages
(cd integration-tests/projects/basic; make)
(cd integration-tests/projects/filter; make)

system_tests:
system-tests:
make -B -C test-system/lobster-json
make -B -C test-system/lobster-python

unit_tests:
unit-tests:
python3 -m unittest discover -s test-unit -v

test: integration_tests system_tests unit_tests
test: integration-tests system-tests unit-tests

upload_main: packages
upload-main: packages
python3 -m twine upload --repository pypi packages/*/dist/*
python3 -m twine upload --repository pypi packages/*/meta_dist/*

remove_dev:
remove-dev:
python3 -m util.release

github_release:
github-release:
git push
python3 -m util.github_release

bump:
python3 -m util.bump_version_post_release

full_release:
make remove_dev
full-release:
make remove-dev
git push
make upload_main
make github_release
make upload-main
make github-release
make bump
git push
10 changes: 5 additions & 5 deletions lobster/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def lobster_read(mh, filename, level, items, source_info=None):

if source_info is not None:
item.perform_source_checks(source_info)

# evaluate source_info filters
for f, v in source_info['filters']:
if f == 'prefix':
Expand All @@ -125,9 +125,9 @@ def lobster_read(mh, filename, level, items, source_info=None):
if all(filter_conditions):
if item.tag.key() in items:
mh.error(item.location,
"duplicate definition of %s, "
"previously defined at %s" %
(item.tag.key(),
items[item.tag.key()].location.to_string()))
"duplicate definition of %s, "
"previously defined at %s" %
(item.tag.key(),
items[item.tag.key()].location.to_string()))

items[item.tag.key()] = item
1 change: 0 additions & 1 deletion lobster/tools/json/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
# <https://www.gnu.org/licenses/>.

import sys
import os.path
import json
from pathlib import PurePath
from pprint import pprint
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
trlc>=1.2.2
requests>=2.31.0
libcst>=1.1.0
3 changes: 3 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-r requirements.txt
pycodestyle>=2.11.1
pylint>=3.1.0

0 comments on commit 568a058

Please sign in to comment.