diff --git a/.github/workflows/ci-cd.yaml b/.github/workflows/ci-cd.yaml new file mode 100644 index 0000000..7a5b59a --- /dev/null +++ b/.github/workflows/ci-cd.yaml @@ -0,0 +1,73 @@ +name: Main Ci/CD +on: + push: + branches-ignore: + - master + - develop +jobs: + tests: + runs-on: ubuntu-latest + steps: + - run: | + echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + echo "🔎 The name of branch is ${{ github.ref }} and repository is ${{ github.repository }}." + - name: Checkout + uses: actions/checkout@v3 + - run: | + echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + echo "🖥️ The workflow is now ready to test code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - name: Run tests + run: | + cd ${{ github.workspace }}/tests/install && ${{ github.workspace }}/tests/run-test-install.sh -c + - run: echo "🍏 This job's status is ${{ job.status }}." + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: lint + uses: luke142367/Docker-Lint-Action@v1.1.1 + with: + target: src/build/php/Dockerfile + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - uses: actions/github-script@0.6.0 + id: pr + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + result-encoding: string + script: | + const result = await github.repos.listPullRequestsAssociatedWithCommit({ + owner: context.payload.repository.owner.name, + repo: context.payload.repository.name, + commit_sha: context.payload.head_commit.id + }) + return result.data[0].number; + - name: Get changed files + id: get_file_changes + uses: trilom/file-changes-action@v1.2.3 + with: + githubToken: ${{ secrets.GITHUB_TOKEN }} + prNumber: ${{ steps.pr.outputs.results }} + output: ' ' + fileOutput: ' ' + - name: Echo file changes + run: | + echo Changed files: ${{ steps.get_file_changes.outputs.files }} + cat $HOME/files.json + cat $HOME/files_modified.json + cat $HOME/files_added.json + cat $HOME/files_removed.json + echo '${{ steps.file_changes.outputs.files}}' + echo '${{ steps.file_changes.outputs.files_modified}}' + echo '${{ steps.file_changes.outputs.files_added}}' + echo '${{ steps.file_changes.outputs.files_removed}}' diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml deleted file mode 100644 index 6f67a1c..0000000 --- a/.github/workflows/main.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: Main Ci/CD -on: [push] -jobs: - tests: - runs-on: ubuntu-latest - steps: - - run: | - echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" - echo "🔎 The name of branch is ${{ github.ref }} and repository is ${{ github.repository }}." - - name: Checkout - uses: actions/checkout@v3 - - run: | - echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - echo "🖥️ The workflow is now ready to test code on the runner." - - name: List files in the repository - run: | - ls ${{ github.workspace }} - - name: Run tests - run: | - cd ${{ github.workspace }}/tests/install && ${{ github.workspace }}/tests/run-test-install.sh -c - - run: echo "🍏 This job's status is ${{ job.status }}." - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: lint - uses: luke142367/Docker-Lint-Action@v1.1.1 - with: - target: src/build/php/Dockerfile - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file