skip to Main Content

I am new to CI/CD pipelines so I tried to integrate GitHub actions for unit testing on my existing app which runs on xyz.com. I wanted to make sure if I push code to GitHub which automates unit testing so which url GitHub uses to deploy app.

I am using laravel So in env file created for CI/CD GitHub action pipeline what would be APP_URL.

Question came to my mind as code pushed to GitHub will be tested by automated tests via GitHub actions before pushing it to server. Also is it feasible to connect to MySQL database which is on my server which already have data (don’t want to use fresh database each time) because its a bit complex to create sample data to be insert to fresh database each time.

Thanks

Sample code laravel test

public function test_can_check_password_policy()
    {

        $response = $this->withHeaders([
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'app-version' => 'xyz'
        ])->get('api/password-settings');

        $response->assertStatus(200);
        $response->assertJson([
            'success' => true
        ]);
        $response->assertJsonFragment(['password_uppercase' => '1']);
    }

2

Answers


  1. Chosen as BEST ANSWER

    I found the answer localhost is used by github actions and it is used in laravel default by .env.testing file settings


  2. GitHub does not deploy the app for you, you will need to configure that yourself somehow. For unit testing I would not expect any deployment needed, so it seems you are confusing some topics here. How are you running your unit tests and what errors are you running into? More context will help getting better answers.

    As for the database integration question: there are options to do so, but that is best to ask in a new question.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search