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

feat: workflow for Bitbucket Pipelines (migration help) #37

Closed
starfoxcom opened this issue May 24, 2022 · 1 comment
Closed

feat: workflow for Bitbucket Pipelines (migration help) #37

starfoxcom opened this issue May 24, 2022 · 1 comment
Labels
bug Something isn't working as expected

Comments

@starfoxcom
Copy link

starfoxcom commented May 24, 2022

Description
Hello, I really don't know if this is the right place to make this question, but after a full day of research trying to find help of some sort about this issue that I have, I don't know were else I can go to ask about it.

In my current job we are using the very good core template, which has a lot of tools and rules to follow, which we are not using/following properly (the project was already started before I arrived to work on it). So I convinced them that its the right choice to restart the project and follow the rules and the recomendations stablished by the template. But now I understand that the main issue was that, since we're using Bitbucket for our repo hosting, it was not possible to use the very good core template to its fullest, so I started to migrate the workflow the best I could to be used on with Bitbucket Pipelines.

So far I made possible to get 4 out of the 5 steps:

  1. ✅ Install Dependencies
  2. ✅ Format
  3. ✅ Analyze
  4. ✅ Run tests
  5. ❌ Check Code Coverage

The only one that I'm missing still is the Check Code Coverage one, but since it's a github action by itself, I researched on how to run the internal js scripts inside the action, but I haven't been able to do it right.

My question:
It's possible to run the action in the console with the node command to run the action steps? if its possible, which files does the console needs to know in the directory to make it work? since it seems that the files depends from some others, just that I haven't figure it out yet, this is not my forte :V.

This is only to know if its gonna be possible to make the full migration from GitHub Actions to Bitbucket Pipelines, but if at the end this is not something that the team developing this have in mind that can be possible, then I guess I'll leave it like that.

Hope to hear something about soon, have a great day!

PT: since the issue template only available was only the bug one, the issue has the bug tag, even if its not one, I was not able to notice/fix it before publishing the issue, my bad.

@starfoxcom starfoxcom added the bug Something isn't working as expected label May 24, 2022
@starfoxcom
Copy link
Author

UPDATE
So I've been researching and learning about the dist/index.js file, which is the one used on the action mainly, and I've been able to run it with the node command inside the command line in the Pipeline. This is the final code that I came up with:

image: cirrusci/flutter

pipelines:
  pull-requests:
    feature/*:
      - step:
          name: 🐦 Flutter Pipeline
          script:
          - |
            echo "📦 Install Dependencies"
            export PATH="$PATH":"$HOME/.pub-cache/bin"
            flutter pub global activate very_good_cli
            very_good --analytics false
            very_good packages get
          - |
            echo "✨ Check Formatting"
            flutter format --set-exit-if-changed lib test
          - |
            echo "🕵️ Analyze"
            flutter analyze lib test
          - |
            echo "🧪 Run Tests"
            very_good test --optimization --coverage --test-randomize-ordering-seed random
          - |
            echo "📊 Check Code Coverage"
            git clone https://github.com/VeryGoodOpenSource/very_good_coverage.git
            sudo apt update
            sudo apt install -y nodejs
            sudo apt install -y npm
            node -v
            npm -v
            INPUT_PATH="./coverage/lcov.info" INPUT_MIN_COVERAGE=100 node ./very_good_coverage/dist/index.js
      - step:
          name: Deploy to test
          deployment: test
          trigger: manual  # Uncomment to make this a manual deployment.
          script:
            - echo "Deploying to test environment"

I'm sure that it has plenty of improvement to it, but this is the first successful run of the Pipeline in the Bitbucket Repo.
In case that you're in need of this, remember that it has to be on the root directory of the repo you want to use it, and it has to be in the bitbucket-pipelines.yml file.

Feel free to comment about it or improve it as you like. Also, I think it would be a nice idea to have this file set up with the create of the very good core template, for those who use it on Bitbucket at least.

Have a nice day!

@tomarra tomarra closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected
Projects
Development

No branches or pull requests

2 participants