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] Podman tests #933

Merged
merged 8 commits into from
Apr 25, 2023
Merged

[CI] Podman tests #933

merged 8 commits into from
Apr 25, 2023

Conversation

l0r1s
Copy link
Contributor

@l0r1s l0r1s commented Apr 14, 2023

No description provided.

@l0r1s l0r1s requested a review from pepoviola as a code owner April 14, 2023 12:47
@pepoviola
Copy link
Collaborator

Looks good! Can we use the artifacts from the build step to not build here again?

@l0r1s l0r1s force-pushed the ci/podman-tests branch 2 times, most recently from 3798c6b to 0fb6903 Compare April 18, 2023 12:58
@l0r1s l0r1s requested a review from wirednkod April 18, 2023 13:19
@l0r1s l0r1s force-pushed the ci/podman-tests branch 3 times, most recently from 9a50a7f to 78dc3f1 Compare April 21, 2023 20:07
@pepoviola
Copy link
Collaborator

Ping @wirednkod, can you review this one again. I think is good to merge.
Thanks!

Copy link
Contributor

@wirednkod wirednkod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping @wirednkod, can you review this one again. I think is good to merge. Thanks!

I mean - I see still things that I commented not being altered - I still think that the Provider's tests should run in one CI and not a separate one; In addition I am not for, on caching deps;
There is a repeating of install/build, actions that take place in the existing CI - this will just make things duplicated;

@pepoviola
Copy link
Collaborator

Ping @wirednkod, can you review this one again. I think is good to merge. Thanks!

I mean - I see still things that I commented not being altered - I still think that the Provider's tests should run in one CI and not a separate one; In addition I am not for, on caching deps; There is a repeating of install/build, actions that take place in the existing CI - this will just make things duplicated;

Thanks for the feedback @wirednkod, what do you mean with

 I still think that the Provider's tests should run in one CI and not a separate one

We don't have any provider's tests at the moment. We can add test for native in the future and I think is ok to add it in another ci file.
I'm think we can still improve the building between workflows to just re-use the whole javascript directory and remove the dup install/buils, wdyt @l0r1s ?

Thanks!

@wirednkod
Copy link
Contributor

I mean we can just do something like this:

name: ZombieNet Basic CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [18.x, 19.x]

    steps:
      - uses: actions/checkout@v3.5.2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm install
        working-directory: "./javascript"
      - run: npm run build
        working-directory: "./javascript"
      - run: npm run lint
        working-directory: "./javascript"
      - run: npm run test
        working-directory: "./javascript"

      - name: Upload build artifacts
        uses: actions/upload-artifact@v3
        with:
          name: ${{ runner.os }}-build-${{ github.sha }}
          path: |
            javascript/packages/cli/dist
            javascript/packages/orchestrator/dist
            javascript/packages/utils/dist

  build-rust:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3.5.2
      - name: Install Rust Stable toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true

      - name: Run cargo fmt
        run: cargo fmt --all -- --check

      - uses: actions-rs/clippy-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --all-features

      - name: Build
        run: cargo build

      - name: Run tests
        run: cargo test --verbose --all-targets --all-features

  run-podman-tests:
    runs-on: ubuntu-22.04
    needs: build-artifacts
    strategy:
      matrix:
        test-path:
          - ../tests/smoke/0001-smoke.zndsl
          - ../tests/0013-db-snapshot.zndsl

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3.5.0

      - name: Setup containers registries
        run: |
          mkdir -p /etc/containers \
          && echo "unqualified-search-registries = ['docker.io']" \
          && sudo tee /etc/containers/registries.conf
      - name: Run test
        run: npm run zombie -- --provider podman test ${{ matrix.test-path }}
        working-directory: ./javascript
        env:
          DEBUG: zombie*
          ZOMBIENET_INTEGRATION_TEST_IMAGE: docker.io/paritypr/polkadot-debug:master
          COL_IMAGE: docker.io/paritypr/colander:master
          MALUS_IMAGE: docker.io/paritypr/malus:4131-ccd09bbf

  all:
    # This dummy job depends on all the mandatory checks. It succeeds if and only if all CI checks
    # are successful.
    needs: [build, build-rust, run-podman-tests]
    runs-on: ubuntu-latest
    steps:
      - run: echo Success

There is no reason for podman tetsts to run e.g. if rust build fail, or some other stop of the CI fails..

@l0r1s
Copy link
Contributor Author

l0r1s commented Apr 24, 2023

Looks good to me, if you are ok, I can move the podman CI into the main CI and create a custom action for running tests which could be use for future native tests ? It's simplify everything and we avoid duplicate build

@pepoviola
Copy link
Collaborator

pepoviola commented Apr 24, 2023

Yes, sounds good to me. Thanks @wirednkod / @l0r1s :)

- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18.x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only version 18?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is ok to only test on 18, we don't need to run the same integration test on both 18 and 19.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioned in another comment that these lines are actually not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I think this is still needed to pin the version of node being used instead of having a lts used and updated when we don't know, no ?

Comment on lines +32 to +33
- name: Upload build artifacts
if: ${{ matrix.node-version == '18.x' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why uploading the artifacts at this point?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, we should remove this if we switch to one file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we don't cache anymore the build and build 2 times ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would you? There is a build at the beginning of the CI. Is there going to be a 2nd time? (there should be only one at the beginning with each node version)

Comment on lines +88 to +97
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Retrieve build artifacts
uses: actions/download-artifact@master
with:
name: ${{ runner.os }}-build-${{ github.sha }}
path: ./javascript/packages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be removed as well

Copy link
Contributor Author

@l0r1s l0r1s Apr 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, If I remove this, we can't use node in the job because it's started on a new runner (not a step) and I need to build again additionally

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you need to retrieve build artifacts since we want to remove also the upload?

@wirednkod wirednkod self-requested a review April 25, 2023 12:08
@l0r1s l0r1s merged commit df5fa08 into main Apr 25, 2023
@l0r1s l0r1s deleted the ci/podman-tests branch April 25, 2023 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants