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

add github workflows #297

Merged

Conversation

UtkarshBhardwaj007
Copy link
Contributor

@UtkarshBhardwaj007 UtkarshBhardwaj007 commented Jan 6, 2025

  • This PR adds Github workflows for some basic checks.
  • This is required as we are trying to make all the rust code in this repository buildable and testable as part of this issue. These workflows would streamline the review process by performing some basic checks like build, test and fmt. These tests are largely inspired by what is already present in the polkadot-sdk.
  • This uses the same docker image for the environment as the polkadot-sdk repository for consistency.
  • Given that the code in this repository is exclusively for the tutorials on docs.polkadot.com, I have added the minimum tests required (IMO) to make reviews streamlined and easy. More tests can be added later on if required.
  • Testing: Used act library with docker for local testing. Also the checks are running on this PR which should help.
  • Part of Test code snippets #236

@UtkarshBhardwaj007 UtkarshBhardwaj007 requested a review from a team as a code owner January 6, 2025 20:32
@0xLucca
Copy link
Collaborator

0xLucca commented Jan 7, 2025

@UtkarshBhardwaj007 It looks good to me

I tried running this with act but I had the following issue:

When running:

act -W '.github/workflows/checks.yml'

I get this error:

...
[preflight/Preflight/preflight] 🏁  Job succeeded
[Checks/clippy       ] 🚀  Start image="docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558"
[Checks/test         ] 🚀  Start image="docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558"
[Checks/fmt          ] 🚀  Start image="docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558"
[Checks/test         ]   🐳  docker pull image="docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558" platform=linux/amd64 username= forcePull=true
[Checks/clippy       ]   🐳  docker pull image="docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558" platform=linux/amd64 username= forcePull=true
[Checks/test         ] invalid reference format
[Checks/clippy       ] invalid reference format
[Checks/fmt          ]   🐳  docker pull image="docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558" platform=linux/amd64 username= forcePull=true
[Checks/fmt          ] invalid reference format
Error: invalid reference format

@UtkarshBhardwaj007
Copy link
Contributor Author

@0xLucca , that is strange. It works for me locally and it works here on this PR as well (you can see the checks running). It could be some local configuration issue.

You need to specify the container-architecture and platform in .actrc at the root of your project if you are running this on a non-linux (mac) platform or you can append this to the terminal command that you are running. Here is my .actrc:

--platform ubuntu-latest=linux/amd64
--container-architecture linux/amd64
-P ubuntu-latest=docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558

Alternatively, can you share the verbose logging of your run (basically run the same command with the -v flag?

Either way, I think this is only related to being able to run the Github workflows locally (which is not part of this PR). I just did that extra step to confirm all commands were correct and running. Now that we have a PR, we can see that the workflows are running in this and should serve as a validation that the workflows work. What do you think?

Copy link
Collaborator

@0xLucca 0xLucca left a comment

Choose a reason for hiding this comment

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

LGTM!

@0xLucca 0xLucca requested a review from nhussein11 January 7, 2025 12:50
@0xLucca
Copy link
Collaborator

0xLucca commented Jan 7, 2025

@0xLucca , that is strange. It works for me locally and it works here on this PR as well (you can see the checks running). It could be some local configuration issue.

You need to specify the container-architecture and platform in .actrc at the root of your project if you are running this on a non-linux (mac) platform or you can append this to the terminal command that you are running. Here is my .actrc:

--platform ubuntu-latest=linux/amd64
--container-architecture linux/amd64
-P ubuntu-latest=docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558

Alternatively, can you share the verbose logging of your run (basically run the same command with the -v flag?

Either way, I think this is only related to being able to run the Github workflows locally (which is not part of this PR). I just did that extra step to confirm all commands were correct and running. Now that we have a PR, we can see that the workflows are running in this and should serve as a validation that the workflows work. What do you think?

It is probably a local configuration issue, I'll check later but I don't want to hold this PR because of that. It is working on github so that's enough

@0xLucca 0xLucca merged commit 758a800 into polkadot-developers:master Jan 8, 2025
7 checks passed
@UtkarshBhardwaj007 UtkarshBhardwaj007 deleted the github-workflows branch January 8, 2025 11:54
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