-
Notifications
You must be signed in to change notification settings - Fork 719
Rewrite release CI #11072
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
Merged
Merged
Rewrite release CI #11072
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: 'Download artifact' | ||
description: 'Download artifacts with normalized names' | ||
inputs: | ||
name: | ||
required: true | ||
type: string | ||
path: | ||
required: true | ||
type: string | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Normalise name | ||
run: | | ||
name=${{ inputs.name }} | ||
echo "NAME=${name//\//_}" >> "$GITHUB_ENV" | ||
shell: bash | ||
|
||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ env.NAME }} | ||
path: ${{ inputs.path }} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: 'Upload artifact' | ||
description: 'Upload artifacts with normalized names' | ||
inputs: | ||
if-no-files-found: | ||
default: 'error' | ||
type: string | ||
name: | ||
required: true | ||
type: string | ||
path: | ||
required: true | ||
type: string | ||
retention-days: | ||
default: 0 | ||
type: number | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Normalise name | ||
run: | | ||
name=${{ inputs.name }} | ||
echo "NAME=${name//\//_}" >> "$GITHUB_ENV" | ||
shell: bash | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
if-no-files-found: ${{ inputs.if-no-files-found }} | ||
retention-days: ${{ inputs.retention-days }} | ||
name: ${{ env.NAME }} | ||
path: ${{ inputs.path }} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
set -eux | ||
|
||
uname -a | ||
uname -p | ||
uname | ||
pwd | ||
env | ||
|
||
if [ "${RUNNER_OS}" = Windows ] ; then | ||
ext=".exe" | ||
else | ||
ext="" | ||
fi | ||
|
||
ghcup --no-verbose install ghc --set --install-targets "${GHC_TARGETS}" "${GHC_VERSION}" | ||
|
||
cabal update | ||
cabal user-config diff | ||
cabal user-config init -f | ||
"ghc-${GHC_VERSION}" --info | ||
"ghc" --info | ||
|
||
# shellcheck disable=SC2206 | ||
args=( | ||
-w "ghc-$GHC_VERSION" | ||
--disable-profiling | ||
--enable-executable-stripping | ||
--project-file=cabal.release.project | ||
${ADD_CABAL_ARGS} | ||
) | ||
|
||
cabal v2-build "${args[@]}" cabal-install | ||
|
||
mkdir -p "out" | ||
# shellcheck disable=SC2154 | ||
cp "$(cabal list-bin "${args[@]}" cabal-install:exe:cabal)" "out/cabal$ext" | ||
cp dist-newstyle/cache/plan.json "out/plan.json" | ||
cd "out/" | ||
|
||
# create tarball/zip | ||
TARBALL_PREFIX="cabal-install-$("./cabal" --numeric-version)" | ||
case "${TARBALL_EXT}" in | ||
zip) | ||
zip "${TARBALL_PREFIX}-${ARTIFACT}.${TARBALL_EXT}" "cabal${ext}" plan.json | ||
;; | ||
tar.xz) | ||
tar caf "${TARBALL_PREFIX}-${ARTIFACT}.${TARBALL_EXT}" "cabal${ext}" plan.json | ||
;; | ||
*) | ||
fail "Unknown TARBALL_EXT: ${TARBALL_EXT}" | ||
;; | ||
esac | ||
|
||
rm "cabal${ext}" plan.json | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
set -eux | ||
|
||
env | ||
pwd | ||
ls -lah | ||
|
||
cd out | ||
case "${TARBALL_EXT}" in | ||
zip) | ||
unzip ./cabal-install-*-"${ARTIFACT}.${TARBALL_EXT}" | ||
;; | ||
tar.xz) | ||
tar xf ./cabal-install-*-"${ARTIFACT}.${TARBALL_EXT}" | ||
;; | ||
*) | ||
fail "Unknown TARBALL_EXT: ${TARBALL_EXT}" | ||
;; | ||
esac | ||
cd .. | ||
|
||
ghcup --no-verbose install ghc --set --install-targets "${GHC_TEST_TARGETS}" "${GHC_TEST_VERSION}" | ||
|
||
cabal update | ||
|
||
# TODO: we want to avoid building here... we should just | ||
# be using the previously built 'cabal-tests' binary | ||
# Also see https://github.com/haskell/cabal/issues/11048 | ||
cabal run -w "ghc-${GHC_TEST_VERSION}" ${ADD_CABAL_ARGS} cabal-testsuite:cabal-tests -- \ | ||
--with-cabal "$(pwd)/out/cabal" \ | ||
--intree-cabal-lib "$(pwd)" \ | ||
--test-tmp "$(pwd)/testdb" \ | ||
--skip-setup-tests \ | ||
-j "$(nproc || sysctl -n hw.ncpu || getconf _NPROCESSORS_ONLN || echo 1)" | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Build and release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
- 'cabal-install-*' | ||
pull_request: | ||
types: [opened, synchronize, reopened, labeled] | ||
branches: | ||
- master | ||
schedule: | ||
- cron: '0 0 * * *' | ||
hasufell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
workflow_dispatch: | ||
|
||
permissions: | ||
pull-requests: read | ||
|
||
env: | ||
BUILD_LABEL: "run release build" | ||
|
||
jobs: | ||
check-pr-labels: | ||
name: check PR labels | ||
runs-on: ubuntu-latest | ||
outputs: | ||
run_release_workflow: ${{ steps.gen_output.outputs.run_release_workflow }} | ||
steps: | ||
- id: gen_output | ||
run: | | ||
if [ "${{ github.event.action }}" == 'labeled' ] ; then | ||
if [ ${{ github.event.label.name == '${{ env.BUILD_LABEL }}' }} ] ; then | ||
echo run_release_workflow="yes" >> "$GITHUB_OUTPUT" | ||
else | ||
echo run_release_workflow="no" >> "$GITHUB_OUTPUT" | ||
fi | ||
elif [ "${{ github.event_name }}" = 'pull_request' ] ; then | ||
run_it=$(if gh api --jq '.labels.[].name' /repos/${{ github.repository }}/pulls/${{ github.event.number }} | grep --quiet '^${{ env.BUILD_LABEL }}$' ; then printf "%s" "yes" ; else printf "%s" "no" ; fi) | ||
echo "${run_it}" | ||
echo run_release_workflow="${run_it}" >> "$GITHUB_OUTPUT" | ||
else | ||
echo run_release_workflow="yes" >> "$GITHUB_OUTPUT" | ||
fi | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
release-workflow: | ||
needs: ["check-pr-labels"] | ||
if: ${{ needs.check-pr-labels.outputs.run_release_workflow == 'yes' }} | ||
hasufell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
uses: ./.github/workflows/reusable-release.yml | ||
geekosaur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with: | ||
branches: '["${{ github.ref }}"]' | ||
|
||
release: | ||
name: release | ||
needs: [ "release-workflow" ] | ||
runs-on: ubuntu-latest | ||
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: artifacts-* | ||
merge-multiple: true | ||
path: ./out | ||
|
||
- name: Install requirements | ||
run: | | ||
sudo apt-get update && sudo apt-get install -y tar xz-utils | ||
shell: bash | ||
|
||
- name: build sdists | ||
run: | | ||
cabal sdist -o out all | ||
shell: bash | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
draft: true | ||
files: | | ||
./out/* | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.