feat added cypress test after deployment #2
Workflow file for this run
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: Deployment | ||
Check failure on line 1 in .github/workflows/deployment.yaml GitHub Actions / .github/workflows/deployment.yamlInvalid workflow file
|
||
on: | ||
workflow_run: | ||
fork: | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
- name: Make db env file | ||
uses: SpicyPizza/[email protected] | ||
with: | ||
envkey_POSTGRES_PASSWORD : ${{ secrets.POSTGRES_PASSWORD }} | ||
envkey_POSTGRES_USER : ${{ secrets.POSTGRES_USER }} | ||
envkey_POSTGRES_DB : ${{ secrets.POSTGRES_DB }} | ||
directory: . | ||
file_name: db.env | ||
fail_on_empty: false | ||
- name: Make api env files | ||
uses: SpicyPizza/[email protected] | ||
with: | ||
envkey_DATABASE_URL : ${{ secrets.DATABASE_URL }} | ||
envkey_DATABASE_PORT : ${{ secrets.DATABASE_PORT }} | ||
envkey_DATABASE_NAME : ${{ secrets.DATABASE_NAME }} | ||
envkey_DATABASE_USER : ${{ secrets.DATABASE_USER }} | ||
envkey_DATABASE_PASSWORD : ${{ secrets.DATABASE_PASSWORD }} | ||
envkey_COMPANY_EMAIL : ${{ secrets.COMPANY_EMAIL }} | ||
envkey_COMPANY_AUTH : ${{ secrets.COMPANY_AUTH }} | ||
directory: . | ||
file_name: api.env | ||
fail_on_empty: false | ||
- name: Make fe env files | ||
uses: SpicyPizza/[email protected] | ||
with: | ||
envkey_API_URL : ${{ secrets.API_URL }} | ||
directory: . | ||
file_name: fe.env | ||
fail_on_empty: false | ||
- name: Docker compose build | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
docker compose build | ||
- name: Make it a tar file | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
docker save -o frontend.tar dispute-resolution-engine-frontend:latest | ||
docker save -o api.tar api | ||
docker save -o postgres.tar postgres | ||
- name: Install wireguard | ||
run: sudo apt-get install wireguard | ||
- name: Create WG Config | ||
run: | | ||
sed -i -e "s@{{WG_PRIVATEKEY}}@${{ secrets.WG_PRIVATEKEY }}@" $GITHUB_WORKSPACE/tunnel.conf | ||
sed -i -e "s@{{WG_ADDRESS}}@${{ secrets.WG_ADDRESS }}@" $GITHUB_WORKSPACE/tunnel.conf | ||
sed -i -e "s@{{WG_DNS}}@${{ secrets.WG_DNS }}@" $GITHUB_WORKSPACE/tunnel.conf | ||
sed -i -e "s@{{WG_PUBLICKEY}}@${{ secrets.WG_PUBLICKEY }}@" $GITHUB_WORKSPACE/tunnel.conf | ||
sed -i -e "s@{{WG_ALLOWEDIPS}}@${{ secrets.WG_ALLOWEDIPS }}@" $GITHUB_WORKSPACE/tunnel.conf | ||
sed -i -e "s@{{WG_ENDPOINT}}@${{ secrets.WG_ENDPOINT }}@" $GITHUB_WORKSPACE/tunnel.conf | ||
sudo cp $GITHUB_WORKSPACE/tunnel.conf /etc/wireguard/ | ||
- name: WG Creating Tunnel | ||
run: | | ||
sudo apt install resolvconf | ||
wg-quick up $GITHUB_WORKSPACE/tunnel.conf | ||
- name: Send through the docker container using scp | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
password: ${{ secrets.SSH_PASSWORD }} | ||
port: ${{ secrets.SSH_PORT }} | ||
source: "api.tar,frontend.tar,postgres.tar,docker-compose.yaml" | ||
target: ./ | ||
- name: Spin up docker image | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
password: ${{ secrets.SSH_PASSWORD }} | ||
port: ${{ secrets.SSH_PORT }} | ||
script: | | ||
docker load -i frontend.tar | ||
docker load -i api.tar | ||
docker load -i postgres.tar | ||
docker-compose up -d | ||
cypress-test: | ||
container: | ||
image: cypress/included | ||
needs: deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
- name: Cypress run | ||
uses: cypress-io/github-action@v2 | ||
with: | ||
wait-on: 'http://capstone-dre.dns.net.za' | ||
wait-on-timeout: 300 |