Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Make/build cut-off #1706

Make/build cut-off

Make/build cut-off #1706

Workflow file for this run

name: "CI"
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
paths:
- .github/workflows/**/*.yml
- app/**/*
- bundle/**/*
- ci/**/*
- license-generator/**/*
- src/**/*
- test/**/*
- .gitignore
- .hlint.yaml
- .hspec
- cabal.project
- purescript.cabal
- Setup.hs
- stack.yaml
- stack.yaml.lock
- update-changelog.hs
- weeder.dhall
release:
types: [ "published" ]
defaults:
run:
shell: "bash"
env:
CI_PRERELEASE: "${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}"
CI_RELEASE: "${{ github.event_name == 'release' }}"
STACK_VERSION: "3.3.1"
concurrency:
# We never want two prereleases building at the same time, since they would
# likely both claim the same version number. Pull request builds can happen
# in parallel with anything else, since they don't mutate global state with a
# release. Release builds don't change their behavior based on published
# state, so they don't interfere with each other and there's no point in
# canceling a prerelease build if a release build starts; and we would never
# want a release build to be canceled by a prerelease build either. (GitHub
# Actions is either too cheap to give us `if` expressions or too lazy to
# document them, but we have untyped boolean operators to fall back on.)
group: "${{ github.event_name != 'push' && github.run_id || 'continuous-deployment' }}"
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false # do not cancel builds for other OSes if one fails
matrix:
include:
- image: quay.io/benz0li/ghc-musl:9.8.4
os: ubuntu-latest
- image: quay.io/benz0li/ghc-musl:9.8.4
os: ubuntu-24.04-arm
- os: macos-15-intel # x64
- os: macos-14 # arm64
- os: windows-2022 # x64
runs-on: "${{ matrix.os }}"
container:
image: "${{ matrix.image }}"
# https://github.com/actions/runner/issues/801#issuecomment-2976165281
# This workaround also requires a special installation step for Node.js on arm64
volumes:
- "${{ contains(matrix.os, 'arm') && '/opt:/opt:rw,rshared' || ' ' }}"
- "${{ contains(matrix.os, 'arm') && '/opt:/__e/node20:ro,rshared' || ' ' }}"
env:
CI_STATIC: "${{ startsWith(matrix.os, 'ubuntu') }}"
outputs:
do-not-prerelease: "${{ steps.build.outputs.do-not-prerelease }}"
version: "${{ steps.build.outputs.version }}"
steps:
# We need `gh` installed on the Linux version. Otherwise, release artifacts won't be uploaded.
- name: "(Linux only) Install gh"
if: "${{ startsWith(matrix.os, 'ubuntu') }}"
run: |
apk add github-cli
- name: "(Linux only / x64) Install Node"
if: "${{ startsWith(matrix.os, 'ubuntu') && ! contains(matrix.os, 'arm') }}"
run: |
apk add nodejs npm
- name: "(Linux only / arm64) Install Node"
if: "${{ startsWith(matrix.os, 'ubuntu') && contains(matrix.os, 'arm') }}"
run: |
sed -i "/^ID=/s/alpine/NotpineForGHA/" /etc/os-release
apk add nodejs npm --update-cache
mkdir /opt/bin
ln -s /usr/bin/node /opt/bin/node
- uses: "actions/checkout@v4"
- id: "haskell"
name: "(Non-Linux only) Install Haskell"
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'windows')
uses: "haskell-actions/setup@v2"
with:
ghc-version: "9.8.4"
enable-stack: true
stack-version: "${{ env.STACK_VERSION }}"
stack-no-global: true
- name: "(Linux only) Fix working directory ownership"
if: "${{ startsWith(matrix.os, 'ubuntu') }}"
run: |
chown root:root .
- uses: "actions/cache@v4"
with:
path: |
/root/.stack
${{ steps.haskell.outputs.stack-root }}
key: "${{ matrix.image || matrix.os }}-v3-${{ hashFiles('stack.yaml.lock', 'purescript.cabal') }}"
- name: "(Windows only) Configure Stack to store its programs in STACK_ROOT"
# This ensures that the local GHC and MSYS binaries that Stack installs
# are included in the cache. (This behavior is the default on
# non-Windows OSes.)
if: "${{ runner.os == 'Windows' }}"
run: |
mkdir -p "$STACK_ROOT"
echo "local-programs-path: $STACK_ROOT/programs" > $STACK_ROOT/config.yaml
- name: "(Linux only) Configure Stack"
if: "${{ startsWith(matrix.os, 'ubuntu') }}"
run: |
ci/fix-home stack config set system-ghc --global true
ci/fix-home stack config set install-ghc --global false
- id: "build"
run: "ci/fix-home ci/build.sh"
- name: "(Linux only) Glob tests"
if: "${{ startsWith(matrix.os, 'ubuntu') }}"
working-directory: "sdist-test"
# We build in this directory in build.sh, so this is where we need to
# launch `stack exec`. The actual glob checks happen in a temporary directory.
run: |
apk add tree
../ci/fix-home stack exec bash ../glob-test.sh
- name: "(Linux only) Build the entire package set"
if: "${{ startsWith(matrix.os, 'ubuntu') }}"
# We build in this directory in build.sh, so this is where we need to
# launch `stack exec`. The actual package-set building happens in a
# temporary directory.
working-directory: "sdist-test"
# The presence or absence of the --haddock flag changes the location
# into which stack places all build artifacts. Since we use --haddock
# in our CI builds, in order to actually get stack to find the purs
# binary it created, we need to use the flag here as well.
#
# Moreover, npm has a hook issue that will cause spago to fail to install
# We upgrade npm to fix this
run: |
apk add jq coreutils
../ci/fix-home stack --haddock exec ../ci/build-package-set.sh
- name: Verify that 'libtinfo' isn't in binary
if: ${{ runner.os == 'Linux' }}
working-directory: "sdist-test"
run: |
if [ $(ldd $(../ci/fix-home stack path --local-doc-root)/../bin/purs | grep 'libtinfo' | wc -l) -ge 1 ]; then
echo "libtinfo detected"
ldd $(../ci/fix-home stack path --local-doc-root)/../bin/purs | grep 'libtinfo'
exit 1
fi
- name: "(Linux only) Install perl-utils"
if: "${{ startsWith(matrix.os, 'ubuntu') }}"
run: |
apk add perl-utils
- name: "(Release/prerelease only) Create bundle"
if: "${{ env.CI_RELEASE == 'true' || env.CI_PRERELEASE == 'true' && steps.build.outputs.do-not-prerelease != 'true' }}"
run: |
os_name="${{ runner.os }}"
os_arch="${{ runner.arch }}"
case "$os_name" in
Linux)
case "$os_arch" in
ARM64)
bundle_os=linux-arm64;;
*)
bundle_os=linux64;;
esac;;
macOS)
case "$os_arch" in
ARM64)
bundle_os=macos-arm64;;
*)
bundle_os=macos;;
esac;;
Windows)
bundle_os=win64;;
*)
echo "Unknown OS name: $os_name"
exit 1;;
esac
cd sdist-test
../ci/fix-home bundle/build.sh "$bundle_os"
- name: "(Prerelease only) Upload bundle"
if: "${{ env.CI_PRERELEASE == 'true' && steps.build.outputs.do-not-prerelease != 'true' }}"
uses: "actions/upload-artifact@v4.6.0"
with:
name: "${{ runner.os }}-${{ runner.arch }}-bundle"
path: |
sdist-test/bundle/*.sha
sdist-test/bundle/*.tar.gz
- name: "(Release only) Publish bundle"
if: "${{ env.CI_RELEASE == 'true' }}"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: "gh release upload --clobber ${{ github.ref_name }} sdist-test/bundle/*.{tar.gz,sha}"
lint:
container: haskell:9.8.4
runs-on: ubuntu-latest # Exact version is not important, as it's only the container host
steps:
- uses: "actions/checkout@v4"
- name: "Fix working directory ownership"
run: |
chown root:root .
- uses: "actions/cache@v4"
with:
path: |
/root/.stack
key: "lint-${{ hashFiles('stack.yaml.lock', 'purescript.cabal') }}"
- run: "ci/fix-home ci/run-hlint.sh --git"
env:
VERSION: "3.10"
- name: Install weeder
run: |
ci/fix-home stack --no-terminal --jobs=2 \
build --copy-compiler-tool weeder-2.9.0
- run: |
ci/fix-home stack --no-terminal --jobs=2 \
build --fast --ghc-options -fwrite-ide-info
- run: "ci/fix-home stack exec weeder -- --hie-directory .stack-work"
# Now do it again, with the test suite included. We don't want a
# reference from our test suite to count in the above check; the fact
# that a function is tested is not evidence that it's needed. But we also
# don't want to leave weeds lying around in our test suite either.
- run: |
ci/fix-home stack --no-terminal --jobs=2 \
build --fast --test --no-run-tests --ghc-options -fwrite-ide-info
- run: "ci/fix-home stack exec weeder -- --hie-directory .stack-work"
make-prerelease:
runs-on: ubuntu-latest
needs:
- "build"
- "lint"
if: "${{ github.event_name == 'push' && needs.build.outputs.do-not-prerelease != 'true' }}"
steps:
- uses: "actions/download-artifact@v4"
- uses: "ncipollo/release-action@v1.10.0"
with:
tag: "v${{ needs.build.outputs.version }}"
artifacts: "*-bundle/*"
prerelease: true
body: "This is an automated preview release. Get the latest stable release [here](https://github.com/purescript/purescript/releases/latest)."
- uses: "actions/checkout@v4"
- uses: "actions/setup-node@v4"
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
- name: "Publish npm package"
working-directory: "npm-package"
env:
BUILD_VERSION: "${{ needs.build.outputs.version }}"
NODE_AUTH_TOKEN: "${{ secrets.NPM_TOKEN }}"
run: |
src_version=$(node -pe 'require("./package.json").version')
npm version --allow-same-version "$BUILD_VERSION"
sed -i -e "s/--purs-ver=${src_version//./\\.}/--purs-ver=$BUILD_VERSION/" package.json
npm publish --tag next
Morty Proxy This is a proxified and sanitized view of the page, visit original site.