Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose cabal-install lib, remove dogfooding, expose cabal-install-solver as own lib, enable HPC coverage reporting. #7358

Merged
merged 4 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
- uses: actions/checkout@v2
- name: Package project
run: |
cabal v2-sdist --builddir=sdist Cabal cabal-install
python3.8 release.py --tarlib=sdist/sdist/Cabal-*.tar.gz --tarexe=sdist/sdist/cabal-install-*.tar.gz
cabal v2-sdist --builddir=sdist Cabal cabal-install-solver cabal-install
python3.8 release.py --tarlib=sdist/sdist/Cabal-*.tar.gz --tarsolver=sdist/sdist/cabal-install-solver-3.*.tar.gz --tarexe=sdist/sdist/cabal-install-3.*.tar.gz
- uses: actions/upload-artifact@v2
with:
name: cabal-linux
Expand Down Expand Up @@ -62,8 +62,8 @@ jobs:
- uses: actions/checkout@v2
- name: Package project
run: |
cabal v2-sdist --builddir=sdist Cabal cabal-install
python3 release.py --tarlib=sdist/sdist/Cabal-*.tar.gz --tarexe=sdist/sdist/cabal-install-*.tar.gz
cabal v2-sdist --builddir=sdist Cabal cabal-install-solver cabal-install
python3 release.py --tarlib=sdist/sdist/Cabal-*.tar.gz --tarsolver=sdist/sdist/cabal-install-solver-3.*.tar.gz --tarexe=sdist/sdist/cabal-install-3.*.tar.gz
- uses: actions/upload-artifact@v2
with:
name: cabal-macos
Expand Down Expand Up @@ -93,9 +93,9 @@ jobs:
- name: Package project
# We hardcode version 3 here to make first glob not overlap with cabal-install
run: |
cabal v2-sdist --builddir=sdist Cabal cabal-install
cabal v2-sdist --builddir=sdist Cabal cabal-install-solver cabal-install
New-Item -Path "_build" -ItemType "directory"
python release.py --tarlib=$(Resolve-Path -Path sdist/sdist/Cabal-3.*.tar.gz) --tarexe=$(Resolve-Path -Path sdist/sdist/cabal-install-3.*.tar.gz)
python release.py --tarlib=$(Resolve-Path -Path sdist/sdist/Cabal-3.*.tar.gz) --tarsolver=$(Resolve-Path -Path sdist/sdist/cabal-install-solver-3.*.tar.gz) --tarexe=$(Resolve-Path -Path sdist/sdist/cabal-install-3.*.tar.gz)
- uses: actions/upload-artifact@v2
with:
name: cabal-windows
Expand Down
42 changes: 10 additions & 32 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ jobs:
run: sh validate.sh -j 2 -w ghc-8.10.1 -v -s print-config
- name: Validate print-tool-versions
run: sh validate.sh -j 2 -w ghc-8.10.1 -v -s print-tool-versions
- name: Validate make-cabal-install-dev
run: sh validate.sh -j 2 -w ghc-8.10.1 -v -s make-cabal-install-dev
- name: Validate build
run: sh validate.sh -j 2 -w ghc-8.10.1 -v -s build
- name: Validate lib-tests
Expand Down Expand Up @@ -140,8 +138,6 @@ jobs:
run: sh validate.sh -j 2 -w ghc-8.8.3 -v --solver-benchmarks -s print-config
- name: Validate print-tool-versions
run: sh validate.sh -j 2 -w ghc-8.8.3 -v --solver-benchmarks -s print-tool-versions
- name: Validate make-cabal-install-dev
run: sh validate.sh -j 2 -w ghc-8.8.3 -v --solver-benchmarks -s make-cabal-install-dev
- name: Validate build
run: sh validate.sh -j 2 -w ghc-8.8.3 -v --solver-benchmarks -s build
- name: Validate lib-tests
Expand Down Expand Up @@ -188,8 +184,6 @@ jobs:
run: sh validate.sh -j 2 -w ghc-8.6.5 -v --complete-hackage-tests -s print-config
- name: Validate print-tool-versions
run: sh validate.sh -j 2 -w ghc-8.6.5 -v --complete-hackage-tests -s print-tool-versions
- name: Validate make-cabal-install-dev
run: sh validate.sh -j 2 -w ghc-8.6.5 -v --complete-hackage-tests -s make-cabal-install-dev
- name: Validate build
run: sh validate.sh -j 2 -w ghc-8.6.5 -v --complete-hackage-tests -s build
- name: Validate lib-tests
Expand Down Expand Up @@ -236,8 +230,6 @@ jobs:
run: sh validate.sh -j 2 -w ghc-8.4.4 -v -s print-config
- name: Validate print-tool-versions
run: sh validate.sh -j 2 -w ghc-8.4.4 -v -s print-tool-versions
- name: Validate make-cabal-install-dev
run: sh validate.sh -j 2 -w ghc-8.4.4 -v -s make-cabal-install-dev
- name: Validate build
run: sh validate.sh -j 2 -w ghc-8.4.4 -v -s build
- name: Validate lib-tests
Expand Down Expand Up @@ -284,8 +276,6 @@ jobs:
run: sh validate.sh -j 2 -w ghc-8.2.2 -v -s print-config
- name: Validate print-tool-versions
run: sh validate.sh -j 2 -w ghc-8.2.2 -v -s print-tool-versions
- name: Validate make-cabal-install-dev
run: sh validate.sh -j 2 -w ghc-8.2.2 -v -s make-cabal-install-dev
- name: Validate build
run: sh validate.sh -j 2 -w ghc-8.2.2 -v -s build
- name: Validate lib-tests
Expand Down Expand Up @@ -329,21 +319,15 @@ jobs:
git fetch origin $GITHUB_SHA:temporary-ci-branch
git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA)
- name: Validate print-config
run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s print-config
run: sh validate.sh -j 2 -w ghc-8.0.2 -v --lib-only -s print-config
- name: Validate print-tool-versions
run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s print-tool-versions
- name: Validate make-cabal-install-dev
run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s make-cabal-install-dev
run: sh validate.sh -j 2 -w ghc-8.0.2 -v --lib-only -s print-tool-versions
- name: Validate build
run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s build
run: sh validate.sh -j 2 -w ghc-8.0.2 -v --lib-only -s build
- name: Validate lib-tests
run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s lib-tests
run: sh validate.sh -j 2 -w ghc-8.0.2 -v --lib-only -s lib-tests
- name: Validate lib-suite
run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s lib-suite
- name: Validate cli-tests
run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s cli-tests
- name: Validate cli-suite
run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s cli-suite
run: sh validate.sh -j 2 -w ghc-8.0.2 -v --lib-only -s lib-suite
validate-7_10_3:
name: validate.sh ghc-7.10.3
runs-on: ubuntu-18.04
Expand Down Expand Up @@ -377,21 +361,15 @@ jobs:
git fetch origin $GITHUB_SHA:temporary-ci-branch
git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA)
- name: Validate print-config
run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s print-config
run: sh validate.sh -j 2 -w ghc-7.10.3 -v --lib-only -s print-config
- name: Validate print-tool-versions
run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s print-tool-versions
- name: Validate make-cabal-install-dev
run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s make-cabal-install-dev
run: sh validate.sh -j 2 -w ghc-7.10.3 -v --lib-only -s print-tool-versions
- name: Validate build
run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s build
run: sh validate.sh -j 2 -w ghc-7.10.3 -v --lib-only -s build
- name: Validate lib-tests
run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s lib-tests
run: sh validate.sh -j 2 -w ghc-7.10.3 -v --lib-only -s lib-tests
- name: Validate lib-suite
run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s lib-suite
- name: Validate cli-tests
run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s cli-tests
- name: Validate cli-suite
run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s cli-suite
run: sh validate.sh -j 2 -w ghc-7.10.3 -v --lib-only -s lib-suite
validate-7_8_4:
name: validate.sh ghc-7.8.4
runs-on: ubuntu-18.04
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ jobs:
run: sh validate.sh -j 2 -w ghc-8.8.3 -v -s print-config
- name: Validate print-tool-versions
run: sh validate.sh -j 2 -w ghc-8.8.3 -v -s print-tool-versions
- name: Validate make-cabal-install-dev
run: sh validate.sh -j 2 -w ghc-8.8.3 -v -s make-cabal-install-dev
- name: Validate build
run: sh validate.sh -j 2 -w ghc-8.8.3 -v -s build
- name: Validate lib-tests
Expand Down Expand Up @@ -112,8 +110,6 @@ jobs:
run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s print-config
- name: Validate print-tool-versions
run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s print-tool-versions
- name: Validate make-cabal-install-dev
run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s make-cabal-install-dev
- name: Validate build
run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s build
- name: Validate lib-tests
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/quick-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:
make -B spdx
make -B templates
make -B github-actions
make -B cabal-install-cabal
- name: Check that diff is clean
run: |
git status > /dev/null
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ jobs:
- name: Update Hackage index
run: cabal v2-update
- uses: actions/checkout@v2
- name: make cabal-install-dev
run: cp cabal-install/cabal-install.cabal.dev cabal-install/cabal-install.cabal
# We cannot ask for all dependencies, but we can for Cabal.
- name: cabal v2-build Cabal --only-dependencies
run: cabal v2-build Cabal --only-dependencies
Expand All @@ -51,10 +49,10 @@ jobs:
run: |
cd cabal-install
cabal v2-run cabal-install:memory-usage-tests
- name: cabal-install solver-quickcheck
- name: cabal-install long-tests
run: |
cd cabal-install
cabal v2-run cabal-install:solver-quickcheck
cabal v2-run cabal-install:long-tests -- --pattern "! (/FileMonitor/ || /VCS/ || /Get/)"
- name: cabal-install integration-tests2
run: |
cd cabal-install
Expand Down Expand Up @@ -87,8 +85,6 @@ jobs:
- name: Update Hackage index
run: cabal v2-update
- uses: actions/checkout@v2
- name: make cabal-install-dev
run: cp cabal-install/cabal-install.cabal.dev cabal-install/cabal-install.cabal
# We cannot ask for all dependencies, but we can for Cabal.
- name: cabal v2-build Cabal --only-dependencies
run: cabal v2-build Cabal --only-dependencies
Expand All @@ -101,10 +97,10 @@ jobs:
run: |
cd cabal-install
cabal v2-run cabal-install:memory-usage-tests
- name: cabal-install solver-quickcheck
- name: cabal-install long-tests
run: |
cd cabal-install
cabal v2-run cabal-install:solver-quickcheck
cabal v2-run cabal-install:long-tests -- --pattern "! (/FileMonitor/ || /VCS/ || /Get/)"
- name: cabal-install integration-tests2
run: |
cd cabal-install
Expand Down
61 changes: 12 additions & 49 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,54 +26,23 @@ cabal v2-build Cabal:unit-tests # build Cabal's unit test suite
cabal v2-build cabal-tests # etc...
~~~~

**Dogfooding HEAD.**
emilypi marked this conversation as resolved.
Show resolved Hide resolved
Many of the core developers of Cabal dogfood `cabal-install` HEAD
when doing development on Cabal. This helps us identify bugs
which were missed by the test suite and easily experiment with new
features.

The recommended workflow in this case is slightly different: you will
maintain two Cabal source trees: your production tree (built with a
released version of Cabal) which always tracks `master` and which you
update only when you want to move to a new version of Cabal to dogfood,
and your development tree (built with your production Cabal) that you
actually do development on.

In more detail, suppose you have checkouts of Cabal at `~/cabal-prod`
and `~/cabal-dev`, and you have a release copy of cabal installed at
`/opt/cabal/2.4/bin/cabal`. First, build your production tree:

~~~~
cd ~/cabal-prod
/opt/cabal/2.4/bin/cabal v2-build cabal
~~~~

This will produce a cabal binary (see also: [Where are my build products?](http://cabal.readthedocs.io/en/latest/nix-local-build.html#where-are-my-build-products)
). Add this binary to your PATH,
and then use it to build your development copy:

~~~~
cd ~/cabal-dev
cabal v2-build cabal
~~~~

Running tests
-------------

**Using Travis and AppVeyor.**
**Using Github Actions and AppVeyor.**
If you are not in a hurry, the most convenient way to run tests on Cabal
is to make a branch on GitHub and then open a pull request; our
continuous integration service on Travis and AppVeyor will build and
continuous integration service on Github Actions and AppVeyor will build and
test your code. Title your PR with WIP so we know that it does not need
code review.

Some tips for using Travis effectively:
Some tips for using Github Actions effectively:

* Travis builds take a long time. Use them when you are pretty
* Github Actions builds take a long time. Use them when you are pretty
sure everything is OK; otherwise, try to run relevant tests locally
first.

* Watch over your jobs on the [Travis website](http://travis-ci.org).
* Watch over your jobs on the [Github Actions website](http://github.org/haskell/cabal/actions).
If you know a build of yours is going to fail (because one job has
already failed), be nice to others and cancel the rest of the jobs,
so that other commits on the build queue can be processed.
Expand All @@ -97,10 +66,9 @@ failures:
a specific operating system? If so, try reproducing the
problem on the specific configuration.

4. Is the test failing on a Travis per-GHC build
([for example](https://travis-ci.org/haskell-pushbot/cabal-binaries/builds/208128401))?
4. Is the test failing on a Github Actions per-GHC build.
In this case, if you click on "Branch", you can get access to
the precise binaries that were built by Travis that are being
the precise binaries that were built by Github Actions that are being
tested. If you have an Ubuntu system, you can download
the binaries and run them directly.

Expand Down Expand Up @@ -137,21 +105,16 @@ There are also other test suites:
on some utility functions in cabal-install you should run this test
suite.

* `cabal-install:solver-quickcheck` are QuickCheck tests on
cabal-install's dependency solver. If you are working
on the solver you should run this test suite.
* `cabal-install:long-tests` are QuickCheck tests on
cabal-install's dependency solver, VCS, and file monitoring code.
If you are working on the solver you should run this test suite.

* `cabal-install:integration-tests2` are integration tests on some
top-level API functions inside the `cabal-install` source code.

For these test executables, `-p` which applies a regex filter to the test
names.

**Testing `cabal-install` Locally**
emilypi marked this conversation as resolved.
Show resolved Hide resolved

If you are testing `cabal-install` locally, you may refer to its [TESTING.md](cabal-install/TESTING.md) for
instructions on how to use the `Makefile` to produce the appropriate `.cabal` file
with test targets. From there, you may add tests in the usual way.
names. When running `cabal-install` test suites, one need only use `cabal test` or
`cabal run <test-target>` in order to test locally.


Conventions
Expand Down
35 changes: 8 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.PHONY : all lexer sdpx lib exe doctest
.PHONY : cabal-install-dev cabal-install-prod
.PHONY : phony

CABALBUILD := cabal v2-build
Expand Down Expand Up @@ -67,24 +66,6 @@ buildinfo-fields-reference : phony
cabal build --builddir=dist-newstyle-bi --project-file=cabal.project.buildinfo buildinfo-reference-generator
$$(cabal-plan list-bin --builddir=dist-newstyle-bi buildinfo-reference-generator) buildinfo-reference-generator/template.zinza | tee $@

# cabal-install.cabal file generation

cabal-install-cabal : phony cabal-install/cabal-install.cabal.dev cabal-install/cabal-install.cabal.prod

cabal-install/cabal-install.cabal.dev : cabal-install/cabal-install.cabal.zinza
cabal v2-run --builddir=dist-newstyle-meta --project-file=cabal.project.meta gen-cabal-install-cabal -- True cabal-install/cabal-install.cabal.zinza cabal-install/cabal-install.cabal.dev

cabal-install/cabal-install.cabal.prod : cabal-install/cabal-install.cabal.zinza
cabal v2-run --builddir=dist-newstyle-meta --project-file=cabal.project.meta gen-cabal-install-cabal -- False cabal-install/cabal-install.cabal.zinza cabal-install/cabal-install.cabal.prod

cabal-install-prod : cabal-install/cabal-install.cabal.prod
cp cabal-install/cabal-install.cabal.prod cabal-install/cabal-install.cabal

cabal-install-dev : cabal-install/cabal-install.cabal.dev
cp cabal-install/cabal-install.cabal.dev cabal-install/cabal-install.cabal
@echo "tell git to ignore changes to cabal-install.cabal:"
@echo "git update-index --assume-unchanged cabal-install/cabal-install.cabal"

# analyse-imports
analyse-imports : phony
find Cabal/src cabal-install/src -type f -name '*.hs' | xargs cabal v2-run --builddir=dist-newstyle-meta --project-file=cabal.project.meta analyse-imports --
Expand Down Expand Up @@ -115,7 +96,7 @@ doctest :

# This is not run as part of validate.sh (we need hackage-security, which is tricky to get).
doctest-cli :
doctest -D__DOCTEST__ --fast cabal-install/src cabal-install/cabal-install-solver/src cabal-install/cabal-install-solver/src-assertion
doctest -D__DOCTEST__ --fast cabal-install/src cabal-install-solver/src cabal-install-solver/src-assertion

# tests

Expand Down Expand Up @@ -237,17 +218,17 @@ bootstrap-plans-linux: phony
@if [ $$(uname) != "Linux" ]; then echo "Not Linux"; false; fi
cabal v2-build --project=cabal.project.release --with-compiler ghc-8.6.5 --dry-run cabal-install:exe:cabal
cp dist-newstyle/cache/plan.json bootstrap/linux-8.6.5.plan.json
cabal v2-build --project=cabal.project.release --with-compiler ghc-8.8.3 --dry-run cabal-install:exe:cabal
cp dist-newstyle/cache/plan.json bootstrap/linux-8.8.3.plan.json
cabal v2-build --project=cabal.project.release --with-compiler ghc-8.10.1 --dry-run cabal-install:exe:cabal
cp dist-newstyle/cache/plan.json bootstrap/linux-8.10.1.plan.json
cabal v2-build --project=cabal.project.release --with-compiler ghc-8.8.4 --dry-run cabal-install:exe:cabal
cp dist-newstyle/cache/plan.json bootstrap/linux-8.8.4.plan.json
cabal v2-build --project=cabal.project.release --with-compiler ghc-8.10.4 --dry-run cabal-install:exe:cabal
cp dist-newstyle/cache/plan.json bootstrap/linux-8.10.4.plan.json

bootstrap-jsons-linux: phony
@if [ $$(uname) != "Linux" ]; then echo "Not Linux"; false; fi
cabal v2-build --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen
cabal v2-run -vnormal+stderr --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen -- bootstrap/linux-8.6.5.plan.json | python -m json.tool | tee bootstrap/linux-8.6.5.json
cabal v2-run -vnormal+stderr --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen -- bootstrap/linux-8.8.3.plan.json | python -m json.tool | tee bootstrap/linux-8.8.3.json
cabal v2-run -vnormal+stderr --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen -- bootstrap/linux-8.10.1.plan.json | python -m json.tool | tee bootstrap/linux-8.10.1.json
cabal v2-run -vnormal+stderr --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen -- bootstrap/linux-8.6.5.plan.json | python3 -m json.tool | tee bootstrap/linux-8.6.5.json
cabal v2-run -vnormal+stderr --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen -- bootstrap/linux-8.8.4.plan.json | python3 -m json.tool | tee bootstrap/linux-8.8.4.json
cabal v2-run -vnormal+stderr --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen -- bootstrap/linux-8.10.4.plan.json | python3 -m json.tool | tee bootstrap/linux-8.10.4.json

# documentation
##############################################################################
Expand Down
3 changes: 1 addition & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ cache:
- "C:\\sr"

build_script:
- cp cabal-install/cabal-install.cabal.dev cabal-install/cabal-install.cabal
- cabal %CABOPTS% v2-configure --enable-tests
- appveyor-retry cabal %CABOPTS% v2-build lib:Cabal --only-dependencies
- cabal %CABOPTS% v2-build lib:Cabal
Expand All @@ -59,6 +58,6 @@ build_script:
- appveyor-retry cabal %CABOPTS% v2-build cabal-install:tests --only-dependencies
- cd cabal-install
- cabal %CABOPTS% v2-run cabal-install:memory-usage-tests
- cabal %CABOPTS% v2-run cabal-install:solver-quickcheck
- cabal %CABOPTS% v2-run cabal-install:long-tests -- --pattern "! (/FileMonitor/ || /VCS/ || /Get/)"
- cabal %CABOPTS% v2-run cabal-install:integration-tests2
- cabal %CABOPTS% v2-run cabal-install:unit-tests -- --pattern "! (/FileMonitor/ || /VCS/ || /Get/)"
Loading