diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index be5c11b..9a104ed 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,9 +15,9 @@ concurrency: cancel-in-progress: true jobs: - build-subgraph: + build-and-test: runs-on: ubuntu-latest - + steps: - name: Checkout uses: actions/checkout@v4 @@ -28,7 +28,7 @@ jobs: node-version: 20 cache: 'npm' - - name: Init + - name: Install dependencies run: npm ci - name: Check Format @@ -40,3 +40,8 @@ jobs: - name: Run unit tests run: npm run test:unit + - name: Prepare test stack + run: npm run start-test-stack + + - name: Run integration tests + run: npm run test:e2e diff --git a/CHANGELOG.md b/CHANGELOG.md index 9030d04..3b4e401 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ## vNEXT -- Remove unused files (#42) +- Migrate integration tests from Jenkins to GitHub Actions. (#44) +- Remove unused files to streamline the repository. (#42) - Rewrite Jenkins CI for future migration (#36, #37) - Add a modern test stack, agnostic to the forked network. (#38) - Add a section in the README to explain how to use the Docker-based subgraph deployer. (#38) diff --git a/Jenkinsfile-itest b/Jenkinsfile-itest deleted file mode 100644 index b2a5b2c..0000000 --- a/Jenkinsfile-itest +++ /dev/null @@ -1,31 +0,0 @@ -node('docker') { - stage('Clone') { - cleanWs() - checkoutInfo = checkout(scm) - echo "git checkout: ${checkoutInfo}" - } - stage('Pull images') { - withCredentials([ - usernamePassword(credentialsId: 'docker-regis', - usernameVariable: 'username', passwordVariable: 'password') - ]) { - def registry = 'docker-regis.iex.ec' - try { - sh "echo -n '${password}' | docker login --username '${username}' --password-stdin ${registry}" - sh 'cd docker/test/ && docker compose pull chain' - } finally { - sh "docker logout ${registry}" - } - } - } - docker.image('node:22-alpine') - .inside('-v /var/run/docker.sock:/var/run/docker.sock --network=host --user=root') { - stage('Init') { - sh 'apk add docker docker-compose' // TODO: Use already built image for a faster job execution - sh 'npm ci' - } - stage('Integration tests') { - sh 'npm run itest' - } - } -} diff --git a/README.md b/README.md index a968697..748e7b9 100644 --- a/README.md +++ b/README.md @@ -30,12 +30,6 @@ install project deps npm ci ``` -generate code - -```sh -npm run codegen -``` - build the project and generate the necessary files: ```sh diff --git a/test-stack/docker-compose.yml b/test-stack/docker-compose.yml index c6eac8c..4055509 100644 --- a/test-stack/docker-compose.yml +++ b/test-stack/docker-compose.yml @@ -37,7 +37,7 @@ services: ipfs: restart: unless-stopped - image: ipfs/go-ipfs:v0.34.1 + image: ipfs/kubo:v0.34.1 expose: - 8080 - 5001 diff --git a/test-stack/prepare-test-env.ts b/test-stack/prepare-test-env.ts index 9af0820..db57d21 100644 --- a/test-stack/prepare-test-env.ts +++ b/test-stack/prepare-test-env.ts @@ -35,14 +35,14 @@ async function createEnvFiles(forkBlockNumber: number) { console.log('Creating .env file for docker-compose test-stack'); writeFileSync( '.env', - `############ THIS FILE IS GENERATED ############ - # run "node prepare-test-env.js" to regenerate # - ################################################ - - # blockchain node to use as the reference for the local fork - FORK_URL=${forkUrl} - # block number to fork from - FORK_BLOCK=${forkBlockNumber}`, + '############ THIS FILE IS GENERATED ############\n' + + '# run "node prepare-test-env.js" to regenerate #\n' + + '################################################\n' + + '\n' + + '# blockchain node to use as the reference for the local fork\n' + + `FORK_URL=${forkUrl}\n` + + '# block number to fork from\n' + + `FORK_BLOCK=${forkBlockNumber}\n`, ); }