Skip to content

Commit

Permalink
Split examples into seperate workspace projects
Browse files Browse the repository at this point in the history
  • Loading branch information
bitzoic committed Aug 26, 2024
1 parent a7098b9 commit e1662c4
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 25 deletions.
57 changes: 54 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

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

env:
CARGO_TERM_COLOR: always
Expand All @@ -20,7 +21,7 @@ env:
PATH_TO_SCRIPTS: .github/scripts

jobs:
build-sway-lib:
build-sway-standards:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -62,8 +63,58 @@ jobs:
- name: Build All Standards
run: forc build --error-on-warnings --path standards --release

build-examples:
runs-on: ubuntu-latest

strategy:
matrix:
project:
[
"examples/src3-mint-burn",
"examples/src5-ownership",
"examples/src6-vault",
"examples/src7-metadata",
"examples/src11-security-information",
"examples/src12-contract-factory",
"examples/src14-simple-proxy",
"examples/src20-native-asset",
]

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_VERSION }}
override: true

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

- name: Install a modern linker (mold)
uses: rui314/setup-mold@v1

- name: Force Rust to use mold globally for compilation
run: |
touch ~/.cargo/config.toml
echo "[target.x86_64-unknown-linux-gnu]" > ~/.cargo/config.toml
echo 'linker = "clang"' >> ~/.cargo/config.toml
echo 'rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/mold"]' >> ~/.cargo/config.toml
- name: Install rustfmt
run: rustup component add rustfmt

- name: Install Fuel toolchain
uses: FuelLabs/action-fuel-toolchain@v0.6.0
with:
name: my-toolchain
components: forc@${{ env.FORC_VERSION }}, fuel-core@${{ env.CORE_VERSION }}

- name: Check Sway Formatting Examples
run: forc fmt --path examples --check
run: forc fmt --path ${{ matrix.project }} --check

- name: Build All Examples
run: forc build --path examples --release
run: forc build --path ${{ matrix.project }} --release
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed Unreleased

- Something changed here 1
- Something changed here 2
- [#130](https://github.com/FuelLabs/sway-standards/pull/130) Splits examples into seperate workspace projects for improved continuous integration.

### Fixed Unreleased

Expand Down
20 changes: 0 additions & 20 deletions examples/Forc.toml

This file was deleted.

2 changes: 2 additions & 0 deletions examples/src11-security-information/Forc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["hardcoded-information", "variable-information"]
2 changes: 2 additions & 0 deletions examples/src12-contract-factory/Forc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["with_configurables", "without_configurables"]
2 changes: 2 additions & 0 deletions examples/src14-simple-proxy/Forc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["owned", "minimal"]
2 changes: 2 additions & 0 deletions examples/src20-native-asset/Forc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["single_asset", "multi_asset"]
2 changes: 2 additions & 0 deletions examples/src3-mint-burn/Forc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["single_asset", "multi_asset"]
2 changes: 2 additions & 0 deletions examples/src5-ownership/Forc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["initialized_example", "uninitialized_example"]
6 changes: 6 additions & 0 deletions examples/src6-vault/Forc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[workspace]
members = [
"multi_asset_vault",
"single_asset_single_sub_vault",
"single_asset_vault",
]
2 changes: 2 additions & 0 deletions examples/src7-metadata/Forc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["single_asset", "multi_asset"]

0 comments on commit e1662c4

Please sign in to comment.