Merge pull request #34 from simplificator/handover-renovate-updates #106
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: 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: Run a container to verify that docker system prune will work | |
run: | | |
ssh -p 2222 [email protected] docker run --name debian debian:12 | |
shell: bash | |
- 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 | |
- name: Check that docker-stack-wait image is still there | |
run: | | |
ssh -p 2222 [email protected] docker image inspect sudobmitch/docker-stack-wait:v0.2.5 | |
shell: bash | |
- name: Check that the Debian container got removed | |
run: | | |
if ssh -p 2222 [email protected] docker container inspect debian; then | |
echo "Debian container was not cleaned up!" | |
exit 1 | |
fi | |
shell: bash | |
- name: Check that the Debian image got removed | |
run: | | |
if ssh -p 2222 [email protected] docker image inspect debian:12; then | |
echo "Debian image was not cleaned up!" | |
exit 1 | |
fi | |
shell: bash |