Skip to content

Commit

Permalink
Rename a few file paths (#4)
Browse files Browse the repository at this point in the history
* slight code reorganization

* fix a few paths

* ci

* more ci

* fix distro

* try to fix docker image
  • Loading branch information
dwightguth authored Aug 16, 2024
1 parent 48b0e08 commit e796764
Show file tree
Hide file tree
Showing 13 changed files with 115 additions and 6 deletions.
64 changes: 64 additions & 0 deletions .github/actions/with-docker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: 'With Docker'
description: 'Run a given stage with Docker Image'
inputs:
container-name:
description: 'Docker container name to use'
type: string
required: true
tag-name:
description: 'Docker image tag to use'
type: string
required: false
default: runtimeverificationinc/kevm
subdir:
description: 'Subdirectory where code is cloned.'
required: false
type: string
default: './'
dockerfile:
description: 'Hardcode the path of the dockerfile to use.'
required: false
type: string
default: '.github/workflows/Dockerfile'
runs:
using: 'composite'
steps:
- name: 'Set up Docker'
shell: bash {0}
run: |
set -euxo pipefail
CONTAINER_NAME=${{ inputs.container-name }}
SUBDIR=${{ inputs.subdir }}
BASE_OS=${{ inputs.os }}
BASE_DISTRO=${{ inputs.distro }}
DOCKERFILE=${{ inputs.dockerfile }}
LLVM_VERSION=${{ inputs.llvm }}
TAG_NAME=${{ inputs.tag-name }}
USER=github-user
GROUP=${USER}
K_VERSION=$(cat deps/k_release)
USER_ID=1000
GROUP_ID=${USER_ID}
docker build . --file ${DOCKERFILE} \
--tag ${TAG_NAME} \
--build-arg USER_ID=${USER_ID} \
--build-arg GROUP_ID=${GROUP_ID} \
--build-arg USER=${USER} \
--build-arg GROUP=${GROUP} \
--build-arg K_VERSION=${K_VERSION} \
docker run \
--name ${CONTAINER_NAME} \
--rm \
--interactive \
--tty \
--detach \
--user root \
--workdir /home/${USER}/workspace \
${TAG_NAME}
docker cp . ${CONTAINER_NAME}:/home/${USER}/workspace
docker exec ${CONTAINER_NAME} chown -R ${USER}:${GROUP} /home/${USER}
14 changes: 14 additions & 0 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ARG K_VERSION
FROM runtimeverificationinc/kframework-k:ubuntu-jammy-${K_VERSION}

ARG USER=user
ARG GROUP
ARG USER_ID
ARG GROUP_ID
RUN groupadd -g ${GROUP_ID} ${GROUP} && useradd -m -u ${USER_ID} -s /bin/sh -g ${GROUP} ${USER}

USER ${USER}:${GROUP}
RUN mkdir /home/${USER}/workspace
WORKDIR /home/${USER}/workspace

ENV PATH=/home/${USER}/.local/bin:${PATH}
29 changes: 29 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 'Test PR'
on:
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

test:
name: 'Conformance Tests'
runs-on: [self-hosted, linux, normal]
steps:
- name: 'Check out code'
uses: actions/checkout@v4
- name: 'Set up Docker'
uses: ./.github/actions/with-docker
with:
container-name: solidity-ci-${{ github.sha }}
- name: 'Build semantics'
run: docker exec -u github-user solidity-ci-${{ github.sha }} /bin/bash -c 'make build-bison'
- name: 'Test parsing'
run: docker exec -u github-user solidity-ci-${{ github.sha }} /bin/bash -c 'make test-bison'
- name: 'Tear down Docker'
if: always()
run: |
docker stop --time=0 solidity-ci-${{ github.sha }}
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
SYNTAX_DIR = solidity-lite-syntax
EXAMPLES_DIR = $(SYNTAX_DIR)/examples
SEMANTICS_DIR = src
TEST_DIR = test
EXAMPLES_DIR = $(TEST_DIR)/examples
SYNTAX_FILE_NAME = solidity-syntax
SYNTAX_FILE = $(SYNTAX_FILE_NAME).md
MAIN_MODULE = SOLIDITY
Expand All @@ -13,11 +14,11 @@ LIDO_PARAMS = $(EXAMPLES_DIR)/staking/LidoStaking.sol 2>&1 1>$(OUTPUT_DIR)/lidos
LENDINGPOOL_PARAMS = $(EXAMPLES_DIR)/lending/LendingPool.sol 2>&1 1>$(OUTPUT_DIR)/lendingpool.ast
AAVE_PARAMS = $(EXAMPLES_DIR)/lending/AaveLendingPool.sol 2>&1 1>$(OUTPUT_DIR)/aave.ast

build: $(SYNTAX_DIR)/$(SYNTAX_FILE)
kompile $(SYNTAX_DIR)/$(SYNTAX_FILE) --main-module $(MAIN_MODULE)
build: $(SEMANTICS_DIR)/$(SYNTAX_FILE)
kompile $(SEMANTICS_DIR)/$(SYNTAX_FILE) --main-module $(MAIN_MODULE)

build-bison: $(SYNTAX_DIR)/$(SYNTAX_FILE)
kompile $(SYNTAX_DIR)/$(SYNTAX_FILE) --main-module $(MAIN_MODULE) --gen-glr-bison-parser
build-bison: $(SEMANTICS_DIR)/$(SYNTAX_FILE)
kompile $(SEMANTICS_DIR)/$(SYNTAX_FILE) --main-module $(MAIN_MODULE) --gen-glr-bison-parser

clean:
rm -Rf $(SYNTAX_FILE_NAME)-kompiled
Expand Down
1 change: 1 addition & 0 deletions deps/k_release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.1.110
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit e796764

Please sign in to comment.