From 412578cbd15d64196a1c217124a1aa86dd30897e Mon Sep 17 00:00:00 2001 From: umarcor Date: Fri, 19 Feb 2021 16:46:42 +0100 Subject: [PATCH] ci: merge workflows Signed-off-by: umarcor --- .github/workflows/presubmit.yml | 72 ----------- .../{publish-to-pypi.yml => test.yml} | 118 +++++++++++++++++- .github/workflows/wheel.yml | 40 ------ 3 files changed, 117 insertions(+), 113 deletions(-) delete mode 100644 .github/workflows/presubmit.yml rename .github/workflows/{publish-to-pypi.yml => test.yml} (64%) delete mode 100644 .github/workflows/wheel.yml diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml deleted file mode 100644 index aca2f95f..00000000 --- a/.github/workflows/presubmit.yml +++ /dev/null @@ -1,72 +0,0 @@ -# Checks code that code meets requirements for a pull request. -# Any automated checks for code quality and compliance belongs here. -name: presubmit -on: [push, pull_request] -jobs: - check: - name: Source checks - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - with: - # Always clone the full depth so git-describe works. - fetch-depth: 0 - submodules: true - - name: Set up Python - uses: actions/setup-python@v2 - - name: Install dependencies - run: | - sudo apt update - sudo apt install clang-format - python -m pip install --upgrade pip - pip install -r requirements.txt - - name: Python style check - run: | - make format lint - test $(git status --porcelain | wc -l) -eq 0 || { git diff; false; } - - name: C++ style check - run: | - make format-cpp - test $(git status --porcelain | wc -l) -eq 0 || { git diff; false; } - - name: Check license - run: make check-license - - name: Python checks - run: make check-python-scripts - test: - name: Test Python package - runs-on: ubuntu-20.04 - strategy: - matrix: - antlr_runtime_type: [static, shared] - python_version: [3.5, 3.6, 3.7, 3.8, 3.9] - include: - - python-version: 3.5 - TOXENV: py35 - - python-version: 3.6 - TOXENV: py36 - - python-version: 3.7 - TOXENV: py37 - - python-version: 3.8 - TOXENV: py38 - - python-version: 3.9 - TOXENV: py39 - fail-fast: false - steps: - - uses: actions/checkout@v2 - with: - # Always clone the full depth so git-describe works. - fetch-depth: 0 - submodules: true - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - sudo apt update - sudo apt install cmake default-jre-headless uuid-dev libantlr4-runtime-dev - python -m pip install --upgrade pip - pip install -r requirements.txt - python update_version.py - - name: Tox - run: ANTLR4_RUNTIME_TYPE=${{ matrix.antlr_runtime_type }} tox -e ${{ matrix.TOXENV }} diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/test.yml similarity index 64% rename from .github/workflows/publish-to-pypi.yml rename to .github/workflows/test.yml index 375f6dc4..16269917 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: PyPI +name: Test on: push: @@ -7,6 +7,10 @@ on: jobs: +# +# PyPI +# + Source: runs-on: ubuntu-20.04 name: Source @@ -215,3 +219,115 @@ jobs: TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | twine upload dist/*.whl + +# +# presubmit +# + + presubmit-check: + name: Source checks + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + # Always clone the full depth so git-describe works. + fetch-depth: 0 + submodules: true + - name: Set up Python + uses: actions/setup-python@v2 + - name: Install dependencies + run: | + sudo apt update + sudo apt install clang-format + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Python style check + run: | + make format lint + test $(git status --porcelain | wc -l) -eq 0 || { git diff; false; } + - name: C++ style check + run: | + make format-cpp + test $(git status --porcelain | wc -l) -eq 0 || { git diff; false; } + - name: Check license + run: make check-license + - name: Python checks + run: make check-python-scripts + + presubmit-test: + name: Test Python package + runs-on: ubuntu-20.04 + strategy: + matrix: + antlr_runtime_type: [static, shared] + python_version: [3.5, 3.6, 3.7, 3.8, 3.9] + include: + - python-version: 3.5 + TOXENV: py35 + - python-version: 3.6 + TOXENV: py36 + - python-version: 3.7 + TOXENV: py37 + - python-version: 3.8 + TOXENV: py38 + - python-version: 3.9 + TOXENV: py39 + fail-fast: false + steps: + - uses: actions/checkout@v2 + with: + # Always clone the full depth so git-describe works. + fetch-depth: 0 + submodules: true + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + sudo apt update + sudo apt install cmake default-jre-headless uuid-dev libantlr4-runtime-dev + python -m pip install --upgrade pip + pip install -r requirements.txt + python update_version.py + - name: Tox + run: ANTLR4_RUNTIME_TYPE=${{ matrix.antlr_runtime_type }} tox -e ${{ matrix.TOXENV }} + +# +# Wheels +# + + wheels: + runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: [3.5, 3.6, 3.7, 3.8, 3.9] + fail-fast: false + steps: + - uses: actions/checkout@v2 + with: + # Always clone the full depth so git-describe works. + fetch-depth: 0 + submodules: true + - name: Install dependencies + run: | + sudo apt update + sudo apt install cmake default-jre-headless uuid-dev libantlr4-runtime-dev + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: python -m pip install --upgrade -r requirements.txt + - name: Generate version + run: python update_version.py + - name: Build wheels + run: python setup.py bdist_wheel + - name: Test wheel installation + run: | + python -m pip install dist/*.whl + (cd tests; python test_simple.py) + - uses: actions/upload-artifact@v2 + with: + name: fasm + path: dist diff --git a/.github/workflows/wheel.yml b/.github/workflows/wheel.yml deleted file mode 100644 index 6392bd62..00000000 --- a/.github/workflows/wheel.yml +++ /dev/null @@ -1,40 +0,0 @@ -# Builds a binary distibutable package. -# Minimal functionality checks may be run as part of the build process, but -# source code checks and extensive functionality checks (e.g. tox) belong in presubmit.yml -name: Python wheels -on: [push, pull_request] -jobs: - wheels: - runs-on: ubuntu-20.04 - strategy: - matrix: - python-version: [3.5, 3.6, 3.7, 3.8, 3.9] - fail-fast: false - steps: - - uses: actions/checkout@v2 - with: - # Always clone the full depth so git-describe works. - fetch-depth: 0 - submodules: true - - name: Install dependencies - run: | - sudo apt update - sudo apt install cmake default-jre-headless uuid-dev libantlr4-runtime-dev - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: python -m pip install --upgrade -r requirements.txt - - name: Generate version - run: python update_version.py - - name: Build wheels - run: python setup.py bdist_wheel - - name: Test wheel installation - run: | - python -m pip install dist/*.whl - (cd tests; python test_simple.py) - - uses: actions/upload-artifact@v2 - with: - name: fasm - path: dist