Skip to content

remove rosette from btor #916

remove rosette from btor

remove rosette from btor #916

name: Run checks
on:
push:
branches: [main]
pull_request:
branches: [main]
# Run at 4am PT each day.
schedule:
- cron: "0 11 * * *"
# Allow manual trigger.
workflow_dispatch:
env:
REGISTRY: ghcr.io
# Can't use ${{ env.REGISTRY }} here, but would like to, so that we' don't
# repeat ghcr.io.
IMAGE_TAG: ghcr.io/${{ github.repository }}:sha-${{ github.sha }}
jobs:
# Job which cleans up GitHub Actions workspace. This is only needed when
# running on self-hosted runners.
#
# TODO(@gussmith23) It would be nice if this wasn't necessary. We could use
# this: https://docs.github.com/en/actions/hosting-your-own-runners/running-scripts-before-or-after-a-job
cleaner:
runs-on: self-hosted
steps:
- name: Clean up previous runs
run: rm -rf "${{ github.workspace }}"
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# If we want to do this more cleanly, we can use metadata-action.
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
# with:
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ env.IMAGE_TAG }}
cache-to: type=gha,mode=max
cache-from: type=gha
# This can be run on ubuntu-latest (i.e., on GitHub's provided runners), but
# it will be much slower. Specifically, our end-to-end tests using Verilator
# take advantage of the many threads on our machines, whereas the GitHub
# machines only have two threads.
#
# Perhaps we should run this on both?
run-tests:
runs-on: self-hosted
needs: [build-and-push-image, cleaner]
steps:
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull image
run: docker pull ${{ env.IMAGE_TAG }}
- name: Run tests
run: docker run ${{ env.IMAGE_TAG }} bash run-tests.sh
check-format:
runs-on: ubuntu-latest
needs: build-and-push-image
steps:
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull image
run: docker pull ${{ env.IMAGE_TAG }}
- name: Racket format check
run: |
docker run ${{ env.IMAGE_TAG }} \
bash -c 'raco fmt -i racket/*.rkt && git diff && [ -z "$(git status --porcelain)" ]'
- name: Rust format check
run: docker run ${{ env.IMAGE_TAG }} cargo fmt --manifest-path ./rust/Cargo.toml -- --check