Search code examples
laravelunit-testinggithub-actionscicdgitlab-ci.yml

which url is used for testing code by GitHub when we push via GitHub actions added to repository?


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']);
    }

Solution

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