Skip to content

Commit

Permalink
Chore/alpha.7 (keep-starknet-strange#74)
Browse files Browse the repository at this point in the history
## Pull Request type


Please check the type of change your PR introduces:

- [ ] Bugfix
- [ ] Feature
- [x] Code style update (formatting, renaming)
- [x] Refactoring (no functional changes, no API changes)
- [ ] Build-related changes
- [ ] Documentation content changes
- [ ] Other (please describe):

## Sum up

Updating the repo to alpha.7.   
This introduces a lot of changes:
 - Removing turbofish syntax
 - use [] instead of at
 - Loop where possible
- updated the CI not to use the manually triggered artifacts but the
official releases
 - updated the makefile related to SW changes in the CLI
 - use of integer inference where possible
 - ran the formatter (and added it to CI)

There are still some improvements possible but those can be done later
in a subsequent PR not to block the upgrade for too long .

This should solve 
keep-starknet-strange#73
Fixes keep-starknet-strange#73
  • Loading branch information
gaetbout authored Apr 18, 2023
1 parent 4c93251 commit ae4d54b
Show file tree
Hide file tree
Showing 30 changed files with 697 additions and 825 deletions.
69 changes: 38 additions & 31 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,53 @@ name: test
on: [push, pull_request]

env:
CAIRO_COMPILER_VERSION: 1.0.0-alpha.3
# Temporary use artifacts from custom CI build
ARTIFACT_RELEASE_ARCHIVE_LINK: https://api.github.com/repos/starkware-libs/cairo/actions/artifacts/609478476/zip
ARTIFACT_RELEASE_ARCHIVE_NAME: cairo.zip
RELEASE_ARCHIVE_NAME: x86_64-unknown-linux-musl.tar.gz
CAIRO_COMPILER_VERSION: 1.0.0-alpha.7
ARCHIVE_LINK: https://github.com/starkware-libs/cairo/releases/download/v1.0.0-alpha.7/release-x86_64-unknown-linux-musl.tar.gz
ARCHIVE_NAME: cairo.zip

jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
curl -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -L -o $ARTIFACT_RELEASE_ARCHIVE_NAME $ARTIFACT_RELEASE_ARCHIVE_LINK
unzip $ARTIFACT_RELEASE_ARCHIVE_NAME
tar -xvf $RELEASE_ARCHIVE_NAME
export PATH=$PATH:$(pwd)/cairo/bin
make build
- name: Step 1 - Check out main branch
uses: actions/checkout@v3
- name: Step 2 - Downloading binaries
run: curl -L -o $ARCHIVE_NAME $ARCHIVE_LINK
- name: Step 3 - Unzipping binaries
run: tar -xvf $ARCHIVE_NAME
- name: Step 4 - Make binaries available
run: echo "./cairo/bin" >> $GITHUB_PATH
- name: Step 5 - Trying to build
run: make build

run:
name: run
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
curl -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -L -o $ARTIFACT_RELEASE_ARCHIVE_NAME $ARTIFACT_RELEASE_ARCHIVE_LINK
unzip $ARTIFACT_RELEASE_ARCHIVE_NAME
tar -xvf $RELEASE_ARCHIVE_NAME
export PATH=$PATH:$(pwd)/cairo/bin
# TODO: uncomment when demo is ready
#make run
- name: Step 1 - Check out main branch
uses: actions/checkout@v3
- name: Step 2 - Downloading binaries
run: curl -L -o $ARCHIVE_NAME $ARCHIVE_LINK
- name: Step 3 - Unzipping binaries
run: tar -xvf $ARCHIVE_NAME
- name: Step 4 - Make binaries available
run: echo "./cairo/bin" >> $GITHUB_PATH
- name: Step 5 - Running tests
run: make test

test:
name: test
check-format:
name: check-format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
curl -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -L -o $ARTIFACT_RELEASE_ARCHIVE_NAME $ARTIFACT_RELEASE_ARCHIVE_LINK
unzip $ARTIFACT_RELEASE_ARCHIVE_NAME
tar -xvf $RELEASE_ARCHIVE_NAME
export PATH=$PATH:$(pwd)/cairo/bin
make test
- name: Step 1 - Check out main branch
uses: actions/checkout@v3
- name: Step 2 - Downloading binaries
run: curl -L -o $ARCHIVE_NAME $ARCHIVE_LINK
- name: Step 3 - Unzipping binaries
run: tar -xvf $ARCHIVE_NAME
- name: Step 4 - Make binaries available
run: echo "./cairo/bin" >> $GITHUB_PATH
- name: Step 5 - Checking formatting
run: make check-format

24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.PHONY: default

# Configuration
ROOT_PROJECT = .
PROJECT_NAME = quaireaux
ENTRYPOINT = .
TEST_ENTRYPOINT = .
BUILD_DIR = build

# Default target
Expand All @@ -24,40 +23,45 @@ build: FORCE
run:
@echo "Running..."
# TODO: enable when sample main is ready
#cairo-run -p $(ENTRYPOINT)
#cairo-run $(ROOT_PROJECT)

# Test the project
test:
@echo "Testing everything..."
cairo-test -p $(TEST_ENTRYPOINT)
cairo-test $(ROOT_PROJECT)

test-data_structures:
@echo "Testing data structures..."
cairo-test -p $(TEST_ENTRYPOINT)/quaireaux/data_structures
cairo-test $(PROJECT_NAME)/data_structures

test-math:
@echo "Testing math"
cairo-test -p $(TEST_ENTRYPOINT)/quaireaux/math
cairo-test $(PROJECT_NAME)/math

test-sorting:
@echo "Testing sorting..."
cairo-test -p $(TEST_ENTRYPOINT)/quaireaux/sorting
cairo-test $(PROJECT_NAME)/sorting

test-utils:
@echo "Testing utils..."
cairo-test -p $(TEST_ENTRYPOINT)/quaireaux/utils
cairo-test $(PROJECT_NAME)/utils

# Special filter tests targets

# Run tests related to the stack
test-stack:
@echo "Testing stack..."
cairo-test -p $(TEST_ENTRYPOINT) -f stack
cairo-test $(PROJECT_NAME) -f stack

# Format the project
format:
@echo "Formatting everything..."
cairo-format --recursive quaireaux
cairo-format --recursive --print-parsing-errors $(ROOT_PROJECT)

# Check the formatting of the project
check-format:
@echo "Checking formatting..."
cairo-format --recursive --check $(ROOT_PROJECT)

# Clean the project
clean:
Expand Down
Loading

0 comments on commit ae4d54b

Please sign in to comment.