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: Install uv uses: astral-sh/setup-uv@v5 - name: Install Python run: uv python install 3.10 - run: uv sync --only-dev - run: uv run ruff check scrapscript.py - run: uv run ruff format --check scrapscript.py - run: uv run mypy --strict scrapscript.py run_interpreter_unit_tests: strategy: matrix: PYTHON: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v5 - name: Install Python run: uv python install ${{matrix.PYTHON}} - name: Pin Python run: uv python pin ${{matrix.PYTHON}} - name: Run interpreter tests run: uv run python scrapscript_tests.py run_compiler_unit_tests: strategy: matrix: PYTHON: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] CC: [gcc, clang, tcc] USE_STATIC_HEAP: ["-DSTATIC_HEAP", ""] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v5 - name: Update local package lists run: sudo apt update - name: Install Python run: uv python install ${{matrix.PYTHON}} - name: Pin Python run: uv python pin ${{matrix.PYTHON}} - name: Install other deps run: sudo apt install --yes ${{matrix.CC}} valgrind - name: Run compiler tests run: CC=${{matrix.CC}} CFLAGS="${{matrix.USE_STATIC_HEAP}}" uv run python compiler_tests.py - name: Run compiler tests -DNDEBUG run: CC=${{matrix.CC}} CFLAGS="${{matrix.USE_STATIC_HEAP}} -DNDEBUG" uv run python compiler_tests.py - name: Run compiler tests with ASAN run: CC=${{matrix.CC}} CFLAGS="-fsanitize=address ${{matrix.USE_STATIC_HEAP}}" uv run python compiler_tests.py - name: Run compiler tests with UBSAN run: CC=${{matrix.CC}} CFLAGS="-fsanitize=undefined ${{matrix.USE_STATIC_HEAP}}" uv run python compiler_tests.py - name: Run compiler tests with Valgrind run: CC=${{matrix.CC}} CFLAGS="${{matrix.USE_STATIC_HEAP}}" USE_VALGRIND=1 uv run 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 file: util/Dockerfile 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 }}