Skip to content

Commit

Permalink
add Cadence tests to CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed Mar 18, 2024
1 parent 6ae8082 commit 24c4a55
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/cadence_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

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

jobs:
tests:
name: Flow CLI Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.20.x'
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install Flow CLI
run: sh -ci "$(curl -fsSL https://raw.githubusercontent.com/onflow/flow-cli/feature/stable-cadence/install.sh)"
- name: Flow CLI Version
run: flow version
- name: Update PATH
run: echo "/root/.local/bin" >> $GITHUB_PATH
- name: Run tests
run: sh local/run_cadence_tests.sh
- name: Normalize coverage report filepaths
run : sh ./local/normalize_coverage_report.sh
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

3 changes: 3 additions & 0 deletions local/normalize_coverage_report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sed -i 's/A.0000000000000007.SerializationInterfaces/cadence\contracts\/SerializationInterfaces.cdc/' coverage.lcov
sed -i 's/A.0000000000000007.Serialize/cadence\/contracts\/utils\/Serialize.cdc/' coverage.lcov
sed -i 's/A.0000000000000007.SerializeNFT/cadence\contracts\/SerializeNFT.cdc/' coverage.lcov
1 change: 1 addition & 0 deletions local/run_cadence_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flow-c1 test --cover --covercode="contracts" --coverprofile="coverage.lcov" cadence/tests/*_tests.cdc

0 comments on commit 24c4a55

Please sign in to comment.