How to implement CICD in ionic projects

Hi

I am new to ionic and I want to implement CICD for my ionic app.

But I don’t know how?!

I searched and faced the appflow and I started learning that.

But I realized for using the appflow’s features and facilities, I have to pay a amount but I can’t.

Thank you in advance for guiding me on how to do this

This depends slightly on whether you are using AppFlow, but there are several tutorials available such as Automate Ionic Builds With Gitlab CI. The ionic-boilerplate repo also has a .gitlab-ci.yml file that might be worth looking at.

1 Like

@snim2

Thank you so much for your replying.
I just want to deploy the test cases and run the test.
I don’t expect lots and strange things.
Whatever I searched for the ionic CICD automation, I faced the Appflow and I was gradually getting frustrated.
I will start reading the links you sent, right now and I hope I’ll found the solution.
But I ask you to visit this topic again to help if I have a question.
Because as I said, I’m new in ionic and I don’t have much knowledge of that.
Thanks again

@snim2

Hi again.
I read those links.
THIS explained how to connect to GitLab account in Appflow which I know that.

THIS seems complete. but the part referred to Gitlab Runner, takes me to the 404 not found page!
Also, I don’t have any build.json in my whole project.
Must I add that?
If so, how can I add that?

and THIS is a complete project?
Can I just use the .gitlab-ci.yml file located in that project? or I must do some special configurations?

@snim2
please help me

If you look at the link to GitLab runner you’ll see it has a typo. The link should go here: Install GitLab Runner | GitLab

I’ve haven’t tried it out; it look complete but a bit old. If I were you, I would start a blank Ioic5 project, with whatever frontend you prefer to use, and see if you can adapt the CI config from that project, or another one you find, to work with it.

If you read through the config, you’ll see some things like this:

build_web:
  stage: test
  only:
      - master
  script:
    - npm run lint
    - npm run scss-lint
    - npm run test
    - npm run build
    - npm run e2e

scss-lint is a separate tool, which probably doesn’t come with Ionic, and so you might want to lose that, but the project is documented well, and if you read through the Ionic documentation too then it should be possible to figure out what’s built into Ionic and what isn’t.

Or alternatively, depending on the stack you want to use, there are other guides around that you could use as a starting point.

Please remember this is a public forum, and members are volunteers.

1 Like

Thank you again for your complete guidance

I really do know.
And excuse me for disturbing you. But since I confused a little, I had to post that.

I know how to install the Gitlab runner and I installed one in my account before.
But I don’t know can I use that for other projects like ionic or not?
That’s why I asked.

I have an active ionic project and I want to use CI for that.
How can I find out what is built into my project and what is not to know what is needed to configure in CI?

It seems a bit old.
Can I use the latest firebase articles?
like This

You can use any runner with any project, so long as either:

  1. the runner is installed on a server with the dependencies you need to run the script, before_script and after_script sections in your .gitlab-ci.yml file, or
  2. you install those dependencies in your .gitlab-ci.yml, or
  3. your .gitlab-ci.yml file defines a Docker image to run the pipeline, and that Docker image has the dependencies installed already.

So, if your script needs to run npm build you need to install npm or use a Docker image that comes with it.

In the example repo I linked, the line image: marcoturi/ionic:latest defines a Docker images to use. If you search Docker hub for that name, you get this result.

When you build the project or run its tests, you run a sequence of commands like npm build or yarn build, etc. Presumably these are the commands that you want the pipeline to run. For example If you install your project dependencies with yarn install then you need yarn available in your runner, and then in your .gitlab-ci.yml somewhere you will run yarn install.

That’s really a question that only you can answer!

1 Like