Skip to content

Commit

Permalink
ci: reuse steps for different node versions (#2644)
Browse files Browse the repository at this point in the history
  • Loading branch information
faustbrian authored Jun 1, 2019
1 parent d20eed1 commit 6aa9b2f
Show file tree
Hide file tree
Showing 12 changed files with 352 additions and 3,191 deletions.
2,160 changes: 336 additions & 1,824 deletions .circleci/config.yml

Large diffs are not rendered by default.

1,208 changes: 0 additions & 1,208 deletions .circleci/configTemplate.json

This file was deleted.

128 changes: 0 additions & 128 deletions .circleci/generateConfig.js

This file was deleted.

15 changes: 0 additions & 15 deletions .circleci/rebuild-db.sh

This file was deleted.

2 changes: 1 addition & 1 deletion __tests__/integration/core-api/__support__/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const setUp = async () => {
jest.setTimeout(60000);

process.env.DISABLE_P2P_SERVER = "true"; // no need for p2p socket server to run
process.env.CORE_RESET_DATABASE = "1";

await setUpContainer({
exclude: [
Expand All @@ -35,7 +36,6 @@ const setUp = async () => {
});

const databaseService = app.resolvePlugin<Database.IDatabaseService>("database");
await databaseService.connection.roundsRepository.truncate();
await databaseService.buildWallets();
await databaseService.saveRound(round);

Expand Down
10 changes: 4 additions & 6 deletions __tests__/integration/core-blockchain/__support__/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import { setUpContainer } from "../../../utils/helpers/container";

jest.setTimeout(60000);

export async function setUp() {
return setUpContainer({ exit: "@arkecosystem/core-blockchain" });
}
process.env.CORE_RESET_DATABASE = "1";

export async function tearDown(): Promise<void> {
await app.tearDown();
}
export const setUp = async () => setUpContainer({ exit: "@arkecosystem/core-blockchain" });

export const tearDown = async (): Promise<void> => app.tearDown();
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export const setUp = async () => {
exclude: ["@arkecosystem/core-database-postgres"],
});

process.env.CORE_RESET_DATABASE = "1";

await registerWithContainer(pluginDatabase);

await registerWithContainer(plugin, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export const setUp = async () => {
};

export const setUpFull = async () => {
process.env.CORE_RESET_DATABASE = "1";

try {
await setUpContainer({
exit: "@arkecosystem/core-transaction-pool",
Expand Down
2 changes: 2 additions & 0 deletions __tests__/integration/core-transaction-pool/processor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ beforeAll(async () => {
});

afterAll(async () => {
await container.resolvePlugin("database").reset();

await tearDownFull();
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
],
"husky": {
"hooks": {
"pre-commit": "lint-staged && cross-env-shell ./scripts/pre-commit.sh"
"pre-commit": "lint-staged"
}
},
"jest": {
Expand Down
4 changes: 4 additions & 0 deletions packages/core-database/src/database-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export class DatabaseService implements Database.IDatabaseService {
}

public async init(): Promise<void> {
if (process.env.CORE_RESET_DATABASE) {
await this.reset();
}

await this.createGenesisBlock();

const lastBlock: Interfaces.IBlock = await this.getLastBlock();
Expand Down
8 changes: 0 additions & 8 deletions scripts/pre-commit.sh

This file was deleted.

0 comments on commit 6aa9b2f

Please sign in to comment.