Skip to content

Commit

Permalink
Add CI (#7)
Browse files Browse the repository at this point in the history
* Add CI

* Fix yml

* Change job name

* Failing test

* Revert "Failing test"

This reverts commit f1a51cc.

* Fix check_fmt script

* Failing format

* Revert "Failing format"

This reverts commit 0ea0f00.
  • Loading branch information
jrchatruc authored Jul 10, 2023
1 parent 86e7a2b commit 602306e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test/Fmt

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test_and_format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.19

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: build
run: make build

- name: test
run: make test

- name: format
run: make check_fmt
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: run
.PHONY: run fmt check_fmt

run:
@go run cmd/cli/main.go
Expand All @@ -10,3 +10,9 @@ build:
@cd pkg/lambdaworks/lib/lambdaworks && cargo build --release
@cp pkg/lambdaworks/lib/lambdaworks/target/release/liblambdaworks.a pkg/lambdaworks/lib
@go build ./...

fmt:
gofmt -w pkg

check_fmt:
./check_fmt.sh
9 changes: 9 additions & 0 deletions check_fmt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

files=$(gofmt -l pkg)
if [[ $files ]]; then
echo -e "Some files are not correctly formatted:\n${files}"
exit 1
else
exit 0
fi

0 comments on commit 602306e

Please sign in to comment.