aboutsummaryrefslogblamecommitdiffhomepage
path: root/.github/workflows/pr.yml
blob: ee67f999198d5e6911f16706cc9dc38208faae6c (plain) (tree)
1
2
3
4
5
6
7
8
9
10







               

                                       




                          
                                                 


                     
                                                     







                                                                        
             
                                          



                                                



                                                                    
              



                                                                                                                                
              
                                                                                     






                                             
                                              
             
                                                         
name: Test PR
on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
  release:
    types: [created, edited, published]
jobs:
  tests:
    runs-on: ubuntu-latest
    services:
      rundeck:
        image: fretlink/rundeckforci:3.4.7-latest
        ports:
          - 4440:4440
        env:
          RUNDECK_TOKENS_FILE: /etc/tokens.properties
        options: >-
          --health-interval=10s
          --health-cmd="wget -t 1 -q -O /dev/null http://localhost:4440"
          --health-timeout 5s
          --health-retries 15

    steps:
      - uses: actions/checkout@v2
        with:
          path: "${{ github.repository }}"
      - name: Lint Ansible Playbook
        uses: ansible/ansible-lint-action@master
        with:
          targets: "${{ github.repository }}"
          # override lint version due to
          # https://github.com/ansible/ansible-lint-action/issues/59
          override-deps: |
            ansible-lint==5.3.2
      - run: |
          sudo apt update && sudo apt install -y python3-pip
          pip3 install -r ${{ github.repository }}/requirements.txt
          pip3 install -r ${{ github.repository }}/tests/requirements.txt
      - run: http --ignore-stdin localhost:4440/api/26/projects name=test X-Rundeck-Auth-Token:testtoken Accept:application/json
      - run: |
          cd ${{ github.repository }}/tests && ansible-playbook -i inventory test.yml
  publish:
    runs-on: ubuntu-latest
    needs: tests
    if: ${{ github.event_name == 'release' }}
    steps:
      - uses: actions/checkout@v2
      - name: Upload to ansible-galaxy
        uses: robertdebock/galaxy-action@1.1.0
        with:
          galaxy_api_key: '${{ secrets.GALAXY_API_KEY }}'