Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: 'Bump version and make release job'
on:
push:
branches:
- 'master'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

cache-cabal:
name: 'Cache Cabal'
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-22.04
os: ubuntu-22.04
nix: x86_64-linux
- runner: MacM1
os: self-macos-12
nix: aarch64-darwin
runs-on: ${{ matrix.runner }}
steps:
- name: Check out code
uses: actions/checkout@v4
with:
submodules: recursive

# Do the Following only on Public Runners; Mac Runner is pre-installed with build tools
- name: 'Install Nix'
if: ${{ !startsWith(matrix.os, 'self') }}
uses: cachix/install-nix-action@v25
with:
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
substituters = http://cache.nixos.org https://cache.iog.io
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=

- name: 'Install Cachix'
if: ${{ !startsWith(matrix.os, 'self') }}
uses: cachix/cachix-action@v14
with:
name: k-framework
authToken: '${{ secrets.CACHIX_PUBLIC_TOKEN }}'

- name: Cache Cabal package database and store
uses: actions/cache@v4
with:
path: |
~/.cabal/packages
~/.cabal/store
key: cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('flake.lock') }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}-${{ hashFiles('kore/kore.cabal') }}-${{ hashFiles('kore-rpc-types/kore-rpc-types.cabal') }}-${{ hashFiles('booster/hs-backend-booster.cabal') }}
restore-keys: |
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('flake.lock') }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}-${{ hashFiles('kore/kore.cabal') }}-${{ hashFiles('kore-rpc-types/kore-rpc-types.cabal') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('flake.lock') }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}-${{ hashFiles('kore/kore.cabal') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('flake.lock') }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('flake.lock') }}-${{ hashFiles('cabal.project') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('flake.lock') }}

- name: Test
run: GC_DONT_GC=1 nix develop .#cabal --command bash -c "hpack ./booster && hpack dev-tools && cabal update && cabal build all && cabal test --enable-tests --test-show-details=direct kore-test unit-tests"

cache-stack:
name: 'Cache Stack'
runs-on: ubuntu-22.04
needs: draft-release
steps:
- name: Install prerequisites
run: |
sudo apt install --yes z3 libsecp256k1-dev

- name: Check out code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache Stack root
uses: actions/cache@v4
with:
path: ~/.stack
key: stack-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('stack.yaml.lock') }}
restore-keys: |
stack-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }}
stack-${{ runner.os }}-ghc-${{ env.ghc_version }}

- uses: haskell-actions/setup@v2.7
id: setup-haskell-stack
with:
ghc-version: ${{ env.ghc_version }}
stack-version: ${{ env.stack_version }}
enable-stack: true
stack-setup-ghc: true

- name: Build all
run: |
stack build --test --no-run-tests --pedantic

- name: Run unit tests
run: stack test kore:kore-test hs-backend-booster:unit-tests

version-bump:
name: 'Version Bump'
runs-on: ubuntu-latest
needs: [cache-cabal, cache-stack]
steps:
- name: 'Check out code'
uses: actions/checkout@v4
with:
token: ${{ secrets.JENKINS_GITHUB_PAT }}
# fetch-depth 0 means deep clone the repo
fetch-depth: 0
- name: 'Update Version'
run: |
set -x
git config user.name devops
git config user.email devops@runtimeverification.com
git checkout -B release origin/release
old_master="$(git merge-base origin/master origin/release)"
new_master="$(git rev-parse origin/master)"
if git diff --exit-code ${old_master} ${new_master} -- package/version; then
git merge --no-edit origin/master
./package/version.sh bump
else
git merge --no-edit --strategy-option=theirs origin/master
fi
./package/version.sh sub
if git add --update && git commit --no-edit --allow-empty --message "Set Version: $(cat package/version)"; then
git push origin release
fi
126 changes: 32 additions & 94 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,35 @@ name: "Release"
on:
push:
branches:
- master
- release

env:
ghc_version: "9.6.5"
stack_version: "2.15.1"
hpack_version: '0.36'

jobs:
draft-release:
name: 'Draft Release'
runs-on: ubuntu-latest
steps:
- name: 'Check out code'
uses: actions/checkout@v4
- name: 'Make release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
VERSION=v$(cat package/version)
gh release create ${VERSION} \
--repo runtimeverification/haskell-backend \
--draft \
--title ${VERSION} \
--target ${{ github.sha }}

release:
name: 'Release'
needs: draft-release
runs-on: ubuntu-22.04
steps:
- name: Check out code
Expand All @@ -37,109 +56,28 @@ jobs:
- name: Build
run: nix build .#kore-exec .#kore-rpc-booster

cache-cabal:
name: 'Cache Cabal'
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-22.04
os: ubuntu-22.04
nix: x86_64-linux
- runner: MacM1
os: self-macos-12
nix: aarch64-darwin
runs-on: ${{ matrix.runner }}
steps:
- name: Check out code
uses: actions/checkout@v4
with:
submodules: recursive

# Do the Following only on Public Runners; Mac Runner is pre-installed with build tools
- name: 'Install Nix'
if: ${{ !startsWith(matrix.os, 'self') }}
uses: cachix/install-nix-action@v25
with:
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
substituters = http://cache.nixos.org https://cache.iog.io
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=

- name: 'Install Cachix'
if: ${{ !startsWith(matrix.os, 'self') }}
uses: cachix/cachix-action@v14
with:
name: k-framework
authToken: '${{ secrets.CACHIX_PUBLIC_TOKEN }}'

- name: Cache Cabal package database and store
uses: actions/cache@v4
with:
path: |
~/.cabal/packages
~/.cabal/store
key: cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('flake.lock') }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}-${{ hashFiles('kore/kore.cabal') }}-${{ hashFiles('kore-rpc-types/kore-rpc-types.cabal') }}-${{ hashFiles('booster/hs-backend-booster.cabal') }}
restore-keys: |
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('flake.lock') }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}-${{ hashFiles('kore/kore.cabal') }}-${{ hashFiles('kore-rpc-types/kore-rpc-types.cabal') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('flake.lock') }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}-${{ hashFiles('kore/kore.cabal') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('flake.lock') }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('flake.lock') }}-${{ hashFiles('cabal.project') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('flake.lock') }}

- name: Test
run: GC_DONT_GC=1 nix develop .#cabal --command bash -c "hpack ./booster && hpack dev-tools && cabal update && cabal build all && cabal test --enable-tests --test-show-details=direct kore-test unit-tests"

cache-stack:
name: 'Cache Stack'
runs-on: ubuntu-22.04
steps:
- name: Install prerequisites
run: |
sudo apt install --yes z3 libsecp256k1-dev

- name: Check out code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache Stack root
uses: actions/cache@v4
with:
path: ~/.stack
key: stack-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('stack.yaml.lock') }}
restore-keys: |
stack-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }}
stack-${{ runner.os }}-ghc-${{ env.ghc_version }}

- uses: haskell-actions/setup@v2.7
id: setup-haskell-stack
with:
ghc-version: ${{ env.ghc_version }}
stack-version: ${{ env.stack_version }}
enable-stack: true
stack-setup-ghc: true

- name: Build all
run: |
stack build --test --no-run-tests --pedantic

- name: Run unit tests
run: stack test kore:kore-test hs-backend-booster:unit-tests

update-dependents:
name: 'Publish Release'
runs-on: ubuntu-latest
environment: production
needs: [release, cache-cabal, cache-stack]
needs: release
steps:
- name: 'Finalise release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
VERSION=v$(cat package/version)
gh release edit ${VERSION} \
--repo runtimeverification/haskell-backend \
--draft=false

- name: 'Update dependents'
env:
GITHUB_TOKEN: ${{ secrets.JENKINS_GITHUB_PAT }}
run: |
set -x
version="${GITHUB_SHA}"
version="$(cat package/version)"
curl --fail \
-X POST \
-H "Accept: application/vnd.github+json" \
Expand Down
2 changes: 1 addition & 1 deletion booster/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: hs-backend-booster
version: '0.0.0'
version: '0.1.0'
github: "runtimeverification/hs-backend-booster"
license: BSD3
author: "Runtime Verification Inc"
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: hs-backend-booster-dev-tools
version: '0.0.0'
version: '0.1.0'
github: "runtimeverification/hs-backend-booster"
license: BSD3
author: "Runtime Verification Inc"
Expand Down
2 changes: 1 addition & 1 deletion kore-rpc-types/kore-rpc-types.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.2
name: kore-rpc-types
version: 0.60.0.0
version: 0.1.0
description: Please see the [README](README.md) file.
category: Language
homepage: https://github.com/runtimeverification/haskell-backend#readme
Expand Down
2 changes: 1 addition & 1 deletion kore/kore.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.2
name: kore
version: 0.60.0.0
version: 0.1.0
description: Please see the [README](README.md) file.
category: Language
homepage: https://github.com/runtimeverification/haskell-backend#readme
Expand Down
4 changes: 4 additions & 0 deletions package/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ version_bump() {
version_sub() {
local version
version="$(cat $version_file)"
sed -i "s/^version: '.*'$/version: '${version}'/" dev-tools/package.yaml
sed -i "s/^version: '.*'$/version: '${version}'/" booster/package.yaml
sed -i "s/^version: .*$/version: ${version}/" kore/kore.cabal
sed -i "s/^version: .*$/version: ${version}/" ./kore-rpc-types/kore-rpc-types.cabal
}

version_command="$1" ; shift
Expand Down