Skip to content

Commit

Permalink
Add nightly scheduled build of saw-script (#889)
Browse files Browse the repository at this point in the history
* Add nightly scheduled build of saw-script
* Build cryptol correctly
* Don't mask build failures
* Continue on error for all tests for now
* Use release file structure for nightlies
* Remove docker layer caching
  • Loading branch information
Jared Weakly authored Nov 24, 2020
1 parent d521320 commit 27d6f2d
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 23 deletions.
27 changes: 16 additions & 11 deletions .github/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mkdir -p "$BIN"
is_exe() { [[ -x "$1/$2$EXT" ]] || command -v "$2" > /dev/null 2>&1; }

extract_exe() {
exe="$(find dist-newstyle -type f -name "$1$EXT")"
exe="$(find "${3:-dist-newstyle}" -type f -name "$1$EXT")"
name="$(basename "$exe")"
echo "Copying $name to $2"
mkdir -p "$2"
Expand Down Expand Up @@ -38,7 +38,7 @@ retry() {
}

setup_dist_bins() {
if $IS_WIN ; then
if $IS_WIN; then
is_exe "dist/bin" "saw" && is_exe "dist/bin" "saw-remote-api" && return
else
is_exe "dist/bin" "saw" && is_exe "dist/bin" "saw-remote-api" && is_exe "dist/bin" "jss" && return
Expand All @@ -47,7 +47,7 @@ setup_dist_bins() {
extract_exe "saw" "dist/bin"
extract_exe "saw-remote-api" "dist/bin"
export PATH=$PWD/dist/bin:$PATH
echo "$PWD/dist/bin" >> $GITHUB_PATH
echo "$PWD/dist/bin" >> "$GITHUB_PATH"
strip dist/bin/saw* || echo "Strip failed: Ignoring harmless error"
strip dist/bin/jss* || echo "Strip failed: Ignoring harmless error"
}
Expand Down Expand Up @@ -123,19 +123,23 @@ build() {
cp cabal.GHC-"$ghc_ver".config cabal.project.freeze
cabal v2-update
echo "allow-newer: all" >> cabal.project.local
pkgs=(saw saw-remote-api)
if $IS_WIN; then
echo "flags: -builtin-abc" >> cabal.project.local
echo "constraints: jvm-verifier -builtin-abc, cryptol-saw-core -build-css" >> cabal.project.local
pkgs="saw saw-remote-api"
else
pkgs="jss saw saw-remote-api"
pkgs+=(jss)
fi
echo "allow-newer: all" >> cabal.project.local
tee -a cabal.project > /dev/null < cabal.project.ci
if ! retry cabal v2-build "$@" $pkgs && [[ "$RUNNER_OS" == "macOS" ]]; then
echo "Working around a dylib issue on macos by removing the cache and trying again"
cabal v2-clean
retry cabal v2-build "$@" $pkgs
if ! retry cabal v2-build "$@" "${pkgs[@]}"; then
if [[ "$RUNNER_OS" == "macOS" ]]; then
echo "Working around a dylib issue on macos by removing the cache and trying again"
cabal v2-clean
retry cabal v2-build "$@" "${pkgs[@]}"
else
return 1
fi
fi
}

Expand All @@ -158,7 +162,7 @@ install_system_deps() {
install_yasm &
wait
export PATH=$PWD/$BIN:$PATH
echo "$PWD/$BIN" >> $GITHUB_PATH
echo "$PWD/$BIN" >> "$GITHUB_PATH"
is_exe "$BIN" z3 && is_exe "$BIN" cvc4 && is_exe "$BIN" yices && is_exe "$BIN" yasm
}

Expand All @@ -173,6 +177,7 @@ test_dist() {
build_cryptol() {
is_exe "dist/bin" "cryptol" && return
pushd deps/cryptol
git submodule update --init
.github/ci.sh build
popd
}
Expand All @@ -198,7 +203,7 @@ find_java() {
javac PropertiesTest.java
RT_JAR="$(java PropertiesTest | tr : '\n' | grep rt.jar | head -n 1)"
export RT_JAR
echo "RT_JAR=$RT_JAR" >> $GITHUB_ENV
echo "RT_JAR=$RT_JAR" >> "$GITHUB_ENV"
rm PropertiesTest.class
popd
}
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ jobs:
matrix:
os: [ubuntu-latest]
ghc: ["8.6.5", "8.8.4"]
continue-on-error: [false]
continue-on-error: [true]
include:
- os: macos-latest
ghc: "8.6.5"
continue-on-error: true
- os: macos-latest
ghc: "8.8.4"
continue-on-error: true
- os: windows-latest
ghc: "8.8.4"
continue-on-error: true
- os: windows-latest
ghc: "8.6.5"
continue-on-error: true
Expand All @@ -58,7 +61,7 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: "3.x"

- shell: bash
run: pip3 install virtualenv
Expand All @@ -74,16 +77,17 @@ jobs:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/cabal.GHC-*') }}-${{ github.sha }}
key: cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc)) }}-${{ github.sha }}
restore-keys: |
cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/cabal.GHC-*') }}-
cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc)) }}-
- shell: bash
run: .github/ci.sh build_abc
if: runner.os != 'Windows'

- shell: bash
run: .github/ci.sh build
continue-on-error: false

- shell: bash
run: .github/ci.sh install_system_deps
Expand All @@ -96,8 +100,8 @@ jobs:
run: .github/ci.sh setup_dist_bins

- shell: bash
# TODO: change this once we can get these tests working in CI
continue-on-error: true
id: cabal-test
continue-on-error: ${{ matrix.continue-on-error }}
run: cabal v2-test saw-remote-api
env:
SAW_SERVER: ${GITHUB_WORKSPACE}/dist/bin/saw-remote-api
Expand All @@ -119,8 +123,7 @@ jobs:
env.RELEASE && matrix.ghc == '8.8.4'
run: |
.github/ci.sh build_cryptol
exe="$(cd deps/cryptol && cabal exec which cryptol)"
cp "$exe" "dist/bin"
.github/ci.sh extract_exe "cryptol" "dist/bin" "deps/cryptol/dist-newstyle"
- if: >-
env.RELEASE && matrix.ghc == '8.8.4'
Expand All @@ -137,7 +140,7 @@ jobs:
path: "dist/bin/saw"

- shell: bash
if: "steps.test.outcome == 'failure'"
if: "steps.test.outcome == 'failure' || steps.cabal-test.outcome == 'failure'"
name: Warn if tests failed
run: echo "::error ::Test Suite Failed. Pipeline allowed to pass until tests are reliable."

Expand All @@ -150,8 +153,6 @@ jobs:
- run: |
git submodule update --init
git -C deps/abcBridge submodule update --init
- uses: satackey/[email protected]
continue-on-error: true
- name: Publish to Registry
uses: docker/build-push-action@v1
with:
Expand Down Expand Up @@ -226,7 +227,6 @@ jobs:
run: .github/ci.sh bundle_files

- shell: bash
continue-on-error: true # temporary to test release without setting up secrets
env:
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
Expand Down
100 changes: 100 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Nightly Builds
on:
push:
branches: ["actions/**"]
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
outputs:
runs-on: ubuntu-latest
outputs:
saw-version: ${{ steps.saw.outputs.saw-version }}
name: ${{ steps.saw.outputs.name }}
steps:
- uses: actions/checkout@v2
- id: saw
run: |
.github/ci.sh set_version
.github/ci.sh output name saw-$(.github/ci.sh ver)-$(date -I)
docker:
runs-on: ubuntu-latest
needs: [outputs]
continue-on-error: true
steps:
- uses: actions/checkout@v2
with:
submodules: true
- run: git -C deps/abcBridge submodule update --init
- name: Publish to Registry
uses: docker/build-push-action@v1
with:
username: ${{ secrets.GITHUBSAW_USERNAME }}
password: ${{ secrets.GITHUBSAW }}
repository: galoisinc/saw
tags: "nightly"
add_git_labels: true
push: ${{ github.event_name == 'schedule' }}

build:
needs: [outputs]
runs-on: ${{ matrix.os }}
env:
VERSION: ${{ needs.outputs.outputs.saw-version }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
ghc: [8.8.4]
continue-on-error: true
steps:
- uses: actions/checkout@v2
with:
submodules: true
- run: git -C deps/abcBridge submodule update --init

- uses: actions/setup-haskell@v1
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}

- uses: actions/cache@v2
name: Cache cabal store
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc)) }}-${{ github.sha }}
restore-keys: |
cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc)) }}-
- shell: bash
run: .github/ci.sh build_abc
if: runner.os != 'Windows'

- shell: bash
run: .github/ci.sh build

- shell: bash
run: .github/ci.sh setup_dist_bins

- shell: bash
run: |
.github/ci.sh build_cryptol
.github/ci.sh extract_exe "cryptol" "dist/bin" "deps/cryptol/dist-newstyle"
- shell: bash
run: .github/ci.sh bundle_files

- shell: bash
env:
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
name: ${{ needs.outputs.outputs.name }}-${{ runner.os }}-x86_64
run: .github/ci.sh zip_dist

- uses: actions/upload-artifact@v2
with:
name: ${{ needs.outputs.outputs.name }}-${{ runner.os }}-x86_64
path: "${{ needs.outputs.outputs.name }}-${{ runner.os }}-x86_64.tar.gz*"
2 changes: 2 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ packages:
deps/argo/tasty-script-exitcode
deps/argo/python
deps/cryptol/cryptol-remote-api

allow-newer: uuid:random

0 comments on commit 27d6f2d

Please sign in to comment.