Skip to content

Add more robust support for line number, column number and byte number tracking to the lexer #745

Add more robust support for line number, column number and byte number tracking to the lexer

Add more robust support for line number, column number and byte number tracking to the lexer #745

Workflow file for this run

name: Run tests
on:
push:
branches: [ trunk ]
pull_request:
branches: [ trunk ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
run_lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get deadsnakes repo
run: sudo add-apt-repository --yes ppa:deadsnakes/ppa
- name: Update local package lists
run: sudo apt update
- name: Install Python
run: sudo apt install --yes python3.10
- run: python3.10 -m pip install --user pipx
- run: python3.10 -m pipx install poetry
- run: poetry install --with=dev
- run: poetry run ruff check scrapscript.py
- run: poetry run ruff format --check scrapscript.py
- run: poetry run mypy --strict scrapscript.py
run_interpreter_unit_tests:
strategy:
matrix:
PYTHON: [python3.8, python3.9, python3.10, python3.11, python3.12, python3.13]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get deadsnakes repo
run: sudo add-apt-repository --yes ppa:deadsnakes/ppa
- name: Update local package lists
run: sudo apt update
- name: Install Python
run: sudo apt install --yes ${{matrix.PYTHON}}
- name: Run interpreter tests
run: ${{matrix.PYTHON}} scrapscript.py test
run_compiler_unit_tests:
strategy:
matrix:
PYTHON: [python3.8, python3.9, python3.10, python3.11, python3.12, python3.13]
CC: [gcc, clang, tcc]
USE_STATIC_HEAP: ["-DSTATIC_HEAP", ""]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get deadsnakes repo
run: sudo add-apt-repository --yes ppa:deadsnakes/ppa
- name: Update local package lists
run: sudo apt update
- name: Install deps
run: sudo apt install --yes ${{matrix.PYTHON}} ${{matrix.CC}} valgrind
- name: Run compiler tests
run: CC=${{matrix.CC}} CFLAGS="${{matrix.USE_STATIC_HEAP}}" ${{matrix.PYTHON}} compiler_tests.py
- name: Run compiler tests -DNDEBUG
run: CC=${{matrix.CC}} CFLAGS="${{matrix.USE_STATIC_HEAP}} -DNDEBUG" ${{matrix.PYTHON}} compiler_tests.py
- name: Run compiler tests with ASAN
run: CC=${{matrix.CC}} CFLAGS="-fsanitize=address ${{matrix.USE_STATIC_HEAP}}" ${{matrix.PYTHON}} compiler_tests.py
- name: Run compiler tests with UBSAN
run: CC=${{matrix.CC}} CFLAGS="-fsanitize=undefined ${{matrix.USE_STATIC_HEAP}}" ${{matrix.PYTHON}} compiler_tests.py
- name: Run compiler tests with Valgrind
run: CC=${{matrix.CC}} CFLAGS="${{matrix.USE_STATIC_HEAP}}" USE_VALGRIND=1 ${{matrix.PYTHON}} compiler_tests.py
run_unit_tests:
needs: [run_interpreter_unit_tests, run_compiler_unit_tests]
# Fake, unnecessary
runs-on: ubuntu-latest
# Fake, unnecessary
steps:
- uses: actions/checkout@v4
build_docker_image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: main
deploy:
runs-on: ubuntu-latest
if: |
github.repository == 'tekknolagi/scrapscript' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
needs: [run_lint, run_unit_tests]
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}