Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: added library export to npm packages #41

Merged
merged 25 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5c6fdc7
ci: export lib
0xJabberwock Aug 8, 2024
dd50beb
chore: move all unit test files to solidity/test/unit
0xJabberwock Aug 8, 2024
169164f
feat: new action version
0xShaito Aug 8, 2024
6911a05
feat: new action version
0xShaito Aug 8, 2024
6e66628
feat: new action version
0xShaito Aug 8, 2024
4e3c86c
chore: exporter update
0xShaito Aug 8, 2024
43a61ab
chore: exporter update
0xShaito Aug 8, 2024
994143f
chore: exporter update
0xShaito Aug 8, 2024
6fb44f5
chore: exporter update
0xShaito Aug 8, 2024
7026e5a
chore: exporter update
0xShaito Aug 8, 2024
4501f6d
ci: added verbose publsih
0xGorilla Aug 8, 2024
5e1cf55
ci: renamed env var to NODE_AUTH_TOKEN
0xGorilla Aug 8, 2024
8b4142a
Merge branch 'dev' into ci/export-lib
0xGorilla Aug 8, 2024
ac2273e
chore: update exporter version
0xShaito Aug 8, 2024
5f69695
chore: update canary release action
0xShaito Aug 8, 2024
08b5091
chore: update canary release action
0xShaito Aug 8, 2024
09f8501
chore: update canary release action
0xShaito Aug 8, 2024
a15abc3
chore: update canary release action
0xShaito Aug 8, 2024
e045d7e
chore: update canary release action
0xShaito Aug 8, 2024
8f2c50c
chore: update canary release action
0xShaito Aug 8, 2024
031fb2b
chore: update canary release action
0xShaito Aug 8, 2024
4a846a2
chore: update canary release action
0xShaito Aug 8, 2024
844bc0b
chore: update canary release action
0xShaito Aug 8, 2024
f651960
fix: update release tag
0xShaito Aug 8, 2024
89ccbbd
ci: rename workflow files
0xJabberwock Aug 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Canary Release

on: workflow_dispatch

jobs:
export:
name: Generate Interfaces And Contracts

runs-on: ubuntu-latest
strategy:
matrix:
export_type: ['interfaces', 'all']

env:
PROJECT_NAME: '@defi-wonderland/prophet-core'
EXPORT_NAME: ${{ matrix.export_type == 'interfaces' && '-interfaces' || '' }}

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install Node
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
node-version: 20.x
cache: 'yarn'

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Build project and generate out directory
run: yarn build

- name: Update version
run: yarn version --new-version "0.0.0-${GITHUB_SHA::8}" --no-git-tag-version

- name: Export Solidity - Export Type ${{ matrix.export_type }}
uses: defi-wonderland/[email protected]
with:
package_name: ${{ env.PROJECT_NAME }}
out: 'out'
interfaces: 'solidity/interfaces'
contracts: 'solidity/contracts'
libraries: "solidity/libraries"
export_type: '${{ matrix.export_type }}'

- name: Publish to NPM - Export Type ${{ matrix.export_type }}
run: cd export/${{ env.PROJECT_NAME }}${{ env.EXPORT_NAME }} && npm publish --access public --tag canary
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
49 changes: 0 additions & 49 deletions .github/workflows/interfaces-canary.yml

This file was deleted.

50 changes: 0 additions & 50 deletions .github/workflows/interfaces-production.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Production Release

on:
release:
types: [published]

jobs:
release:
name: Release

runs-on: ubuntu-latest
strategy:
matrix:
export_type: ['interfaces', 'all']

env:
PROJECT_NAME: '@defi-wonderland/prophet-core'
EXPORT_NAME: ${{ matrix.export_type == 'interfaces' && '-interfaces' || '' }}

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install Node
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
node-version: 20.x
cache: 'yarn'

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Build project and generate out directory
run: yarn build

- name: Export Solidity - Export Type ${{ matrix.export_type }}
uses: defi-wonderland/[email protected]
with:
package_name: ${{ env.PROJECT_NAME }}
out: 'out'
interfaces: 'solidity/interfaces'
contracts: 'solidity/contracts'
libraries: "solidity/libraries"
export_type: '${{ matrix.export_type }}'

- name: Publish to NPM - Export Type ${{ matrix.export_type }}
run: cd export/${{ env.PROJECT_NAME }}${{ env.EXPORT_NAME }} && npm publish --access public --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 4 additions & 2 deletions solidity/contracts/Oracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import {IFinalityModule} from '../interfaces/modules/finality/IFinalityModule.so
import {IRequestModule} from '../interfaces/modules/request/IRequestModule.sol';
import {IResolutionModule} from '../interfaces/modules/resolution/IResolutionModule.sol';
import {IResponseModule} from '../interfaces/modules/response/IResponseModule.sol';
import {ValidatorLib} from '../lib/ValidatorLib.sol';
import {ValidatorLib} from '../libraries/ValidatorLib.sol';

contract Oracle is IOracle {
using ValidatorLib for *;

/// @inheritdoc IOracle
mapping(bytes32 _requestId => uint128 _finalizedAt) public finalizedAt;

Expand Down Expand Up @@ -106,7 +108,7 @@ contract Oracle is IOracle {
Response calldata _response
) external returns (bytes32 _responseId) {
bytes32 _requestId = ValidatorLib._getId(_request);
(_responseId) = ValidatorLib._validateResponse(_request, _response);
_responseId = ValidatorLib._validateResponse(_request, _response);

if (requestCreatedAt[_requestId] == 0) {
revert Oracle_InvalidRequest();
Expand Down
2 changes: 1 addition & 1 deletion solidity/contracts/Validator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.19;

import {IOracle, IValidator} from '../interfaces/IValidator.sol';

import {ValidatorLib} from '../lib/ValidatorLib.sol';
import {ValidatorLib} from '../libraries/ValidatorLib.sol';

abstract contract Validator is IValidator {
/// @inheritdoc IValidator
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity ^0.8.19;

import 'forge-std/Test.sol';

import {IModule, Module} from '../../../contracts/Module.sol';
import {IOracle} from '../../../interfaces/IOracle.sol';
import {Helpers} from '../../utils/Helpers.sol';
import {IModule, Module} from '../../contracts/Module.sol';
import {IOracle} from '../../interfaces/IOracle.sol';
import {Helpers} from '../utils/Helpers.sol';

/**
* @dev Harness to deploy the abstract contract
Expand Down
2 changes: 1 addition & 1 deletion solidity/test/unit/Oracle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {IResponseModule} from '../../interfaces/modules/response/IResponseModule
import {Oracle} from '../../contracts/Oracle.sol';
import {Helpers} from '../utils/Helpers.sol';

import {ValidatorLib} from '../../lib/ValidatorLib.sol';
import {ValidatorLib} from '../../libraries/ValidatorLib.sol';

/**
* @notice Harness to deploy and test Oracle
Expand Down
2 changes: 1 addition & 1 deletion solidity/test/unit/Validator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {IResponseModule} from '../../interfaces/modules/response/IResponseModule

import {IValidator, Validator} from '../../contracts/Validator.sol';

import {ValidatorLib} from '../../lib/ValidatorLib.sol';
import {ValidatorLib} from '../../libraries/ValidatorLib.sol';

import {Helpers} from '../utils/Helpers.sol';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {IRequestModule} from '../../interfaces/modules/request/IRequestModule.so
import {IResolutionModule} from '../../interfaces/modules/resolution/IResolutionModule.sol';
import {IResponseModule} from '../../interfaces/modules/response/IResponseModule.sol';

import {ValidatorLib} from '../../lib/ValidatorLib.sol';
import {ValidatorLib} from '../../libraries/ValidatorLib.sol';
import {Helpers} from '../utils/Helpers.sol';

/**
Expand Down
Loading