diff --git a/.github/workflows/haskell-ci-simple.yml b/.github/workflows/ci.yml similarity index 77% rename from .github/workflows/haskell-ci-simple.yml rename to .github/workflows/ci.yml index 8b8a811..c11f3e6 100644 --- a/.github/workflows/haskell-ci-simple.yml +++ b/.github/workflows/ci.yml @@ -21,29 +21,29 @@ jobs: os: [ubuntu-latest] ghc: - "8.0.2" - # Andreas, 2023-06-20, reduce CI load, keep only extremal GHC versions - # - "8.2.2" - # - "8.4.4" - # - "8.6.5" - # - "8.8.4" - # - "8.10.7" - # - "9.0.2" - # - "9.2.8" - # - "9.4.8" + - "8.2.2" + - "8.4.4" + - "8.6.5" + - "8.8.4" + - "8.10.7" + - "9.0.2" + - "9.2.8" + - "9.4.8" - "9.6.6" - "9.8.2" - "9.10.1" + - "9.12.1" include: - - ghc: "9.10.1" + - ghc: "9.12.1" os: macos-latest - - ghc: "9.10.1" + - ghc: "9.12.1" os: windows-latest steps: - uses: actions/checkout@v4 - uses: haskell-actions/setup@v2 - id: setup-haskell-cabal + id: setup with: ghc-version: ${{ matrix.ghc }} cabal-version: "latest" @@ -53,7 +53,7 @@ jobs: name: Cache cabal stuff with: path: | - ${{ steps.setup-haskell-cabal.outputs.cabal-store }} + ${{ steps.setup.outputs.cabal-store }} dist-newstyle key: ${{ runner.os }}-${{ matrix.ghc }} @@ -85,6 +85,13 @@ jobs: export ALEX cabal run --enable-tests alex:test:tests + - name: Test (with debugging) + run: | + cd alex-*/ + ALEX="$(cabal list-bin alex)" + export ALEX + cabal run --enable-tests alex:test:tests-debug + - name: Haddock run: | cd alex-*/ diff --git a/.github/workflows/emulated.yml b/.github/workflows/emulated.yml index 621b1e9..214e89f 100644 --- a/.github/workflows/emulated.yml +++ b/.github/workflows/emulated.yml @@ -1,7 +1,11 @@ name: emulated on: - - push - - pull_request + push: + branches: + - master + pull_request: + branches: + - master defaults: run: @@ -20,12 +24,12 @@ jobs: matrix: arch: ['s390x', 'ppc64le'] steps: - - uses: actions/checkout@v3 - - uses: uraimo/run-on-arch-action@v2.7.2 + - uses: actions/checkout@v4 + - uses: uraimo/run-on-arch-action@v2 timeout-minutes: 60 with: arch: ${{ matrix.arch }} - distro: ubuntu_rolling + distro: ubuntu_latest githubToken: ${{ github.token }} install: | apt-get update -y diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml deleted file mode 100644 index b71f3ff..0000000 --- a/.github/workflows/haskell-ci.yml +++ /dev/null @@ -1,269 +0,0 @@ -# This GitHub workflow config has been generated by a script via -# -# haskell-ci 'github' 'alex.cabal' -# -# To regenerate the script (for example after adjusting tested-with) run -# -# haskell-ci regenerate -# -# For more information, see https://github.com/andreasabel/haskell-ci -# -# version: 0.19.20240703 -# -# REGENDATA ("0.19.20240703",["github","alex.cabal"]) -# -name: Haskell-CI -on: - push: - branches: - - master - pull_request: - branches: - - master -jobs: - linux: - name: Haskell-CI - Linux - ${{ matrix.compiler }} - runs-on: ubuntu-20.04 - timeout-minutes: - 60 - container: - image: buildpack-deps:jammy - continue-on-error: ${{ matrix.allow-failure }} - strategy: - matrix: - include: - - compiler: ghc-9.10.1 - compilerKind: ghc - compilerVersion: 9.10.1 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.8.2 - compilerKind: ghc - compilerVersion: 9.8.2 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.6.6 - compilerKind: ghc - compilerVersion: 9.6.6 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.4.8 - compilerKind: ghc - compilerVersion: 9.4.8 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.2.8 - compilerKind: ghc - compilerVersion: 9.2.8 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.0.2 - compilerKind: ghc - compilerVersion: 9.0.2 - setup-method: ghcup - allow-failure: false - - compiler: ghc-8.10.7 - compilerKind: ghc - compilerVersion: 8.10.7 - setup-method: ghcup - allow-failure: false - - compiler: ghc-8.8.4 - compilerKind: ghc - compilerVersion: 8.8.4 - setup-method: ghcup - allow-failure: false - - compiler: ghc-8.6.5 - compilerKind: ghc - compilerVersion: 8.6.5 - setup-method: ghcup - allow-failure: false - - compiler: ghc-8.4.4 - compilerKind: ghc - compilerVersion: 8.4.4 - setup-method: ghcup - allow-failure: false - - compiler: ghc-8.2.2 - compilerKind: ghc - compilerVersion: 8.2.2 - setup-method: ghcup - allow-failure: false - - compiler: ghc-8.0.2 - compilerKind: ghc - compilerVersion: 8.0.2 - setup-method: ghcup - allow-failure: false - fail-fast: false - steps: - - name: apt - run: | - apt-get update - apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev - mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" - chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - "$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - env: - HCKIND: ${{ matrix.compilerKind }} - HCNAME: ${{ matrix.compiler }} - HCVER: ${{ matrix.compilerVersion }} - - name: Set PATH and environment variables - run: | - echo "$HOME/.cabal/bin" >> $GITHUB_PATH - echo "LANG=C.UTF-8" >> "$GITHUB_ENV" - echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" - echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" - HCDIR=/opt/$HCKIND/$HCVER - HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") - HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') - HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') - echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" - echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" - HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') - echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" - echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" - echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - echo "HEADHACKAGE=false" >> "$GITHUB_ENV" - echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" - echo "GHCJSARITH=0" >> "$GITHUB_ENV" - env: - HCKIND: ${{ matrix.compilerKind }} - HCNAME: ${{ matrix.compiler }} - HCVER: ${{ matrix.compilerVersion }} - - name: env - run: | - env - - name: write cabal config - run: | - mkdir -p $CABAL_DIR - cat >> $CABAL_CONFIG <> $CABAL_CONFIG < cabal-plan.xz - echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c - - xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan - rm -f cabal-plan.xz - chmod a+x $HOME/.cabal/bin/cabal-plan - cabal-plan --version - - - name: install alex and happy - run: | - $CABAL v2-install $ARG_COMPILER alex happy - - - name: checkout - uses: actions/checkout@v4 - with: - path: source - - - name: generate Parser.hs and Scan.hs - run: | - happy -agc $GITHUB_WORKSPACE/source/src/Parser.y -o $GITHUB_WORKSPACE/source/src/Parser.hs - alex -g $GITHUB_WORKSPACE/source/src/Scan.x -o $GITHUB_WORKSPACE/source/src/Scan.hs - mv $GITHUB_WORKSPACE/source/src/Parser.y $GITHUB_WORKSPACE/source/src/Parser.y.boot - mv $GITHUB_WORKSPACE/source/src/Scan.x $GITHUB_WORKSPACE/source/src/Scan.x.boot - - - name: initial cabal.project for sdist - run: | - touch cabal.project - echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project - cat cabal.project - - name: sdist - run: | - mkdir -p sdist - $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist - - name: unpack - run: | - mkdir -p unpacked - find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; - - name: generate cabal.project - run: | - PKGDIR_alex="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/alex-[0-9.]*')" - echo "PKGDIR_alex=${PKGDIR_alex}" >> "$GITHUB_ENV" - rm -f cabal.project cabal.project.local - touch cabal.project - touch cabal.project.local - echo "packages: ${PKGDIR_alex}" >> cabal.project - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package alex" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi - cat >> cabal.project <> cabal.project.local - cat cabal.project - cat cabal.project.local - - name: dump install plan - run: | - $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all - cabal-plan - - name: restore cache - uses: actions/cache/restore@v4 - with: - key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} - path: ~/.cabal/store - restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- - - name: install dependencies - run: | - $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all - $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all - - - name: build w/o tests and install - run: | - $CABAL v2-install --reinstall --overwrite-policy=always $ARG_COMPILER --disable-tests --disable-benchmarks all - - - name: build - run: | - $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always - - name: tests - run: | - # echo "ALEX=$HOME/.cabal/bin/alex" >> "$GITHUB_ENV" - export ALEX=$HOME/.cabal/bin/alex - export HC=$HC - $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct - - - name: cabal check - run: | - cd ${PKGDIR_alex} || false - ${CABAL} -vnormal check - - name: haddock - run: | - $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all - - name: unconstrained build - run: | - rm -f cabal.project.local - $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all - - name: save cache - uses: actions/cache/save@v4 - if: always() - with: - key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} - path: ~/.cabal/store diff --git a/alex.cabal b/alex.cabal index 0817545..b647a24 100644 --- a/alex.cabal +++ b/alex.cabal @@ -22,8 +22,9 @@ category: Development build-type: Simple tested-with: + GHC == 9.12.1 GHC == 9.10.1 - GHC == 9.8.2 + GHC == 9.8.4 GHC == 9.6.6 GHC == 9.4.8 GHC == 9.2.8 @@ -153,3 +154,15 @@ test-suite tests build-depends: base < 5 , process + +test-suite tests-debug + type: exitcode-stdio-1.0 + main-is: test-debug.hs + -- This line is important as it ensures that the local `exe:alex` component declared above is built before the test-suite component is invoked, as well as making sure that `alex` is made available on $PATH and `$alex_datadir` is set accordingly before invoking `test.hs` + build-tools: alex + + default-language: Haskell2010 + + build-depends: + base < 5 + , process diff --git a/cabal.haskell-ci b/cabal.haskell-ci deleted file mode 100644 index 5588907..0000000 --- a/cabal.haskell-ci +++ /dev/null @@ -1,5 +0,0 @@ -branches: master - --- -- For bootstrapping: --- apt: alex happy --- alex in the distribution might be too old. \ No newline at end of file diff --git a/test-debug.hs b/test-debug.hs new file mode 100644 index 0000000..f480453 --- /dev/null +++ b/test-debug.hs @@ -0,0 +1,4 @@ +import System.Process (system) +import System.Exit (exitWith) + +main = system "make -k -C tests clean tests-debug" >>= exitWith diff --git a/test.hs b/test.hs index e452a17..3cec1bf 100644 --- a/test.hs +++ b/test.hs @@ -1,4 +1,4 @@ import System.Process (system) import System.Exit (exitWith) -main = system "make -k -C tests clean all" >>= exitWith +main = system "make -k -C tests clean tests" >>= exitWith diff --git a/tests/Makefile b/tests/Makefile index 9d3466f..1eca78d 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -107,9 +107,13 @@ TEST_ALEX_OPTS= CLEAN_FILES += *.n.hs *.g.hs *.d.hs *.info *.hi *.o *.bin *.exe -ALL_TEST_HS = $(shell echo $(TESTS) $(TEXT_TESTS) | sed -e 's/\([^\. ]*\)\.\(l\)\{0,1\}x/\1.n.hs \1.g.hs \1.d.hs/g') +TESTS_HS = $(shell echo $(TESTS) $(TEXT_TESTS) | sed -e 's/\([^\. ]*\)\.\(l\)\{0,1\}x/\1.n.hs \1.g.hs/g') +TESTS_HS_DEBUG = $(shell echo $(TESTS) $(TEXT_TESTS) | sed -e 's/\([^\. ]*\)\.\(l\)\{0,1\}x/\1.d.hs/g') +TESTS_HS_ALL = $(TESTS_HS) $(TESTS_HS_DEBUG) -ALL_TESTS = $(patsubst %.hs, %.run, $(ALL_TEST_HS)) +BASIC_TESTS = $(patsubst %.hs, %.run, $(TESTS_HS)) +DEBUG_TESTS = $(patsubst %.hs, %.run, $(TESTS_HS_DEBUG)) +ALL_TESTS = $(BASIC_TESTS) $(DEBUG_TESTS) %.run : %$(HS_PROG_EXT) ./$< @@ -119,17 +123,15 @@ ALL_TESTS = $(patsubst %.hs, %.run, $(ALL_TEST_HS)) all :: $(ALL_TESTS) +tests :: $(BASIC_TESTS) + +tests-debug :: $(DEBUG_TESTS) + .PHONY: clean debug clean: rm -f $(CLEAN_FILES) -# NOTE: The `../dist` path belows don't aren't accurate anymore for recent cabals -interact: - ghci -cpp -i../src -i../dist/build/autogen -i../dist/build/alex/alex-tmp Main -fbreak-on-exception -# -args='--template=.. simple.x -o simple.n.hs' -# :set args --template=.. simple.x -o simple.n.hs - debug : @echo ALEX = $(ALEX) @echo HC_OPTS = $(HC_OPTS)