Skip to content

Commit

Permalink
Rework the Github Actions workflows.
Browse files Browse the repository at this point in the history
 * Create a composite action for setting up the system.
 * Expand `check-install.yml` to check that installing works from all
   of;
    - GitHub
    - Checked out locally with `python setup.py install`
    - Checked out locally with `pip install -e .`
    - Building and then installing wheels.
 * Remove `wheel.yml` as covered by `check-install.yml`'s building and
   then installing wheels.

Signed-off-by: Tim 'mithro' Ansell <[email protected]>
  • Loading branch information
mithro committed Mar 8, 2021
1 parent 32178da commit 830eb22
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 228 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/check-functionality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Functionality

on:
push:
pull_request:

jobs:

Functionality:
runs-on: ubuntu-latest

strategy:
matrix:
antlr_runtime_type: [static, shared]
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

name: Functionality on Python ${{ matrix.python-version }} (with ${{ matrix.antlr_runtime_type}} antlr)

steps:
- run: |
echo "${{ github.repository }}/.github/workflows/system-setup@${{ github.sha }}"
- uses: mithro/fasm/.github/workflows/system-setup@setupcfg
with:
development-tools: true
python-version: ${{ matrix.python-version }}

- name: Run Tests
run: |
ANTLR4_RUNTIME_TYPE=${{ matrix.antlr_runtime_type }} tox -e ${{ matrix.TOXENV }}
105 changes: 84 additions & 21 deletions .github/workflows/check-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,106 @@ jobs:
GitHub:
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-20.04]
os: [windows-latest, macos-latest, ubuntu-latest]
fail-fast: false

name: GitHub
runs-on: ${{ matrix.os }}

steps:
- name: 🐍 Set up Python
uses: actions/setup-python@v2
- uses: '${{ github.repository }}/.github/workflows/system-setup@${{ github.sha }}'
with:
python-version: 3.x
os: ${{ matrix.os }}
git-checkout: false

- name: Install pip
- name: Test installation
shell: bash
run: |
pip install --upgrade pip
pip install git+https://github.com/${GITHUB_REPOSITORY}.git@${GITHUB_SHA}#egg=fasm
- name: Install package's system dependencies (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
- name: Run smoke test
run: |
sudo apt-get update
sudo apt-get install -y cmake default-jre-headless uuid-dev libantlr4-runtime-dev
fasm --help
# - name: Run tests against installed version
# run: |
# cd tests; python test_simple.py

Checkout:
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
cmd:
- python setup.py install
- pip install .
- pip install -e . # Editable install
fail-fast: false

name: Checkout with '${{ matrix.cmd }}'
runs-on: ${{ matrix.os }}

- name: Install package's system dependencies (Mac OS X)
if: startsWith(matrix.os, 'macos')
steps:
- uses: '${{ github.repository }}/.github/workflows/system-setup@${{ github.sha }}'
with:
os: ${{ matrix.os }}

- name: Install using '${{ matrix.cmd }}'
run: |
true
${{ matrix.cmd }}
- name: Install package's system dependencies (Windows)
if: startsWith(matrix.os, 'windows')
- name: Run smoke test
run: |
true
fasm --help
- name: Test installation
shell: bash
- name: Run tests against installed version
run: |
pip install git+https://github.com/${GITHUB_REPOSITORY}.git@${GITHUB_SHA}#egg=fasm
cd tests; python test_simple.py
Wheel:
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
fail-fast: false

- name: Run Smoke Test
runs-on: ${{ matrix.os }}

steps:
- uses: '${{ github.repository }}/.github/workflows/system-setup@${{ github.sha }}'
with:
os: ${{ matrix.os }}

- name: Build wheel
run: |
python setup.py bdist_wheel
- name: Upload wheel
uses: actions/upload-artifact@v2
with:
name: fasm
path: dist

- name: Install wheel
run: |
pip install dist/*.whl
- name: Run smoke test
run: |
fasm --help
- name: Run tests against installed version
run: |
cd tests; python test_simple.py
make-env:
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]

name: make-env (Conda)
runs-on: ${{ matrix.os }}

steps:
- uses: '${{ github.repository }}/.github/workflows/checkout@${{ github.sha }}'

- name: Run tests
run: |
make tests
31 changes: 31 additions & 0 deletions .github/workflows/check-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Style

on:
push:
pull_request:

jobs:

Style:
runs-on: ubuntu-latest

steps:
- uses: '${{ github.repository }}/.github/workflows/system-setup@${{ github.sha }}'
with:
development-tools: true

- name: Check license headers
run: make check-license

- name: Python style check
run: |
make format lint
test $(git status --porcelain | wc -l) -eq 0 || { git diff; false; }
- name: Python script checks
run: make check-python-scripts

- name: C++ style check
run: |
make format-cpp
test $(git status --porcelain | wc -l) -eq 0 || { git diff; false; }
13 changes: 13 additions & 0 deletions .github/workflows/checkout/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 🧰 Checkout
description: "Checkout the git repository correctly"

runs:
using: "composite"

steps:
- name: 🧰 Checkout
uses: actions/checkout@v2
with:
# Always clone the full depth so git-describe works.
fetch-depth: 0
submodules: true
72 changes: 0 additions & 72 deletions .github/workflows/presubmit.yml

This file was deleted.

Loading

0 comments on commit 830eb22

Please sign in to comment.