|
3 | 3 | name: Unit Tests On Push |
4 | 4 |
|
5 | 5 | # Controls when the workflow will run |
6 | | -on: |
7 | | - # Triggers the workflow on push or pull request events but only for the "main" branch |
8 | | - push: |
9 | | - branches: [ "main" ] |
10 | | - |
11 | | - # Allows you to run this workflow manually from the Actions tab |
12 | | - workflow_dispatch: |
| 6 | +on: push |
13 | 7 |
|
14 | 8 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel |
15 | 9 | jobs: |
16 | 10 | # This workflow contains a single job called "unit-tests" |
17 | 11 | unit-tests: |
18 | 12 | # The type of runner that the job will run on |
19 | 13 | runs-on: ubuntu-latest |
20 | | - container: |
21 | | - image: smarcet/openstackid_test:v1.0 |
22 | | - # Steps represent a sequence of tasks that will be executed as part of the job |
| 14 | + env: |
| 15 | + APP_ENV: testing |
| 16 | + APP_DEBUG: true |
| 17 | + APP_KEY: base64:4vh0op/S1dAsXKQ2bbdCfWRyCI9r8NNIdPXyZWt9PX4= |
| 18 | + DEV_EMAIL_TO: smarcet@gmail.com |
| 19 | + APP_URL: http://localhost |
| 20 | + DB_CONNECTION: mysql |
| 21 | + DB_HOST: 127.0.0.1 |
| 22 | + DB_PORT: 3306 |
| 23 | + DB_DATABASE: idp_test |
| 24 | + DB_USERNAME: root |
| 25 | + DB_PASSWORD: 1qaz2wsx |
| 26 | + REDIS_HOST: 127.0.0.1 |
| 27 | + REDIS_PORT: 6379 |
| 28 | + REDIS_DB: 0 |
| 29 | + REDIS_PASSWORD: 1qaz2wsx |
| 30 | + REDIS_DATABASES: 16 |
| 31 | + SSL_ENABLED: false |
| 32 | + SESSION_DRIVER: redis |
| 33 | + PHP_VERSION: 8.3 |
| 34 | + services: |
| 35 | + mysql: |
| 36 | + image: mysql:8.0 |
| 37 | + env: |
| 38 | + MYSQL_ROOT_PASSWORD: ${{env.DB_PASSWORD}} |
| 39 | + MYSQL_DATABASE: ${{env.DB_DATABASE}} |
| 40 | + ports: |
| 41 | + - 3306:3306 |
| 42 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
23 | 43 | steps: |
24 | | - - name: 'Run Unit Tests' |
25 | | - run: cd / && ./tests.sh 2>&1 | tee /output.log |
| 44 | + - name: Create Redis |
| 45 | + uses: supercharge/redis-github-action@1.7.0 |
| 46 | + with: |
| 47 | + redis-port: ${{env.REDIS_PORT}} |
| 48 | + redis-password: ${{env.REDIS_PASSWORD}} |
| 49 | + # Downloads a copy of the code in your repository before running CI tests |
| 50 | + - name: Check out repository code |
| 51 | + uses: actions/checkout@v4 |
| 52 | + - name: Install PHP |
| 53 | + uses: "shivammathur/setup-php@v2" |
| 54 | + with: |
| 55 | + php-version: ${{env.PHP_VERSION}} |
| 56 | + extensions: pdo_mysql, mbstring, exif, pcntl, bcmath, sockets, gettext |
| 57 | + - name: Install dependencies |
| 58 | + uses: "ramsey/composer-install@v3" |
| 59 | + env: |
| 60 | + COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.PAT }}"} }' |
| 61 | + - name: 'Run Tests' |
| 62 | + run: | |
| 63 | + ./update_doctrine.sh |
| 64 | + php artisan doctrine:migrations:migrate --no-interaction |
| 65 | + php artisan db:seed --force |
| 66 | + vendor/bin/phpunit --log-junit results.xml |
26 | 67 | - name: 'Upload Unit Test Output' |
27 | 68 | uses: actions/upload-artifact@v4 |
28 | 69 | with: |
29 | 70 | name: output |
30 | | - path: /output.log |
| 71 | + path: results.xml |
31 | 72 | retention-days: 5 |
0 commit comments