Merge pull request #44 from Moros1138/fix-workflows #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: UnitTests | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
pgetinker-tests: | |
runs-on: self-hosted | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Dependencies | |
run: npm install && npm run build && composer install --prefer-dist --no-interaction --no-progress && php artisan dusk:chrome-driver --detect | |
- name: Get Commit Hash | |
id: vars | |
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- name: Add "VERSION" hash to .env | |
run: echo "VERSION=${{ steps.vars.outputs.sha }}" >> .env.example | |
- name: Add "VITE_VERSION" hash to .env | |
run: echo "VITE_VERSION=${{ steps.vars.outputs.sha }}" >> .env.example | |
- name: Copy environment file and set version | |
run: cp .env.example .env | |
- name: Build Library Objects | |
run: bash build-libs.sh | |
- name: Generate app key | |
run: php artisan key:generate | |
- name: Create Database File | |
run: touch database/database.sqlite | |
- name: Initial Database Migration | |
run: php artisan migrate | |
- name: Execute Unit Tests | |
run: php artisan test | |
- name: Run Server | |
run: php artisan serve & | |
- name: Execute Browser Tests | |
run: php artisan dusk | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: | | |
${{ secrets.DOCKERHUB_USERNAME }}/pgetinker:${{ steps.vars.outputs.sha }} | |
${{ secrets.DOCKERHUB_USERNAME }}/pgetinker:latest | |