11---
22name : Ansible molecule
3- ' on ' :
3+ on :
44 pull_request :
5- push :
65 branches :
76 - master
8-
7+ types : [labeled]
98jobs :
109
1110 test :
1211 name : Lint
1312 runs-on : ubuntu-latest
1413 strategy :
1514 matrix :
16- node : [archlinux, default]
15+ node :
16+ - ubuntu
17+ - centos
18+ - amazonlinux
1719
1820 steps :
1921 - name : Check out the codebase.
@@ -25,32 +27,34 @@ jobs:
2527 python-version : ' 3.x'
2628
2729 - name : Install test dependencies.
28- run : pip3 install yamllint ansible-lint
29-
30- - name : Run yamllint.
31- run : yamllint .
32-
33- - name : Run ansible-lint.
34- run : ansible-lint
35-
36- - name : Set up Python 3.
37- uses : actions/setup-python@v2
30+ if : ${{ github.event.label.name == 'molecule' }}
31+ run : |
32+ sudo apt-get update
33+ sudo apt-get install ansible -y
34+ pip3 install ansible molecule[docker] docker
35+
36+ - name : ' Run molecule on the ${{ matrix.node }}'
37+ if : ${{ github.event.label.name == 'molecule' }}
38+ run : |
39+ molecule test --scenario-name=${{ matrix.node }} > file.txt
40+ echo 'output<<EOF' >> $GITHUB_ENV
41+ cat file.txt >> $GITHUB_ENV
42+ echo 'EOF' >> $GITHUB_ENV
43+ id : ls
44+
45+ - name : ' PR Comment'
46+ uses : actions-ecosystem/action-create-comment@v1
3847 with :
39- python-version : ' 3.x'
40-
41- - name : Install test dependencies.
42- run : pip3 install ansible molecule[docker] docker
43-
44- - name : Run Molecule tests.
45- run : molecule test --scenario-name ${{ matrix.node }}
46-
48+ github_token : ${{ secrets.GITHUB }}
49+ body : |
50+ ${{ env.output }}
4751 - name : ' Slack Notification'
4852 uses : clouddrove/action-slack@v2
4953 with :
5054 status : ${{ job.status }}
5155 fields : repo,author
5256 author_name : ' CloudDrove'
5357 env :
54- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
58+ GITHUB_TOKEN : ${{ secrets.GITHUB }}
5559 SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK }}
5660 if : always()
0 commit comments