Fix routes #22
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: Unit Tests | |
on: | |
push: | |
branches: | |
- '*' | |
tags: | |
- '*' | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Configure sysctl limits | |
run: | | |
sudo swapoff -a | |
sudo sysctl -w vm.swappiness=1 | |
sudo sysctl -w fs.file-max=262144 | |
sudo sysctl -w vm.max_map_count=262144 | |
- name: Make .env.test.local | |
run: | | |
touch .env.test.local | |
echo DATABASE_URL="mysql://doceww:[email protected]:3306/doceww?serverVersion=mariadb-10.10.0" >> .env.test.local | |
echo ELASTICSEARCH_HOST="127.0.0.1" >> .env.test.local | |
echo ELASTICSEARCH_PORT="9200" >> .env.test.local | |
echo ELASTICSEARCH_USERNAME="elastic" >> .env.test.local | |
echo ELASTICSEARCH_PASSWORD="" >> .env.test.local | |
- 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.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Shutdown Ubuntu MySQL (SUDO) | |
run: sudo service mysql stop | |
- name: Set up MariaDB | |
uses: getong/[email protected] | |
with: | |
mysql database: doceww_test | |
mysql user: doceww | |
mysql password: password | |
- name: Runs Elasticsearch | |
uses: getong/[email protected] | |
with: | |
elasticsearch version: '8.9.2' | |
host port: 9200 | |
container port: 9200 | |
host node port: 9300 | |
node port: 9300 | |
discovery type: 'single-node' | |
- name: Build doceww | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
load: true | |
pull: true | |
tags: dhilsfu/doceww:latest | |
cache-from: type=registry,ref=dhilsfu/doceww:buildcache | |
- name: Run Unit Tests | |
run: | | |
docker run --rm \ | |
-v "${GITHUB_WORKSPACE}/.env.test.local":/var/www/html/.env.test.local \ | |
--network host \ | |
dhilsfu/doceww:latest make test | |
deploy-image: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: | |
- unit-tests | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- 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.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Build & Push Symfony Base | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
pull: true | |
tags: dhilsfu/doceww:latest,dhilsfu/doceww:${{github.ref_name}} | |
cache-from: type=registry,ref=dhilsfu/doceww:buildcache | |
cache-to: type=registry,ref=dhilsfu/doceww:buildcache,mode=max | |
- name: Trigger Gitlab Deploy Job | |
run: | | |
curl -X POST \ | |
--fail \ | |
-F token=${{ secrets.GITLAB_CI_TOKEN }} \ | |
-F "ref=main" \ | |
-F "variables[APP_RELEASE_TAG]=${{github.ref_name}}" \ | |
https://git.lib.sfu.ca/api/v4/projects/532/trigger/pipeline |