Skip to content

Commit

Permalink
Merge branch 'main' into structural-where-statements
Browse files Browse the repository at this point in the history
  • Loading branch information
ozgurakgun authored Nov 8, 2023
2 parents 65c3a8c + a9cbc2e commit 8a1dcd8
Show file tree
Hide file tree
Showing 2,445 changed files with 30,781 additions and 22,494 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
name: Building on all platforms

on:
workflow_dispatch: # can be triggered manually
push:
branches:
- master # run for the master branch
- main # run for the main branch
paths:
- conjure-cp.cabal
- Makefile
- src/**
- etc/build/**
- .github/workflows/build.yml
pull_request: # and for PRs
paths:
- conjure-cp.cabal
- Makefile
- src/**
- etc/build/**
- .github/workflows/build.yml
# other branches that want testing must create a PR

jobs:
Expand All @@ -23,7 +26,7 @@ jobs:

strategy:
matrix:
GHC_VERSION: [8.6]
GHC_VERSION: ["9.0", "9.2", "9.4"]
os: [ubuntu-latest, macos-latest]

runs-on: ${{ matrix.os }}
Expand All @@ -43,9 +46,14 @@ jobs:
path: |
~/.stack
.stack-work
key: stack-${{ runner.os }}-ghc${{ matrix.GHC_VERSION }}
key: stack-${{ runner.os }}-ghc${{ matrix.GHC_VERSION }}-${{ github.event.repository.updated_at }}
restore-keys: stack-${{ runner.os }}-ghc${{ matrix.GHC_VERSION }}

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ runner.os }}

- name: Setting PATH
shell: bash
run: echo "${HOME}/.local/bin" >> ${GITHUB_PATH}
Expand Down
55 changes: 30 additions & 25 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,37 @@ name: Publishing Docker image to ghcr.io
# documentation.

on:
push:
branches: [ master ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ master ]
release:
types: [published]
workflow_dispatch: # can be triggered manually
workflow_run: # run only when all tests pass
branches:
- main
workflows:
- Running all tests
types:
- completed
pull_request: # and for PRs that edit the docker files
paths:
- Dockerfile
- .github/workflows/docker-publish.yml
# other branches that want testing must create a PR


env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

Job:

# if this was triggered through a completed run of "Running all tests", we check if the run completed successfully
# if it was triggered through a PR, we just run it
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}

runs-on: ubuntu-latest

permissions:
contents: read
packages: write
Expand All @@ -34,43 +45,37 @@ jobs:
id-token: write

steps:

- name: Checkout repository
uses: actions/checkout@v3

# Setup ccache
- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1

# Workaround: https://github.com/docker/build-push-action/issues/461
# Set up buildx (Docker CLI plugin for extended build capabilities with BuildKit)
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
uses: docker/setup-buildx-action@v2

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
- name: Log into registry
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
uses: docker/build-push-action@v3
with:
context: ./etc/build/docker/
push: ${{ github.event_name != 'pull_request' }}
context: .
push: ${{ github.event_name != 'pull_request' }} # do not push if this was triggered by a PR
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
Expand Down
117 changes: 117 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Make a release

on:
workflow_dispatch: # can be triggered manually
push:
tags:
- 'v*'

permissions:
contents: write

jobs:

Job:

strategy:
matrix:
GHC_VERSION: ["9.4"]
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
release_suffix: linux
- os: macos-latest
release_suffix: macos-intel

runs-on: ${{ matrix.os }}

steps:

- uses: actions/checkout@v3
name: Checkout repository

- name: Stack version
shell: bash
run: GHC_VERSION=${{ matrix.GHC_VERSION }} make stack.yaml

- uses: actions/cache@v3
name: Cache stack
with:
path: |
~/.stack
.stack-work
key: stack-${{ runner.os }}-ghc${{ matrix.GHC_VERSION }}-${{ github.event.repository.updated_at }}
restore-keys: stack-${{ runner.os }}-ghc${{ matrix.GHC_VERSION }}

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ runner.os }}

- name: Setting PATH
shell: bash
run: echo "${HOME}/.local/bin" >> ${GITHUB_PATH}

- name: Build Conjure
shell: bash
run: BIN_DIR=${HOME}/.local/bin GHC_VERSION=${{ matrix.GHC_VERSION }} BUILD_TESTS=true make

- name: Setting PATH (for solvers)
shell: bash
run: |
echo "${HOME}/.local/bin" >> ${GITHUB_PATH}
echo "/usr/lib/ccache" >> ${GITHUB_PATH}
echo "/usr/local/opt/ccache/libexec" >> ${GITHUB_PATH}
- name: Installing dependencies (gperf) on Linux
shell: bash
run: sudo apt-get install -y gperf
if: runner.os == 'Linux'

- name: Installing dependencies (gperf) on macOS
shell: bash
run: brew install gperf
if: runner.os == 'macOS'

- name: Build solvers
shell: bash
run: BIN_DIR=${HOME}/.local/bin PROCESSES=2 make solvers

# when gecode comes back, this is the list
# conjure bc_minisat_all_release boolector cadical fzn-chuffed fzn-gecode glucose glucose-syrup kissat lingeling minion nbc_minisat_all_release open-wbo plingeling treengeling yices yices-sat yices-smt yices-smt2 z3
- name: Strip binaries
shell: bash
run: |
pushd ~/.local/bin
strip conjure bc_minisat_all_release boolector cadical fzn-chuffed glucose glucose-syrup kissat lingeling minion nbc_minisat_all_release open-wbo plingeling treengeling yices yices-sat yices-smt yices-smt2 z3
mkdir -p conjure-${{ github.ref_name }}-${{ matrix.release_suffix }}
cp conjure conjure-${{ github.ref_name }}-${{ matrix.release_suffix }}
mkdir -p conjure-${{ github.ref_name }}-${{ matrix.release_suffix }}-with-solvers
cp conjure bc_minisat_all_release boolector cadical fzn-chuffed glucose glucose-syrup kissat lingeling minion nbc_minisat_all_release open-wbo plingeling treengeling yices yices-sat yices-smt yices-smt2 z3 conjure-${{ github.ref_name }}-${{ matrix.release_suffix }}-with-solvers
cp -r savilerow savilerow.jar lib conjure-${{ github.ref_name }}-${{ matrix.release_suffix }}-with-solvers
zip -r -9 conjure-${{ github.ref_name }}-${{ matrix.release_suffix }}.zip conjure-${{ github.ref_name }}-${{ matrix.release_suffix }}
zip -r -9 conjure-${{ github.ref_name }}-${{ matrix.release_suffix }}-with-solvers.zip conjure-${{ github.ref_name }}-${{ matrix.release_suffix }}-with-solvers
popd
cp ~/.local/bin/conjure-${{ github.ref_name }}-${{ matrix.release_suffix }}.zip .
cp ~/.local/bin/conjure-${{ github.ref_name }}-${{ matrix.release_suffix }}-with-solvers.zip .
# See https://github.com/softprops/action-gh-release
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ github.ref_name }}
draft: false
prerelease: false
generate_release_notes: true
files: |
conjure-${{ github.ref_name }}-${{ matrix.release_suffix }}.zip
conjure-${{ github.ref_name }}-${{ matrix.release_suffix }}-with-solvers.zip
13 changes: 11 additions & 2 deletions .github/workflows/solvers.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
name: Building all solvers

on:
workflow_dispatch: # can be triggered manually
schedule:
- cron: '0 11 * * 1' # run at 11.00 every Monday
# we do not modify the install scripts or the Makefile very often,
# so we build the solvers once a week to make sure they still build OK.
push:
branches:
- master # run for the master branch
- main # run for the main branch
paths:
- etc/build/install*.sh
- Makefile
- .github/workflows/solvers.yml
pull_request: # and for PRs
paths:
- etc/build/install*.sh
- Makefile
- .github/workflows/solvers.yml
# other branches that want testing must create a PR

jobs:
Expand All @@ -19,7 +26,9 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os:
- ubuntu-latest
- macos-latest

runs-on: ${{ matrix.os }}

Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
name: Running all tests (code coverage)

on:
workflow_dispatch: # can be triggered manually
push:
branches:
- master # run for the master branch only
- main # run for the main branch only
paths:
- conjure-cp.cabal
- Makefile
- src/**
- tests/**
- etc/build/**
- .github/workflows/test-coverage.yml

jobs:

Job:

strategy:
matrix:
GHC_VERSION: [8.6]
GHC_VERSION: [9.4]
os: [ubuntu-latest]

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
Expand All @@ -36,9 +38,14 @@ jobs:
path: |
~/.stack
.stack-work
key: stack-${{ runner.os }}-ghc${{ matrix.GHC_VERSION }}
key: stack-${{ runner.os }}-ghc${{ matrix.GHC_VERSION }}-${{ github.event.repository.updated_at }}
restore-keys: stack-${{ runner.os }}-ghc${{ matrix.GHC_VERSION }}

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ runner.os }}

- name: Setting PATH
shell: bash
run: echo "${HOME}/.local/bin" >> ${GITHUB_PATH}
Expand All @@ -51,6 +58,10 @@ jobs:
shell: bash
run: BIN_DIR=${HOME}/.local/bin etc/build/install-minion.sh

- name: Install Chuffed
shell: bash
run: BIN_DIR=${HOME}/.local/bin etc/build/install-chuffed.sh

- name: Install Cadical
shell: bash
run: BIN_DIR=${HOME}/.local/bin etc/build/install-cadical.sh
Expand Down
Loading

0 comments on commit 8a1dcd8

Please sign in to comment.