Skip to content

Problem: sdk v0.47.x is outdated #4830

Problem: sdk v0.47.x is outdated

Problem: sdk v0.47.x is outdated #4830

Workflow file for this run

name: Build
on:
merge_group:
pull_request:
push:
branches:
- main
- release/**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-22.11
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- id: changed-files
uses: tj-actions/changed-files@v35
with:
files: |
**/*.go
*.mod
*.sum
- uses: cachix/cachix-action@v12
if: steps.changed-files.outputs.any_changed == 'true'
with:
name: cronos
# github don't pass secrets for pull request from fork repos,
# in that case the push is disabled naturally.
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
- name: Run build
run: ./scripts/release.sh
if: steps.changed-files.outputs.any_changed == 'true'
- uses: actions/upload-artifact@v3
with:
name: "cronosd-tarball-${{ matrix.os }}"
path: "*.tar.gz"
if-no-files-found: ignore
unittest:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-22.11
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@v3
with:
go-version: '^1.20.0'
- id: changed-files
uses: tj-actions/changed-files@v35
with:
files: |
**/*.go
*.mod
*.sum
- name: test & coverage report creation
run: |
make test
# run versiondb tests
cd ./versiondb
nix-shell -I nixpkgs=../nix -p rocksdb go_1_20 --run "go test -v -mod=readonly ./... -tags rocksdb,grocksdb_clean_link -coverprofile=coverage.txt"
if: steps.changed-files.outputs.any_changed == 'true'
- name: filter out proto files
run: |
excludelist+=" $(find ./ -type f -name '*.pb.go')"
for filename in ${excludelist}; do
filename=$(echo $filename | sed 's/^./github.com\/crypto-org-chain\/cronos/g')
echo "Excluding ${filename} from coverage report..."
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
done
if: steps.changed-files.outputs.any_changed == 'true'
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.txt,./memiavl/coverage.txt,./versiondb/coverage.txt
fail_ci_if_error: true
if: steps.changed-files.outputs.any_changed == 'true'
gomod2nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: changed-files
uses: tj-actions/changed-files@v35
with:
files: |
go.mod
go.sum
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-22.11
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
if: steps.changed-files.outputs.any_changed == 'true'
- name: gomod2nix
run: nix run -f ./nix gomod2nix
if: steps.changed-files.outputs.any_changed == 'true'
- name: check working directory is clean
id: changes
run: |
set +e
(git diff --no-ext-diff --exit-code)
echo "name=changed::$?" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
if: steps.changes.outputs.changed == 1
with:
name: gomod2nix.toml
path: ./gomod2nix.toml
- if: steps.changes.outputs.changed == 1
run: echo "Working directory is dirty" && exit 1
contracts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: changed-files
uses: tj-actions/changed-files@v35
with:
files: |
contracts
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-22.11
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
if: steps.changed-files.outputs.any_changed == 'true'
- uses: cachix/cachix-action@v12
if: steps.changed-files.outputs.any_changed == 'true'
with:
name: cronos
extraPullNames: dapp
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
- name: test contracts
if: steps.changed-files.outputs.any_changed == 'true'
run: make test-cronos-contracts
- name: build contracts
if: steps.changed-files.outputs.any_changed == 'true'
run: make gen-cronos-contracts
- name: check working directory is clean
id: changes
run: |
set +e
(git diff --no-ext-diff --exit-code)
echo "name=changed::$?" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
if: steps.changes.outputs.changed == 1
with:
name: contracts_out
path: ./contracts/out
if-no-files-found: ignore
- if: steps.changes.outputs.changed == 1
run: echo "Working directory is dirty" && exit 1