Skip to content

Commit

Permalink
Bootstrap in stages
Browse files Browse the repository at this point in the history
This requires the `bootstrap/1` tag, which we have to fetch explicitly
on the test runners (see
actions/checkout#701).
  • Loading branch information
antroseco committed Aug 28, 2023
1 parent 708e548 commit b18eea0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/graphene_tests.yml
Expand Up @@ -38,6 +38,8 @@ jobs:
sudo ./llvm.sh ${{ matrix.llvm-version }}
sudo apt-get install -y llvm-${{ matrix.llvm-version }}-runtime
- name: Bootstrap the parser
run: ./bootstrap.sh
run: |
git fetch --tags origin
./bootstrap.sh
- name: Run tests
run: python tests/run_tests.py
17 changes: 16 additions & 1 deletion bootstrap.sh
@@ -1,4 +1,19 @@
#!/usr/bin/env bash

# Atm this is easy... it becomes harder once we remove lark
set -ex

# Attempt to get the current location. Prefer a branch name if available,
# otherwise fall back to the current commit's hash if we are in "detached HEAD"
# state.
git_location=$(git branch --show)
if [[ "$git_location" == "" ]]; then
git_location=$(git rev-parse HEAD)
fi

# Stage 1; last commit where the Lark parser can parse the native parser.
git checkout bootstrap/1
./glang ./parser/parser.c3 -o ./parser/parser --bootstrap -O3

# Stage 2; build native parser at current commit
git checkout "$git_location"
./glang ./parser/parser.c3 -o ./parser/parser -O3

0 comments on commit b18eea0

Please sign in to comment.