Skip to content

Commit

Permalink
Sync CI configuration with master
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabedini committed Nov 22, 2023
1 parent 6f2b3b3 commit a19f942
Show file tree
Hide file tree
Showing 18 changed files with 953 additions and 87 deletions.
7 changes: 3 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
labels: ["type: bug", "needs triage"]
assignees: ''

---
Expand All @@ -14,11 +14,9 @@ A clear and concise description of what the bug is.
Steps to reproduce the behavior:

```
$ cabal v2-build ...
$ cabal build ...
```

Please use version-prefixed commands (e.g. `v2-build` or `v1-build`) to avoid ambiguity.

**Expected behavior**
A clear and concise description of what you expected to happen.

Expand All @@ -28,3 +26,4 @@ A clear and concise description of what you expected to happen.

**Additional context**
Add any other context about the problem here.

15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Documentation
about: Report missing, stale, or inaccurate documentation
title: ''
labels: ["documentation"]
assignees: ''

---

**What is wrong with the docs?**
Describe what you were searching. Was documentation not there? Was it outdated? Was it not clear?

**Additional context**
Add any other relevant context here.

15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Feature request
about: Suggest a new feature
title: ''
labels: ["type: enhancement"]
assignees: ''

---

**Describe the feature request**
A simple description of what you would like to be added to Cabal.

**Additional context**
What made you ask for this functionality? How would the feature benefit you and other users? Add any other relevant context about the request here.

23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/user_question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Question
about: Ask a question to the developers
title: ''
labels: ["type: user-question"]
assignees: ''

---

Two great places to ask questions are [Haskell Matrix](https://matrix.to/#/#haskell:matrix.org) (online chat) and [Haskell Discourse](https://discourse.haskell.org). There are many experienced programmers there who can quickly help you with using Cabal and `cabal-install`.

If you did not find an answer to your question, fill in this template.

**What is your question?**
State your question in simple terms. What were you attempting to do? What have you have tried?

**System information**
- Operating system
- `cabal`, `ghc` versions

**Additional context**
Add any other relevant context here.

15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# From:
# - https://github.com/haskell/hackage-server
# - https://github.com/rhysd/actionlint/issues/228#issuecomment-1272493095
# - https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot

# Set update schedule for GitHub Actions

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
85 changes: 85 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
pull_request_rules:

# implementing PR delay logic: apply a label after 2 days of inactivity
# the label will allow Mergify to merge (see #8442, #8448)
- actions:
label:
add:
- merge delay passed
name: Wait for 2 days before validating merge
conditions:
- updated-at<2 days ago
- or:
- label=merge me
- label=squash+merge me
- label=merge+no rebase
- '#approved-reviews-by>=2'

# rebase+merge strategy
- actions:
queue:
name: default
# Merge into master with a merge commit
method: merge
# Update the pr branch with rebase, so the history is clean
update_method: rebase
name: Put pull requests in the rebase+merge queue
conditions:
- base=master
- label=merge me
- label=merge delay passed
- '#approved-reviews-by>=2'

# merge+squash strategy
- actions:
queue:
name: default
method: squash
# both update methods get absorbed by the squash, so we use the most
# reliable
update_method: merge
name: Put pull requests in the squash+merge queue
conditions:
- base=master
- label=squash+merge me
- label=merge delay passed
- '#approved-reviews-by>=2'

# merge+no rebase strategy
- actions:
merge:
method: merge
name: Merge "merge+no rebase" pull requests directly (without a queue)
conditions:
- base=master
- label=merge+no rebase
- label=merge delay passed
- '#approved-reviews-by>=2'

# rebase+merge strategy for backports: require 1 approver instead of 2
- actions:
queue:
name: default
# Merge with a merge commit
method: merge
# Update the pr branch with rebase, so the history is clean
update_method: rebase
name: Put backports in the rebase+merge queue
conditions:
- label=merge me
- base!=master
- body~=backport
- '#approved-reviews-by>=1'

# backports should be labeled as such
- actions:
label:
add:
- backport
name: Label backports as such
conditions:
- body~=automatic backport

queue_rules:
- name: default
update_bot_account: Mikolaj
22 changes: 22 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Please read [Github PR Conventions](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#github-pull-request-conventions) and then fill in *one* of these two templates.

---

**Template Α: This PR modifies `cabal` behaviour**

Include the following checklist in your PR:

* [ ] Patches conform to the [coding conventions](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#other-conventions).
* [ ] Any changes that could be relevant to users [have been recorded in the changelog](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#changelog).
* [ ] The documentation has been updated, if necessary.
* [ ] [Manual QA notes](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#qa-notes) have been included.
* [ ] Tests have been added. (*Ask for help if you don’t know how to write them! Ask for an exemption if tests are too complex for too little coverage!*)

---

**Template Β: This PR does not modify `cabal` behaviour (documentation, tests, refactoring, etc.)**

Include the following checklist in your PR:

* [ ] Patches conform to the [coding conventions](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#other-conventions).

39 changes: 39 additions & 0 deletions .github/workflows/bootstrap.skip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Bootstrap Skip

# This Workflow is special and contains a workaround for a known limitation of GitHub CI.
#
# The problem: We don't want to run the "bootstrap" jobs on PRs which contain only changes
# to the docs, since these jobs take a long time to complete without providing any benefit.
# We therefore use path-filtering in the workflow triggers for the bootstrap jobs, namely
# "paths-ignore: doc/**". But the "Bootstrap post job" is a required job, therefore a PR cannot
# be merged unless the "Bootstrap post job" completes succesfully, which it doesn't do if we
# filter it out.
#
# The solution: We use a second job with the same name which always returns the exit code 0.
# The logic implemented for "required" workflows accepts if 1) at least one job with that name
# runs through, AND 2) If multiple jobs of that name exist, then all jobs of that name have to
# finish successfully.
on:
push:
paths:
- 'doc/**'
- '**/README.md'
- 'CONTRIBUTING.md'
branches:
- master
pull_request:
paths:
- 'doc/**'
- '**/README.md'
- 'CONTRIBUTING.md'
release:
types:
- created

jobs:
bootstrap-post-job:
if: always()
name: Bootstrap post job
runs-on: ubuntu-latest
steps:
- run: exit 0
112 changes: 71 additions & 41 deletions .github/workflows/bootstrap.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,96 @@
# This file is auto-generated
#
# To regenerate it run
#
# make github-actions
#
name: Bootstrap

# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency.
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

# Note: This workflow file contains the required job "Bootstrap post job". We are using path filtering
# here to ignore PRs which only change documentation. This can cause a problem, see the workflow file
# "bootstrap.skip.yml" for a description of the problem and the solution provided in that file.
on:
push:
paths-ignore:
- 'doc/**'
- '**/README.md'
- 'CONTRIBUTING.md'
branches:
- master
pull_request:
paths-ignore:
- 'doc/**'
- '**/README.md'
- 'CONTRIBUTING.md'
release:
types:
- created

jobs:
boostrap-linux:
name: Bootstrap on Linux
runs-on: ubuntu-18.04
bootstrap:
strategy:
matrix:
os: [ubuntu-latest]
ghc: ["8.10.7", "9.0.2", "9.2.7", "9.4.4"]
include:
- os: macos-latest
ghc: "9.2.7"
name: Bootstrap ${{ matrix.os }} ghc-${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: bootstrap.py
run: |
ghcup config set cache true
ghcup install ghc 8.10.7
python3 bootstrap/bootstrap.py -w $(ghcup whereis ghc 8.10.7) -d bootstrap/linux-8.10.7.json
- name: Smoke test
run: |
_build/bin/cabal --version
- uses: actions/upload-artifact@v2
- uses: actions/cache@v3
name: Cache the downloads
id: bootstrap-cache
with:
name: cabal-linux-bootstrapped
path: _build/artifacts/*
path: "/home/runner/work/cabal/cabal/_build"
key: bootstrap-${{ runner.os }}-${{ matrix.ghc }}-20221115-${{ github.sha }}
restore-keys: bootstrap-${{ runner.os }}-${{ matrix.ghc }}-20221115-

boostrap-macos:
name: Bootstrap on macOS
runs-on: macos-latest
steps:
- name: Install GHC
- uses: actions/checkout@v4
# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
run: |
cd $(mktemp -d)
curl -sLO "https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-apple-darwin.tar.xz"
tar -xJf ghc-*.tar.xz
cd ghc-*
./configure --prefix=/opt/ghc/8.10.7
sudo make install
- uses: actions/checkout@v2

# We use linux dependencies
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo ls -lah /usr/local/.ghcup/cache
sudo mkdir -p /usr/local/.ghcup/cache
sudo ls -lah /usr/local/.ghcup/cache
sudo chown -R $USER /usr/local/.ghcup
sudo chmod -R 777 /usr/local/.ghcup
fi
- name: bootstrap.py
run: |
GHC_VERSION=${{ matrix.ghc }}
ghcup --version
ghcup config set cache true
ghcup install ghc 8.10.7
python3 bootstrap/bootstrap.py -w $(ghcup whereis ghc 8.10.7) -d bootstrap/linux-8.10.7.json
ghcup install ghc $GHC_VERSION
# Fetch the bootstrap sources (we use linux dependencies also on macos)
python3 bootstrap/bootstrap.py -w $(ghcup whereis ghc $GHC_VERSION) -d bootstrap/linux-$GHC_VERSION.json fetch
# Bootstrap using the bootstrap sources
python3 bootstrap/bootstrap.py -w $(ghcup whereis ghc $GHC_VERSION) --bootstrap-sources bootstrap-sources.tar.gz
- name: Smoke test
run: |
_build/bin/cabal --version
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cabal-macos-bootstrapped
name: cabal-${{ matrix.os }}-${{ matrix.ghc }}-bootstrapped
path: _build/artifacts/*

# We use this job as a summary of the workflow
# It will fail if any of the previous jobs does it
# This way we can use it exclusively in branch protection rules
# and abstract away the concrete jobs of the workflow, including their names
bootstrap-post-job:
if: always()
name: Bootstrap post job
runs-on: ubuntu-latest
# IMPORTANT! Any job added to the workflow should be added here too
needs: [bootstrap]

steps:
- run: |
echo "jobs info: ${{ toJSON(needs) }}"
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
Loading

0 comments on commit a19f942

Please sign in to comment.