diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..74aa5ca --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,82 @@ +name: Test Pull Request + +on: [push,pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8'] + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Cache .cache/pip + uses: actions/cache@v3 + id: cache-pip + with: + path: ~/.cache/pip + key: pip_cache_py_${{ matrix.python-version }} + - name: Install package + run: pip install -r requirements.txt black==23.3 flake8==6.0 + - name: Flake8 + run: flake8 --ignore=C901,W503 + - name: Black + uses: psf/black@23.3.0 + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8'] + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Cache .cache/pip + uses: actions/cache@v3 + id: cache-pip + with: + path: ~/.cache/pip + key: pip_cache_py_${{ matrix.python-version }} + - name: install package + run: python -m pip install . + - name: install packages for testing + run: pip install nose xmldiff + - name: run nosetests + run: nosetests --with-coverage --cover-package=galaxyxml + + - name: Run smoke test on example + run: | + python examples/example.py > tmp.xml + xmldiff tmp.xml examples/tool.xml + python examples/example_macros.py > tmp.xml + xmldiff tmp.xml examples/example_macros.xml + + + deploy: + name: Deploy + needs: [lint, test] + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.7'] + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Cache .cache/pip + uses: actions/cache@v3 + id: cache-pip + with: + path: ~/.cache/pip + key: pip_cache_py_${{ matrix.python-version }} + - uses: casperdcl/deploy-pypi@v2 + with: + password: ${{ secrets.PYPI_TOKEN }} + build: --sdist --wheel --outdir dist . + # only upload if a tag is pushed (otherwise just build & check) + upload: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') }}