Merge pull request #45 from Moros1138/fix-workflows #26
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: Login to DockerHub | |
run: docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Docker Image | |
run: docker buildx build -t ${{ secrets.DOCKERHUB_USERNAME }}/pgetinker:${{ steps.vars.outputs.sha }} -t ${{ secrets.DOCKERHUB_USERNAME }}/pgetinker:latest . | |
- name: Push Docker Image | |
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/pgetinker:latest -a | |
- name: Clean up Docker | |
run: docker image rm ${{ secrets.DOCKERHUB_USERNAME }}/pgetinker:latest | |
- name: Logout of DockerHub | |
run: docker logout |