Skip to content

Support GitHub deployments #91

Support GitHub deployments

Support GitHub deployments #91

Workflow file for this run

name: Continuous Integration
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
jobs:
test:
name: Tests
runs-on: ubuntu-latest
permissions:
deployments: write
steps:
# cloning into "root" does not work when trying to call the action from itself
# inspired by Microsoft: https://github.com/microsoft/action-python/blob/c8ec939994d7ed2ec77b7bbe59ed5f5b72fb5607/.github/workflows/test.yml#L21
- name: Checkout
uses: actions/checkout@v4
with:
path: action
clean: true
- name: Run test server
run: |
docker compose build
docker compose up &
working-directory: action
- name: Add SSH identity of test server to known hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan -t rsa -p 2222 127.0.0.1 >> ~/.ssh/known_hosts
- name: Test
uses: ./action
with:
compose-file: action/docker-compose.test.yml
environment: "test"
environment-url: "https://www.simplificator.com"
secrets: |
- name: secret
value: ${{ secrets.SECRET }}
stack-name: david
ssh-user-at-host: [email protected]
ssh-port: 2222
- name: Check if test application is available
run: |
response=$(curl -s 'http://127.0.0.1:8888')
if echo "$response" | grep -q "Hello World"; then
echo "Pattern matched."
exit 0
else
echo "Pattern not matched."
exit 1
fi
shell: bash