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: add format checking and test to ci #7

Merged
merged 9 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"plugins": ["@fuels/eslint-config"],
"rules": {
"no-await-in-loop": 0,
"prefer-destructuring": 0,
"no-bitwise": 0
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Syntax highlighting of sway files as rust
*.sw linguist-language=Rust
*.sw linguist-language=Rust
27 changes: 27 additions & 0 deletions .github/actions/setup-rust/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Rust & Forc Setup'

inputs:
rust-version:
default: 1.70.0
forc-toolchain:
default: latest
forc-date:
default: 2023-07-05

runs:
using: 'composite'
steps:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ inputs.rust-version }}
components: clippy, rustfmt

- name: Init cache
uses: Swatinem/rust-cache@v2

- name: Install Fuel toolchain
uses: FuelLabs/[email protected]
with:
toolchain: ${{ inputs.forc-toolchain }}
date: ${{ inputs.forc-date }}
34 changes: 34 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches:
- main
pull_request:
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
vaidate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
- uses: FuelLabs/github-actions/setups/docker@master
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-rust

- name: Check projects formatting
run: pnpm check

- name: Build projects
run: pnpm build

- name: Test projects
run: pnpm test
luizstacio marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,12 @@ node_modules
# Hardhat files
cache
artifacts

# Cargo and Forc artifacts
out
target
*/out
*/target

# Genearal dist folders
dist
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.14.1
22 changes: 22 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Node.js
node_modules
.env
.turbo
package.json

# Hardhat files
cache
artifacts
typechain

# Cargo and Forc artifacts
out
target
*/out
*/target

# Genearal dist folders
dist

## Ignore lock files
pnpm-lock.yaml
17 changes: 17 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
plugins: ['@fuels/prettier-config', 'prettier-plugin-solidity'],
singleQuote: true,
semi: true,
overrides: [
{
files: '*.sol',
options: {
printWidth: 120,
tabWidth: 4,
useTabs: false,
singleQuote: false,
bracketSpacing: false,
},
},
],
};
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

## 📗 Table of contents

- [Getting Started](./docs/GETTING_STARTED.md)
Expand Down
10 changes: 7 additions & 3 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,40 @@ This project runs a local Fuel development environment with both an L1 node and
- docker-compose
- make

*Note*: Docker Desktop only allocates 2GB of memory by default, which isn't enough to run the docker-compose services reliably.
_Note_: Docker Desktop only allocates 2GB of memory by default, which isn't enough to run the docker-compose services reliably.

To allocate more memory, go to Settings > Resources in the Docker UI and use the slider to change the value (_8GB recommended_). Make sure to click Apply & Restart for the changes to take effect.


## Commands

### Starting containers

To start all containers and build it, use;

```
make up
```

### Stop containers

To stop to containers, use;

```
make stop
```

### Clean containers

To remove all images and containers, use;

```
make clean
```

### View logs

To open the logs from the env, use;

```
make logs
```
Expand All @@ -48,10 +51,11 @@ make logs
A set of environment variables can be set before running.

You can change this configs on the env files;

- [Fuel Core env](./envs/fuel_core.env) Fuel Core configurations.
- [L1 env](./envs/l1_chain.env) L1 configurations.
- [PORTS](./envs/ports.env): Exposed ports on host machine.

## License

This repo is licensed under the `Apache-2.0` license. See [`LICENSE`](./LICENSE) for more information.
This repo is licensed under the `Apache-2.0` license. See [`LICENSE`](./LICENSE) for more information.
2 changes: 1 addition & 1 deletion docker/fuel-core/chainConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@
"max_predicate_data_length": 1048576,
"gas_price_factor": 1000000
}
}
}
44 changes: 22 additions & 22 deletions docker/l1-chain/hardhat/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY || '';
const LOCALHOST_HTTP = process.env.LOCALHOST_HTTP || '';

const config: HardhatUserConfig = {
defaultNetwork: 'hardhat',
solidity: {
compilers: [
{
version: '0.8.9',
settings: {
optimizer: {
enabled: true,
runs: 10000,
},
},
},
],
},
networks: {
localhost: {
url: LOCALHOST_HTTP,
},
},
etherscan: {
apiKey: ETHERSCAN_API_KEY,
},
defaultNetwork: 'hardhat',
solidity: {
compilers: [
{
version: '0.8.9',
settings: {
optimizer: {
enabled: true,
runs: 10000,
},
},
},
],
},
networks: {
localhost: {
url: LOCALHOST_HTTP,
},
},
etherscan: {
apiKey: ETHERSCAN_API_KEY,
},
};

export default config;
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@
"private": true,
"description": "Fuel Bridge",
"scripts": {
"format": "turbo run format",
"check": "turbo run check",
"build": "turbo run build",
"test": "sh ./scripts/test.sh",
"node:build": "make -C ./docker build",
"node:up": "make -C ./docker up",
"node:stop": "make -C ./docker stop",
"node:clean": "make -C ./docker clean",
"node:logs": "make -C ./docker logs"
"node:logs": "make -C ./docker logs",
"prettier:check": "prettier --check .",
"prettier:format": "prettier --write ."
},
"keywords": [],
"author": "Fuel Labs <[email protected]> (https://fuel.network/)",
"license": "APPACHE-2.0",
"dependencies": {
"@fuels/prettier-config": "^0.0.2",
"@fuels/ts-config": "^0.0.2",
"prettier": "^2.7.1",
"prettier-plugin-solidity": "^v1.0.0-rc.1",
"turbo": "^1.10.7"
},
"pnpm": {
Expand Down
81 changes: 0 additions & 81 deletions packages/fungible-token/.github/workflows/ci.yml

This file was deleted.

5 changes: 0 additions & 5 deletions packages/fungible-token/.gitignore

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,10 @@ pub async fn build_contract_message_tx(
if !gas_coins.is_empty() {
match gas_coins[0].clone() {
Input::CoinSigned(coin) => {
tx_outputs.push(Output::change(coin.owner.into(), 0, AssetId::default()));
tx_outputs.push(Output::change(coin.owner, 0, AssetId::default()));
}
Input::CoinPredicate(predicate) => {
tx_outputs.push(Output::change(
predicate.owner.into(),
0,
AssetId::default(),
));
tx_outputs.push(Output::change(predicate.owner, 0, AssetId::default()));
}
_ => {
// do nothing
Expand Down
Loading