-
Notifications
You must be signed in to change notification settings - Fork 22
146 lines (116 loc) · 4.65 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Make a release
on:
workflow_dispatch: # can be triggered manually
push:
tags:
- "v*.*.*"
pull_request: # and for PRs
paths:
- conjure-cp.cabal
- Makefile
- src/**
- tests/**
- etc/build/**
- etc/savilerow/**
- .github/workflows/release.yml
# other branches that want testing must create a PR
permissions:
contents: write
env:
SCCACHE_GHA_ENABLED: "true"
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@v4
name: Checkout repository
- name: Stack version
shell: bash
run: GHC_VERSION=${{ matrix.GHC_VERSION }} make stack.yaml
- uses: actions/cache@v4
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: Run sccache-cache
uses: mozilla-actions/[email protected]
- 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}/solver-binaries" >> ${GITHUB_PATH}
# libnuma-dev for runsolver
# autoconf, cmake, gmp for yices
- name: Installing dependencies on Linux
shell: bash
run: sudo apt-get install -y gperf libnuma-dev
if: runner.os == 'Linux'
- name: Installing dependencies on macOS
shell: bash
run: brew install autoconf cmake gmp gperf
if: runner.os == 'macOS'
- name: Build solvers
shell: bash
run: |
rm -rf ${HOME}/solver-binaries
BIN_DIR=${HOME}/solver-binaries PROCESSES=2 make solvers
- name: Set version string to the commit hash
run: echo "RELEASE_VERSION=${{ github.sha }}" >> "$GITHUB_ENV"
- name: Set version string based on trigger (ref_name if on tag)
run: echo "RELEASE_VERSION=${{ github.ref_name }}" >> "$GITHUB_ENV"
if: startsWith(github.ref, 'refs/tags/')
- name: Set version string based on trigger (PR number if a PR)
run: echo "RELEASE_VERSION=${{ github.event.pull_request.number }}" >> "$GITHUB_ENV"
if: github.event_name == 'pull_request'
- name: Create the zip archives
shell: bash
run: |
pushd ${HOME}/solver-binaries
cp ~/.local/bin/conjure ~/.local/bin/savilerow ~/.local/bin/savilerow.jar .
mkdir -p lib
cp -r ~/.local/bin/lib/* lib/
cd ..
rm -rf conjure-${RELEASE_VERSION}-${{ matrix.release_suffix }}-with-solvers
cp -r solver-binaries conjure-${RELEASE_VERSION}-${{ matrix.release_suffix }}-with-solvers
cd solver-binaries
cp -r ../conjure-${RELEASE_VERSION}-${{ matrix.release_suffix }}-with-solvers .
rm -rf conjure-${RELEASE_VERSION}-${{ matrix.release_suffix }}
mkdir conjure-${RELEASE_VERSION}-${{ matrix.release_suffix }}
cp conjure conjure-${RELEASE_VERSION}-${{ matrix.release_suffix }}
zip -r -9 conjure-${RELEASE_VERSION}-${{ matrix.release_suffix }}.zip conjure-${RELEASE_VERSION}-${{ matrix.release_suffix }}
zip -r -9 conjure-${RELEASE_VERSION}-${{ matrix.release_suffix }}-with-solvers.zip conjure-${RELEASE_VERSION}-${{ matrix.release_suffix }}-with-solvers
popd
cp ${HOME}/solver-binaries/conjure-${RELEASE_VERSION}-${{ matrix.release_suffix }}.zip .
cp ${HOME}/solver-binaries/conjure-${RELEASE_VERSION}-${{ 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
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${RELEASE_VERSION}
draft: false
prerelease: false
generate_release_notes: true
files: |
conjure-${RELEASE_VERSION}-${{ matrix.release_suffix }}.zip
conjure-${RELEASE_VERSION}-${{ matrix.release_suffix }}-with-solvers.zip