Skip to content

Commit

Permalink
Merge branch 'master' into github-actions-system-ghc
Browse files Browse the repository at this point in the history
  • Loading branch information
msakai authored May 21, 2024
2 parents 525d216 + d065780 commit dea5d92
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 39 deletions.
60 changes: 42 additions & 18 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
on: [push, pull_request]
on:
push:
branches:
- master
tags:
- '*'
pull_request:

name: build
jobs:
build:
Expand All @@ -10,31 +17,35 @@ jobs:
fail-fast: false
matrix:
include:
- ghc: '9.4.4'
- ghc: '9.4.5'
os: ubuntu-latest
stack_yaml: 'stack-ghc-9.4.yaml'
stack_args: '--haddock --no-haddock-deps'
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms'
platform: linux-x86_64
coveralls: false

- ghc: '9.2.5'
- ghc: '9.2.8'
os: ubuntu-latest
stack_yaml: 'stack-ghc-9.2.yaml'
stack_args: '--haddock --no-haddock-deps'
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms'
platform: linux-x86_64
coveralls: false

- ghc: '9.0.2'
os: ubuntu-latest
stack_yaml: 'stack-ghc-9.0.yaml'
stack_args: '--haddock --no-haddock-deps'
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms'
platform: linux-x86_64
release: true
- ghc: '9.0.2'
os: macos-latest
os: macos-13 # Intel Mac
stack_yaml: 'stack-ghc-9.0.yaml'
stack_args: ''
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms'
platform: macos
coveralls: false
release: true

Expand All @@ -45,6 +56,7 @@ jobs:
stack_yaml: 'stack-ghc-8.10.yaml'
stack_args: ''
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms'
platform: win64
coveralls: false
release: true

Expand All @@ -53,21 +65,23 @@ jobs:
stack_yaml: 'stack-ghc-8.8.yaml'
stack_args: '--coverage'
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms'
platform: linux-x86_64
coveralls: true

- ghc: '8.6.3'
os: windows-latest
stack_yaml: 'stack-windows-i386.yaml'
stack_args: ''
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms'
platform: win32
coveralls: false
release: true
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true

- uses: haskell/actions/setup@v2
- uses: haskell-actions/setup@v2
id: setup-haskell
name: Setup Haskell
with:
Expand All @@ -89,7 +103,7 @@ jobs:
sudo apt-get update
sudo apt-get install ocl-icd-opencl-dev
- uses: actions/cache@v3
- uses: actions/cache@v4
name: Cache ~/.stack
with:
path: ${{ steps.setup-haskell.outputs.stack-root }}
Expand Down Expand Up @@ -147,20 +161,22 @@ jobs:
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
curl -L https://github.com/lehins/stack-hpc-coveralls/releases/download/v0.0.6.0/shc.tar.gz | tar -xz
curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.7.0/shc-Linux-X64.tar.bz2 | tar -xj
./shc --repo-token="$COVERALLS_REPO_TOKEN" toysolver TestSuite TestPolynomial
- name: Test scripts
shell: bash
run: stack runhaskell ${{ matrix.stack_args }} misc/generate_packageVersions.hs > /dev/null

- name: Build artifacts
id: build-artifact
run: stack runhaskell ${{ matrix.stack_args }} --package turtle misc/build_artifacts.hs

- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: matrix.release
with:
name: binary-packages
name: binary-packages-${{ matrix.platform }}
path: |
*.tar.xz
*.7z
Expand All @@ -172,13 +188,25 @@ jobs:
if: startsWith(github.ref, 'refs/tags')
needs: build
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: binary-packages-linux-x86_64
path: binary-packages
- uses: actions/download-artifact@v4
with:
name: binary-packages-macos
path: binary-packages
- uses: actions/download-artifact@v4
with:
name: binary-packages-win32
path: binary-packages
- uses: actions/download-artifact@v4
with:
name: binary-packages
name: binary-packages-win64
path: binary-packages

- name: Upload artifacts to GitHub Release
Expand All @@ -187,9 +215,5 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
shopt -s nullglob
assets=()
for asset in binary-packages/*; do
assets+=("-a" "$asset")
done
tag_name="${GITHUB_REF#refs/tags/}"
hub release create "${assets[@]}" -d -m "$tag_name" "$tag_name"
gh release create --draft --title "${tag_name}" "${tag_name}" binary-packages/*
72 changes: 72 additions & 0 deletions doc/dev/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Release process

## Preparation

* Run `ruby misc/remove-trailing-space.rb`
* Run `ruby misc/collect-language-pragmas.rb` and update `Other-Extensions` in `.cabal` if necesary
* Run `ruby misc/collect-min-version-macro.rb` and remove `#if`s that are always satisfied by the versions specified by `Build-Depends`
* Update `CHANGELOG.markdown`
* Bump version in `toysolver.cabal` if necessary.

## Set environment variables

```shell-session
$ export GHC_VERSION=9.4
$ export TOYSOLVER_VERSION=X.Y.Z
```

## Make git tag and push it

```shell-session
$ git tag v${TOYSOLVER_VERSION}
$ git push origin v${TOYSOLVER_VERSION}
```

## Check draft release generated by GitHub Actions

.

## Upload to Hackage

```shell-session
$ stack upload .`
```

## Make the draft release public

.

## Update [homebrew-tap](https://github.com/msakai/homebrew-tap)

e.g. https://github.com/msakai/homebrew-tap/pull/3

## Update docker image

On AMD64 machine:

```shell-session
$ docker build --platform linux/amd64 \
--build-arg GHC_VERSION --build-arg TOYSOLVER_VERSION \
-t msakai/toysolver:${TOYSOLVER_VERSION}-amd64 -f docker/Dockerfile .
$ docker push msakai/toysolver:${TOYSOLVER_VERSION}-amd64
```

On macOS with Apple Silicon:

```shell-session
$ docker build --platform linux/arm64 \
--build-arg GHC_VERSION --build-arg TOYSOLVER_VERSION \
-t msakai/toysolver:${TOYSOLVER_VERSION}-arm64 -f docker/Dockerfile .
$ docker push msakai/toysolver:${TOYSOLVER_VERSION}-arm64
```

```shell-session
$ docker manifest create msakai/toysolver:${TOYSOLVER_VERSION} \
--amend msakai/toysolver:${TOYSOLVER_VERSION}-amd64 \
--amend msakai/toysolver:${TOYSOLVER_VERSION}-arm64
$ docker manifest push msakai/toysolver:${TOYSOLVER_VERSION}
$ docker manifest create msakai/toysolver:latest \
--amend msakai/toysolver:${TOYSOLVER_VERSION}-amd64 \
--amend msakai/toysolver:${TOYSOLVER_VERSION}-arm64
$ docker manifest push msakai/toysolver:latest
```
2 changes: 1 addition & 1 deletion stack-ghc-9.2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# resolver:
# name: custom-snapshot
# location: "./custom-snapshot.yaml"
resolver: lts-20.7
resolver: lts-20.25

# User packages to be built.
# Various formats can be used as shown in the example below.
Expand Down
2 changes: 1 addition & 1 deletion stack-ghc-9.4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# resolver:
# name: custom-snapshot
# location: "./custom-snapshot.yaml"
resolver: nightly-2023-01-18
resolver: nightly-2023-06-11

# User packages to be built.
# Various formats can be used as shown in the example below.
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# resolver:
# name: custom-snapshot
# location: "./custom-snapshot.yaml"
resolver: lts-19.33
resolver: lts-20.25

# User packages to be built.
# Various formats can be used as shown in the example below.
Expand Down
35 changes: 17 additions & 18 deletions toysolver.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Tested-With:
GHC ==8.8.4
GHC ==8.10.7
GHC ==9.0.2
GHC ==9.2.5
GHC ==9.4.4
GHC ==9.2.8
GHC ==9.4.5
Extra-Source-Files:
README.md
INSTALL.md
Expand All @@ -25,18 +25,6 @@ Extra-Source-Files:
COPYING-GPL
app/toysat-ipasir/ipasir.h
app/toysat-ipasir/ipasir.map
misc/build_bdist_maxsat_evaluation.sh
misc/build_bdist_pb_evaluation.sh
misc/build_bdist_qbf_evaluation.sh
misc/build_bdist_smtcomp.sh
misc/maxsat/toysat/README.md
misc/maxsat/toysat/toysat
misc/maxsat/toysat_ls/README.md
misc/maxsat/toysat_ls/toysat_ls
misc/pb/README.md
misc/qbf/README.md
misc/smtcomp/bin/starexec_run_default
misc/smtcomp/starexec_description.txt
src/ToySolver/Data/Polyhedron.hs
samples/gcnf/*.cnf
samples/gcnf/*.gcnf
Expand Down Expand Up @@ -123,6 +111,11 @@ Flag ExtraBoundsChecking
Manual: True
Default: False

Flag optparse-applicative-018
Description: use optparse-applicative >=0.18
Manual: False
Default: False

source-repository head
type: git
location: git://github.com/msakai/toysolver.git
Expand All @@ -132,8 +125,8 @@ Library
Hs-source-dirs: src
Build-Depends:
array >=0.5,
-- GHC >=8.6 && <9.5
base >=4.12 && <4.18,
-- GHC >=8.6 && <9.7
base >=4.12 && <4.19,
bytestring >=0.9.2.1 && <0.12,
bytestring-builder,
bytestring-encoding >=0.1.1.0,
Expand Down Expand Up @@ -553,17 +546,23 @@ Executable toyconvert
HS-Source-Dirs: app
Build-Depends:
base,
ansi-wl-pprint,
bytestring,
bytestring-builder,
data-default-class,
filepath,
MIP,
optparse-applicative,
pseudo-boolean,
scientific,
text,
toysolver
if flag(optparse-applicative-018)
Build-Depends:
optparse-applicative >=0.18,
ansi-wl-pprint >=1.0
else
Build-Depends:
optparse-applicative <0.18,
ansi-wl-pprint
Default-Language: Haskell2010
Other-Extensions: CPP
GHC-Options: -rtsopts
Expand Down

0 comments on commit dea5d92

Please sign in to comment.