Skip to content

first draft full repo readme via ai #864

first draft full repo readme via ai

first draft full repo readme via ai #864

Workflow file for this run

name: "CI"
on: # Run the workflows on push/PR to the main branch
push:
branches: [main,monorepo]
pull_request:
branches: [main,monorepo]
jobs:
lint: # Run lint script for all workspaces
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16.15.0"
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run lint script
run: npm run lint
build: # Run build script for all workspaces
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16.15.0"
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run build script
run: npm run build
test-datalock-chaincode: # Run chaincode tests for the chaincode/datalock directory
runs-on: ubuntu-latest
needs: lint
defaults:
run:
working-directory: ./fabric/chaincode/datalock
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.18"
- name: Run chaincode tests
run: go test -v internal/*.go -count=1
test-hardhat: # Run tests for the hardhat directory
runs-on: ubuntu-latest
needs: lint
services:
postgres:
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: blockchain-carbon-accounting-test
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16.15.0"
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run data tests
run: npm run test --prefix ./data
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
- name: Run hardhat tests
run: npm run test --prefix ./hardhat
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
test-typescript-app: # Build and test the typescript_app project
runs-on: ubuntu-latest
needs: lint
services:
postgres:
image: postgres:latest
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: blockchain-carbon-accounting-test
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16.15.0"
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Download Fabric binaries
run: |
sudo chmod +x /usr/local/bin/docker-compose
cd ./fabric/docker-compose-setup/
./bootstrap.sh 2.4.2 1.5.2 -d -s
- name: Start local Hardhat network # Start local Hardhat network needed for running net emissions token network
run: |
cd ./hardhat/
echo "n" | npx hardhat node &
- name: Build emissions-data project # Add required hostnames to /etc/hosts and runs start script
run: |
cd ./fabric/docker-compose-setup/
echo "127.0.0.1 auditor1.carbonAccounting.com
127.0.0.1 auditor2.carbonAccounting.com
127.0.0.1 peer1.auditor1.carbonAccounting.com
127.0.0.1 peer1.auditor2.carbonAccounting.com
127.0.0.1 peer1.auditor1.carbonAccounting.com" | sudo tee -a /etc/hosts
DB_HOST=postgres ./startDev.sh &
- name: Run tests # Wait for the blockchain network to start up and then run the tests
run: |
cd ./fabric/typescript_app/
while ! timeout 1 bash -c "echo > /dev/tcp/localhost/8080" > /dev/null 2>&1; do sleep 10; done
npm run test:setup
npm run test:ci
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
- name: Collect Docker Logs
if: failure()
uses: jwalton/[email protected]
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: test-results
path: fabric/typescript_app/test-results.json