diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 682399a..0952d2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -158,26 +158,14 @@ jobs: needs: ['tests', 'build-alpine'] steps: - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v3 with: - name: confer-Linux-x86_64 + name: artifact + path: ./out - - uses: actions/download-artifact@v4 + - name: Create a GitHub Pre-release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') with: - name: confer-Linux-static-x86_64 - - - uses: actions/download-artifact@v4 - with: - name: confer-macOS-arm64 - - - name: Create GitHub prerelease - uses: marvinpinto/action-automatic-releases@v1.2.1 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - automatic_release_tag: confer-head - prerelease: true - title: confer-head - files: | - confer-head-Linux-x86_64.tar.gz - confer-head-Linux-static-x86_64.tar.gz - confer-head-macOS-arm64.tar.gz + draft: true + files: ./out/* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1255867 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,174 @@ +name: Release Pipeline + +on: + push: + branches: ['main'] + tags: + - "v*" + +jobs: + + generate-matrix: + name: 'Generate matrix from cabal' + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + runs-on: ubuntu-latest + steps: + - name: Extract the tested GHC versions + id: set-matrix + uses: kleidukos/get-tested@v0.1.7.1 + with: + cabal-file: confer.cabal + ubuntu-version: 'latest' + macos-version: 'latest' + version: 0.1.7.1 + + tests: + name: ${{ matrix.ghc }} on ${{ matrix.os }} + needs: generate-matrix + runs-on: ${{ matrix.os }} + strategy: + matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} + steps: + - name: Checkout base repo + uses: actions/checkout@v4 + - name: "Install tools" + run: | + .github/workflows/install-tools.sh + - name: Set up Haskell + id: setup-haskell + uses: haskell-actions/setup@v2 + with: + ghc-version: ${{ matrix.ghc }} + cabal-version: 'latest' + - name: Configure + run: | + ARCHITECTURE=$(uname -m) + echo "ARCH=$ARCHITECTURE" >> $GITHUB_ENV + echo ${{ env.ARCH }} + cabal configure --enable-tests + - name: Freeze + run: cabal freeze --project-file=cabal.release.project + - name: Cache + uses: actions/cache@v4.0.2 + with: + path: ${{ steps.setup-haskell.outputs.cabal-store }} + key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ hashFiles('**/plan.json') }} + restore-keys: ${{ runner.os }}-ghc-${{ matrix.ghc }}- + + - name: Build + run: cabal build --project-file=cabal.release.project + + - name: Install + run: | + bin=$(cabal -v0 --project-file=cabal.static.project list-bin confer) + mkdir distribution + cp ${bin} distribution/confer + + - name: File type + run: file distribution/confer + + - name: Package the confer executable + run: | + PRINTAPI_EXEC=distribution/confer + .github/workflows/process-binaries.sh + DIR=$(dirname $PRINTAPI_EXEC) + FILE=$(basename $PRINTAPI_EXEC) + version=$(./distribution/confer --version) + PRINTAPI_EXEC_TAR=confer-${version}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.ARCH }}.tar.gz + tar -czvf $PRINTAPI_EXEC_TAR -C $DIR $FILE + echo PRINTAPI_EXEC_TAR=$PRINTAPI_EXEC_TAR >> $GITHUB_ENV + - name: Upload the confer executable + uses: actions/upload-artifact@v3 + with: + name: artifact + path: ${{ env.PRINTAPI_EXEC_TAR }} + + build-alpine: + name: 9.8.2 on alpine-3.19 + runs-on: ubuntu-latest + container: 'alpine:3.19' + needs: generate-matrix + steps: + - name: Install extra dependencies + shell: sh + run: | + apk add bash binutils-gold curl \ + curl file g++ gcc git gmp-dev \ + jq libc-dev libffi-dev make \ + musl-dev ncurses-dev perl pkgconfig \ + sudo tar upx xz zlib-dev zlib-static + + - uses: actions/checkout@v4 + + - uses: haskell-actions/setup@v2 + id: setup-haskell + with: + ghc-version: '9.8.2' + cabal-version: 'latest' + + - name: Configure + run: | + ARCHITECTURE=$(uname -m) + echo "ARCH=$ARCHITECTURE" >> $GITHUB_ENV + echo ${{ env.ARCH }} + cabal configure --enable-tests + + - name: Freeze + run: cabal freeze --project-file=cabal.static.project + + - uses: actions/cache@v4 + with: + path: ${{ steps.setup-haskell.outputs.cabal-store }} + key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-${{ hashFiles('**/plan.json') }} + restore-keys: ${{ runner.os }}-${{ steps.setup.outputs.ghc-version }}- + + - name: Build + run: cabal build --project-file=cabal.static.project + + - name: Test + run: cabal test --project-file=cabal.static.project all + + - name: Install + run: | + bin=$(cabal -v0 --project-file=cabal.static.project list-bin confer) + mkdir distribution + install ${bin} distribution/confer + + - name: File type + run: file distribution/confer + + - name: Tar cabal head executable + run: | + CONFER_EXEC=distribution/confer + .github/workflows/process-binaries.sh + DIR=$(dirname $CONFER_EXEC) + FILE=$(basename $CONFER_EXEC) + CONFER_EXEC_TAR=confer-head-${{ runner.os }}-static-${{ env.ARCH }}.tar.gz + tar -czvf $CONFER_EXEC_TAR -C $DIR $FILE + echo CONFER_EXEC_TAR=$CONFER_EXEC_TAR >> $GITHUB_ENV + + - name: Upload confer executable to workflow artifacts + uses: actions/upload-artifact@v3 + with: + name: confer-${{ runner.os }}-static-x86_64 + path: ${{ env.CONFER_EXEC_TAR }} + + release: + name: Create a GitHub release with the binary artifacts + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + needs: ['tests', 'build-alpine'] + + steps: + - uses: actions/download-artifact@v3 + with: + name: artifact + path: ./out + + - name: Create a GitHub Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + draft: true + files: ./out/* diff --git a/cabal.project.freeze b/cabal.project.freeze index 434a827..f748a9a 100644 --- a/cabal.project.freeze +++ b/cabal.project.freeze @@ -1,4 +1,3 @@ -active-repositories: hackage.haskell.org:merge constraints: any.OneTuple ==0.4.2, any.QuickCheck ==2.15.0.1, QuickCheck -old-random +templatehaskell, @@ -42,6 +41,7 @@ constraints: any.OneTuple ==0.4.2, any.effectful-core ==2.3.1.0, any.exceptions ==0.10.7, any.extra ==1.7.16, + any.file-embed ==0.0.16.0, any.filepath ==1.4.200.1, any.generically ==0.1.1, any.ghc-bignum ==1.3, diff --git a/cabal.release.project.freeze b/cabal.release.project.freeze new file mode 100644 index 0000000..55b98ea --- /dev/null +++ b/cabal.release.project.freeze @@ -0,0 +1,119 @@ +constraints: any.OneTuple ==0.4.2, + any.QuickCheck ==2.15.0.1, + QuickCheck -old-random +templatehaskell, + any.StateVar ==1.2.2, + any.aeson ==2.2.3.0, + aeson +ordered-keymap, + any.ansi-terminal ==1.1.1, + ansi-terminal -example, + any.ansi-terminal-types ==1.1, + any.array ==0.5.6.0, + any.assoc ==1.1.1, + assoc -tagged, + any.base-orphans ==0.9.2, + any.bifunctors ==5.6.2, + bifunctors +tagged, + any.binary ==0.8.9.1, + any.bytestring ==0.12.1.0, + any.call-stack ==0.4.0, + any.character-ps ==0.1, + any.clock ==0.8.4, + clock -llvm, + any.colour ==2.3.6, + any.comonad ==5.0.8, + comonad +containers +distributive +indexed-traversable, + confer -development, + any.containers ==0.6.8, + any.contravariant ==1.5.5, + contravariant +semigroups +statevar +tagged, + any.data-fix ==0.3.4, + any.directory ==1.3.8.1, + any.distributive ==0.6.2.1, + distributive +semigroups +tagged, + any.dlist ==1.0, + dlist -werror, + any.effectful ==0.0.0.0, + any.effectful-core ==2.3.1.0, + any.exceptions ==0.10.7, + any.extra ==1.7.16, + any.file-embed ==0.0.16.0, + any.filepath ==1.4.200.1, + any.generically ==0.1.1, + any.hashable ==1.5.0.0, + hashable -arch-native -random-initial-seed, + any.hostname ==1.0, + any.hpc ==0.7.0.0, + any.hslua-aeson ==2.3.1.1, + any.hslua-core ==2.3.2, + any.hslua-marshalling ==2.3.1, + any.hslua-module-system ==1.1.2, + any.hslua-objectorientation ==2.3.1, + any.hslua-packaging ==2.3.1, + any.hslua-typing ==0.1.1, + any.indexed-traversable ==0.1.4, + any.indexed-traversable-instances ==0.1.2, + any.integer-conversion ==0.1.1, + any.integer-logarithms ==1.0.3.1, + integer-logarithms -check-bounds +integer-gmp, + any.lua ==2.3.2, + lua +allow-unsafe-gc -apicheck -cross-compile +export-dynamic -lua_32bits -pkg-config -system-lua, + any.monad-control ==1.0.3.1, + any.mtl ==2.3.1, + any.network-uri ==2.6.4.2, + any.optparse-applicative ==0.18.1.0, + optparse-applicative +process, + any.os-string ==2.0.6, + any.parsec ==3.1.17.0, + any.placeholder ==0, + any.pretty ==1.1.3.6, + any.prettyprinter ==1.7.1, + prettyprinter -buildreadme +text, + any.prettyprinter-ansi-terminal ==1.1.3, + any.primitive ==0.9.0.0, + any.process ==1.6.18.0, + any.random ==1.2.1.2, + any.resourcet ==1.3.0, + any.scientific ==0.3.8.0, + scientific -integer-simple, + any.selective ==0.7.0.1, + any.semialign ==1.3.1, + semialign +semigroupoids, + any.semigroupoids ==6.0.1, + semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers, + any.splitmix ==0.1.0.5, + splitmix -optimised-mixer, + any.stm ==2.5.2.1, + any.strict ==0.5.1, + any.tagged ==0.8.8, + tagged +deepseq +transformers, + any.tasty ==1.5, + tasty +unix, + any.tasty-coverage ==0.1.3.0, + any.tasty-hunit ==0.10.2, + any.temporary ==1.3, + any.text ==2.1.1, + any.text-display ==0.0.5.2, + text-display -book, + any.text-iso8601 ==0.1.1, + any.text-short ==0.1.6, + text-short -asserts, + any.th-abstraction ==0.7.0.0, + any.th-compat ==0.1.5, + any.these ==1.2.1, + any.time ==1.12.2, + any.time-compat ==1.9.7, + any.transformers ==0.6.1.0, + any.transformers-base ==0.4.6, + transformers-base +orphaninstances, + any.transformers-compat ==0.7.2, + transformers-compat -five +five-three -four +generic-deriving +mtl -three -two, + any.unix ==2.8.4.0, + any.unliftio-core ==0.2.1.0, + any.unordered-containers ==0.2.20, + unordered-containers -debug, + any.uuid-types ==1.0.6, + any.validation-selective ==0.2.0.0, + any.vector ==0.13.1.0, + vector +boundschecks -internalchecks -unsafechecks -wall, + any.vector-stream ==0.1.0.1, + any.witherable ==0.5 diff --git a/confer.cabal b/confer.cabal index d64df64..b0ac4d0 100644 --- a/confer.cabal +++ b/confer.cabal @@ -76,11 +76,11 @@ library autogen-modules: Paths_confer build-depends: , aeson - , base + , base ==4.19.1.0 , containers , directory , effectful - , effectful-core + , effectful-core ^>=2.3 , extra , file-embed , filepath