Skip to content

Fix: Update Naming

Fix: Update Naming #29

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-test:
name: Build & Test (${{ matrix.os }})
permissions:
contents: read
packages: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest-l, windows-latest-l]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
# SonarCloud needs the parent branch information.
fetch-depth: 0
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Set up Rust
uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621 # v1
- name: Cache wasm build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
.wasm-build
key: wasm-${{ runner.os }}-${{ hashFiles('scripts/build-wasm.sh', 'scripts/fetch-crate.sh', 'scripts/pins.env', 'rust-toolchain.toml') }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://npm.pkg.github.com
scope: "@keetanetwork"
- name: Build wasm core
shell: bash
run: bash scripts/build-wasm.sh
- name: Build node harness
shell: bash
run: npm ci --ignore-scripts && npm rebuild sqlite3 && npm run build
working-directory: tests/node-harness
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Restore
run: dotnet restore KeetaNet.Anchor.slnx
- name: Build
run: dotnet build KeetaNet.Anchor.slnx -c Release --no-restore
- name: Test
run: >
dotnet test KeetaNet.Anchor.slnx -c Release --no-build
-- --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml
# Run SonarCloud on the coverage this test run
- name: Convert coverage to SonarQube format
if: matrix.os == 'ubuntu-latest-l' && github.repository == 'KeetaNetwork/anchor-csharp'
run: |
dotnet tool install --global dotnet-reportgenerator-globaltool
reportgenerator \
"-reports:**/TestResults/**/coverage.cobertura.xml" \
"-targetdir:.sonar-coverage" \
"-reporttypes:SonarQube"
- name: SonarCloud Scan
if: matrix.os == 'ubuntu-latest-l' && github.repository == 'KeetaNetwork/anchor-csharp'
uses: SonarSource/sonarqube-scan-action@689fb39b34b9aa95ebc5f8f119343ddd51542402 # v4.2.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dproject.settings=./sonar-project.properties
lint:
name: Lint
runs-on: ubuntu-latest-l
permissions:
contents: read
packages: read
steps:
- uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://npm.pkg.github.com
scope: "@keetanetwork"
- name: Check formatting and linting
run: make do-lint-ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pack:
name: Pack
runs-on: ubuntu-latest-l
steps:
- uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Set up Rust
uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621 # v1
- name: Cache wasm build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
.wasm-build
key: wasm-${{ runner.os }}-${{ hashFiles('scripts/build-wasm.sh', 'scripts/fetch-crate.sh', 'scripts/pins.env', 'rust-toolchain.toml') }}
- name: Build wasm core
run: bash scripts/build-wasm.sh
- name: Pack
run: dotnet pack KeetaNet.Anchor.slnx -c Release -o artifacts
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: nupkg
path: artifacts/*.*nupkg
security:
name: Security Audit
runs-on: ubuntu-latest-l
steps:
- uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Restore
run: dotnet restore KeetaNet.Anchor.slnx
- name: Audit dependencies
run: |
dotnet list KeetaNet.Anchor.slnx package --vulnerable --include-transitive 2>&1 | tee audit.log
if grep -q "has the following vulnerable packages" audit.log; then
echo "::error::Vulnerable packages found"
exit 1
fi