Skip to content

Commit

Permalink
Merge branch 'master' into sarah/ui
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahschwartz authored Nov 2, 2023
2 parents dfe6283 + f23fd20 commit 76c3007
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
# branch = docs
[submodule "docs/latest/builds/sway"]
path = docs/latest/builds/sway
# branch = gh-pages
url = https://github.com/FuelLabs/sway.git
# branch = gh-pages
[submodule "docs/latest/fuels-wallet"]
path = docs/latest/fuels-wallet
url = https://github.com/FuelLabs/fuels-wallet.git
Expand Down
2 changes: 1 addition & 1 deletion docs/builds/sway
Submodule sway updated 1856 files
2 changes: 1 addition & 1 deletion docs/fuel-indexer
Submodule fuel-indexer updated 231 files
2 changes: 1 addition & 1 deletion docs/latest/builds/sway
Submodule sway updated 36825 files
2 changes: 1 addition & 1 deletion docs/latest/fuel-indexer
Submodule fuel-indexer updated 49 files
+36 −0 .github/workflows/helm-publish.yaml
+72 −73 Cargo.lock
+18 −18 Cargo.toml
+3 −0 config.yaml
+28 −27 docs/src/getting-started/how-it-compares.md
+1 −1 examples/greetings/greetings-data/Cargo.toml
+23 −0 helm/fuel-indexer/.helmignore
+24 −0 helm/fuel-indexer/Chart.yaml
+43 −0 helm/fuel-indexer/sample.values.yaml
+22 −0 helm/fuel-indexer/templates/NOTES.txt
+62 −0 helm/fuel-indexer/templates/_helpers.tpl
+111 −0 helm/fuel-indexer/templates/deployment.yaml
+32 −0 helm/fuel-indexer/templates/hpa.yaml
+61 −0 helm/fuel-indexer/templates/ingress.yaml
+13 −0 helm/fuel-indexer/templates/pvc.yaml
+15 −0 helm/fuel-indexer/templates/service.yaml
+12 −0 helm/fuel-indexer/templates/serviceaccount.yaml
+15 −0 helm/fuel-indexer/templates/servicemonitor.yaml
+15 −0 helm/fuel-indexer/templates/tests/test-connection.yaml
+87 −0 helm/fuel-indexer/values.yaml
+7 −0 packages/fuel-indexer-lib/src/config/cli.rs
+11 −0 packages/fuel-indexer-lib/src/config/mod.rs
+10 −4 packages/fuel-indexer-macros/src/helpers.rs
+230 −209 packages/fuel-indexer-macros/src/indexer.rs
+15 −2 packages/fuel-indexer-macros/src/wasm.rs
+1 −0 packages/fuel-indexer-plugin/Cargo.toml
+1 −0 packages/fuel-indexer-plugin/src/lib.rs
+2 −1 packages/fuel-indexer-tests/Cargo.toml
+5 −7 packages/fuel-indexer-tests/src/fixtures.rs
+1 −0 packages/fuel-indexer-tests/tests/snapshots/integration_tests__commands__default_indexer_config.snap
+3 −0 packages/fuel-indexer-tests/tests/snapshots/integration_tests__commands__forc_index_start_help_output.snap
+3 −0 packages/fuel-indexer-tests/tests/snapshots/integration_tests__commands__fuel_indexer_run_help_output.snap
+3 −0 packages/fuel-indexer-tests/tests/snapshots/integration_tests__snapshots__forc_index_start_help_output.snap
+3 −0 packages/fuel-indexer-tests/tests/snapshots/integration_tests__snapshots__fuel_indexer_run_help_output.snap
+1 −1 packages/fuel-indexer-tests/trybuild/pass_if_unsupported_types_are_used.rs
+1 −1 packages/fuel-indexer-tests/trybuild/pass_if_using_swap_predicate_abi.rs
+1 −1 packages/fuel-indexer-tests/trybuild/pass_if_using_sway_amm_abi.rs
+1 −1 packages/fuel-indexer-tests/trybuild/pass_if_using_sway_asset_contract_abi.rs
+1 −1 packages/fuel-indexer-tests/trybuild/pass_if_using_sway_dao_abi.rs
+1 −1 packages/fuel-indexer-tests/trybuild/pass_if_using_sway_distributor_contract_abi.rs
+1 −1 packages/fuel-indexer-tests/trybuild/pass_if_using_sway_escrow_contract_abi.rs
+1 −1 packages/fuel-indexer-tests/trybuild/pass_if_using_sway_multisig_contract_abi.rs
+1 −1 packages/fuel-indexer-tests/trybuild/pass_if_using_sway_oracle_contract_abi.rs
+1 −1 packages/fuel-indexer-tests/trybuild/pass_if_using_sway_registry_contract_abi.rs
+1 −1 packages/fuel-indexer-tests/trybuild/pass_if_using_timelock_contract_abi.rs
+1 −1 packages/fuel-indexer-tests/trybuild/pass_is_using_sway_exchange_contract_abi.rs
+8 −4 packages/fuel-indexer/src/executor.rs
+2 −2 plugins/forc-index/src/defaults.rs
+5 −0 plugins/forc-index/src/ops/forc_index_start.rs
2 changes: 1 addition & 1 deletion docs/latest/fuel-specs
2 changes: 1 addition & 1 deletion docs/latest/sway
Submodule sway updated 316 files
2 changes: 1 addition & 1 deletion docs/sway
Submodule sway updated 507 files
60 changes: 60 additions & 0 deletions scripts/update-latest/gitUtils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ export const checkoutVersion = async (version, dir) => {
});
};

export const checkoutBranch = async (branch, dir) => {
await exec('git', ['checkout', branch], {
cwd: dir,
});
};

export const commitAll = async (message) => {
await exec('git', ['add', '.']);
await exec('git', ['commit', '-m', message]);
Expand Down Expand Up @@ -108,3 +114,57 @@ export const gitResetCommit = async (releaseCommit, dir) => {
cwd: dir,
});
};

export const getReleaseTimestamp = async (version, dir) => {
try {
let releaseTimestamp = null;
await exec('git', ['log', '--format="%ct"', '-n', '1', `tags/${version}`], {
cwd: dir,
listeners: {
stdout: (data) => {
console.log('data.toString()', data.toString());
releaseTimestamp = parseInt(data.toString().trim().slice(1, -1), 10);
},
},
});
return releaseTimestamp;
} catch (error) {
console.error(
`Error getting commit timestamp for version ${version}: ${error.message}`
);
return null;
}
};

export const getCommitByTimestamp = async (timestamp, branch, dir) => {
try {
let closestCommitHash = '';
let commits = [];

// Fetch all commits in branch
await exec('git', ['log', '--format="%H %ct"', '--max-count=300', branch], {
cwd: dir,
listeners: {
stdout: (data) => {
const commitLines = data.toString().trim().split('\n');
commits = commits.concat(commitLines);
},
},
});

// Find a commit with a timestamp after the timestamp
for (let i = 0; i < commits.length; i++) {
const commit = commits[i];
const [commitHash, commitTimestamp] = commit.split(' ');
const cleanTS = parseInt(commitTimestamp.slice(0, -1));
if (cleanTS < timestamp) {
break;
}
closestCommitHash = commitHash.substr(1);
}

return closestCommitHash;
} catch (error) {
console.error(`Error finding commit by timestamp: ${error.message}`);
}
};
20 changes: 14 additions & 6 deletions scripts/update-latest/updateLatest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import {
createPR,
fetchTag,
fetchBranch,
getVersionCommit,
getReleaseTimestamp,
gitResetCommit,
getCommitByTimestamp,
checkoutBranch,
} from './gitUtils.mjs';

export async function updateLatest(newVersions) {
Expand Down Expand Up @@ -106,15 +108,21 @@ export async function update(version, dir, branch) {
await checkoutVersion(version, dir);
}
if (branch) {
let releaseCommit;
let releaseTimestamp;
if (dir !== 'docs/latest/fuels-ts') {
releaseCommit = await getVersionCommit(version, dir);
releaseTimestamp = await getReleaseTimestamp(version, dir);
console.log('RELEASE TIMESTAMP:', releaseTimestamp);
}
await fetchBranch(branch, dir);
await switchToExistingBranch(branch, dir);
await checkoutBranch(branch, dir);
if (dir !== 'docs/latest/fuels-ts') {
// go to the version commit in the right branch;
await gitResetCommit(releaseCommit, dir);
const commitHash = await getCommitByTimestamp(
releaseTimestamp,
branch,
dir
);
console.log('COMMIT HASH:', commitHash);
await gitResetCommit(commitHash, dir);
}
}
}

0 comments on commit 76c3007

Please sign in to comment.