|
| 1 | +name: Main Ci/CD |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches-ignore: |
| 5 | + - master |
| 6 | + - develop |
| 7 | +jobs: |
| 8 | + tests: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - run: | |
| 12 | + echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." |
| 13 | + echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" |
| 14 | + echo "🔎 The name of branch is ${{ github.ref }} and repository is ${{ github.repository }}." |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v3 |
| 17 | + - run: | |
| 18 | + echo "💡 The ${{ github.repository }} repository has been cloned to the runner." |
| 19 | + echo "🖥️ The workflow is now ready to test code on the runner." |
| 20 | + - name: List files in the repository |
| 21 | + run: | |
| 22 | + ls ${{ github.workspace }} |
| 23 | + - name: Run tests |
| 24 | + run: | |
| 25 | + cd ${{ github.workspace }}/tests/install && ${{ github.workspace }}/tests/run-test-install.sh -c |
| 26 | + - run: echo "🍏 This job's status is ${{ job.status }}." |
| 27 | + lint: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@v3 |
| 32 | + - name: lint |
| 33 | + uses: luke142367/[email protected] |
| 34 | + with: |
| 35 | + target: src/build/php/Dockerfile |
| 36 | + env: |
| 37 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 38 | + build: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - name: Checkout |
| 42 | + uses: actions/checkout@v3 |
| 43 | + |
| 44 | + id: pr |
| 45 | + with: |
| 46 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 47 | + result-encoding: string |
| 48 | + script: | |
| 49 | + const result = await github.repos.listPullRequestsAssociatedWithCommit({ |
| 50 | + owner: context.payload.repository.owner.name, |
| 51 | + repo: context.payload.repository.name, |
| 52 | + commit_sha: context.payload.head_commit.id |
| 53 | + }) |
| 54 | + return result.data[0].number; |
| 55 | + - name: Get changed files |
| 56 | + id: get_file_changes |
| 57 | + |
| 58 | + with: |
| 59 | + githubToken: ${{ secrets.GITHUB_TOKEN }} |
| 60 | + prNumber: ${{ steps.pr.outputs.results }} |
| 61 | + output: ' ' |
| 62 | + fileOutput: ' ' |
| 63 | + - name: Echo file changes |
| 64 | + run: | |
| 65 | + echo Changed files: ${{ steps.get_file_changes.outputs.files }} |
| 66 | + cat $HOME/files.json |
| 67 | + cat $HOME/files_modified.json |
| 68 | + cat $HOME/files_added.json |
| 69 | + cat $HOME/files_removed.json |
| 70 | + echo '${{ steps.file_changes.outputs.files}}' |
| 71 | + echo '${{ steps.file_changes.outputs.files_modified}}' |
| 72 | + echo '${{ steps.file_changes.outputs.files_added}}' |
| 73 | + echo '${{ steps.file_changes.outputs.files_removed}}' |
0 commit comments