Skip to content

Commit

Permalink
Add CI (#61)
Browse files Browse the repository at this point in the history
* Fix syscall id

* Add CI

* Remove build status
  • Loading branch information
XuJiandong authored May 21, 2024
1 parent 2b850ff commit d7dc1e3
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 3 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CI

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Update submodules
run: git submodule update --init
- name: Build contract
run: make all-via-docker
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ Module.symvers
Mkfile.old
dkms.conf
simulator/build.simulator

tests/ci
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,23 @@ AR := riscv64-unknown-elf-ar
LIB := libdummylibc.a
CFLAGS := -Wall -Werror -Wextra -Wno-unused-parameter -Wno-dangling-pointer -Wno-nonnull -Wno-nonnull-compare -fno-builtin-printf -fno-builtin-memcmp -O3 -g -fdata-sections -ffunction-sections

LDFLAGS := -nostdlib -nostartfiles -Wl,-static -Wl,--gc-sections
EXTRA := -I . -I libc -I molecule -Wno-unused-function

# nervos/ckb-riscv-gnu-toolchain:jammy-20230214
BUILDER_DOCKER := nervos/ckb-riscv-gnu-toolchain@sha256:d175f4a766b4b17a44bd9bbeca8e24ab2427ba615738016dc49e194046e6b28b


default: fmt

all-via-docker:
docker run -u $(shell id -u):$(shell id -g) --rm -v `pwd`:/code ${BUILDER_DOCKER} bash -c "cd /code && make all"

all: tests/ci

tests/ci: tests/ci.c
$(CC) $(CFLAGS) $(EXTRA) $(LDFLAGS) -o $@ $<

fmt:
clang-format -i -style=Google $(wildcard *.h */*.h *.c */*.c libc/*.h libc/src/*.c)
git diff --exit-code
Expand All @@ -17,5 +32,6 @@ impl.o: libc/src/impl.c

clean:
rm -rf $(LIB) impl.o
rm tests/ci

.PHONY: clean default fmt
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# ckb-c-stdlib

[![Build Status](https://travis-ci.com/nervosnetwork/ckb-c-stdlib.svg?branch=master)](https://travis-ci.com/nervosnetwork/ckb-c-stdlib)

In the development of CKB scripts, we discovered many use-cases and patterns that could be really useful in writing CKB scripts. This repo serves as a commonplace for all those useful scripts. This could include but aren't limit to:

* CKB's data structure definitions
Expand Down
2 changes: 1 addition & 1 deletion ckb_consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define SYS_ckb_pipe 2604
#define SYS_ckb_write 2605
#define SYS_ckb_read 2606
#define SYS_ckb_inherited_fd 607
#define SYS_ckb_inherited_fd 2607
#define SYS_ckb_close 2608

#define CKB_SUCCESS 0
Expand Down
31 changes: 31 additions & 0 deletions tests/ci.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <stdint.h>
#include <limits.h>
#include <memory.h>
#include <stdarg.h>
#include <stddef.h>

#include "blake2b.h"
#include "ckb_consts.h"
#include "ckb_dlfcn.h"
#include "ckb_exec.h"
#include "ckb_keccak256.h"
#include "ckb_streaming.h"
#include "ckb_swappable_signatures.h"
#include "ckb_syscall_apis.h"
#include "ckb_syscalls.h"
#include "ckb_type_id.h"
#include "ckb_utils.h"
#define MOL2_EXIT ckb_exit
#include "blockchain.h"
#include "blockchain-api2.h"
#include "molecule_reader.h"
#include "molecule2_reader.h"
#include "molecule_builder.h"

int main(int argc, const char* argv[]) {
return 0;
}

0 comments on commit d7dc1e3

Please sign in to comment.