Skip to content

Commit

Permalink
add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBger committed Sep 5, 2024
1 parent 6fe6ce5 commit e95c7f6
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build and Test

on:
push:
branches:
- develop
- "codegen-cmd"
pull_request:
branches:
- "**"

jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
if: "${{ !startsWith(github.event.head_commit.message, 'GitBook: [#') }}"
strategy:
matrix:
go-version: [ 1.21.x ]
os: [ubuntu-latest, macos-latest]
env:
TEST_LOCAL_CODEGEN: "true",
RUN_INTEGRATION_TESTS: "true",
CODEGEN_MAINNET_API_KEY: ${{ secrets.CODEGEN_MAINNET_API_KEY }},
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

- name: Check out code
uses: actions/checkout@v3

- name: Cache Go modules
uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run Tests
run: go test ./...

- name: Build
run: go build ./...
4 changes: 2 additions & 2 deletions tests/evm-minimal/generator.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

{
"generator": "evm-minimal",
"state": {
"name": "my_project",
"chainName": "mainnet",
"initialBlockSet": true
}
}
}
4 changes: 3 additions & 1 deletion tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ func TestIntegration(t *testing.T) {
name string
stateFile string
explorerApiKeyEnvName string
apiKeyNeeded bool
}{
{
name: "evm-events-calls",
stateFile: "./evm-events-calls/generator.json",
explorerApiKeyEnvName: "CODEGEN_MAINNET_API_KEY",
apiKeyNeeded: true,
},
{
name: "evm-minimal",
Expand Down Expand Up @@ -103,7 +105,7 @@ func TestIntegration(t *testing.T) {
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
explorerApiKey := os.Getenv(c.explorerApiKeyEnvName)
if explorerApiKey == "" {
if explorerApiKey == "" && c.apiKeyNeeded {
fmt.Printf("NO %s has been provided, please make sure to provide it to enable code generation...", c.explorerApiKeyEnvName)
}

Expand Down

0 comments on commit e95c7f6

Please sign in to comment.