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/src/build/php/Dockerfile b/src/build/php/Dockerfile index 2d9ae58..a1f8905 100644 --- a/src/build/php/Dockerfile +++ b/src/build/php/Dockerfile @@ -7,14 +7,14 @@ ENV SSH_PASSWORD root # sodium # php ^7.2 -RUN apt-get update && apt-cache search libsodium && apt-get install -y libsodium-dev # libsodium18 +RUN apt-get update && apt-cache search libsodium && apt-get install --no-install-recommends -y libsodium-dev && rm -rf /var/lib/apt/lists/* # libsodium18 # Install System Dependencies RUN requirements="libcurl3-dev libfreetype6 libjpeg62-turbo libjpeg62-turbo-dev libpng-dev libfreetype6-dev libicu-dev libxslt1-dev" \ apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends software-properties-common \ && apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ libcurl3-dev libfreetype6 libjpeg62-turbo libjpeg62-turbo-dev libpng-dev libfreetype6-dev libicu-dev libxslt1-dev \ libicu-dev \ libssl-dev \ @@ -38,7 +38,8 @@ RUN requirements="libcurl3-dev libfreetype6 libjpeg62-turbo libjpeg62-turbo-dev tar \ cron \ bash-completion \ - && apt-get clean + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* # Install XDebug RUN yes | pecl install xdebug && \ @@ -61,9 +62,10 @@ RUN docker-php-ext-configure \ # Install OpenSSH server RUN apt-get update \ - && apt-get install -y openssh-server \ - sudo \ - openssh-server + && apt-get install -y --no-install-recommends openssh-server \ + # sudo \ + openssh-server \ + && rm -rf /var/lib/apt/lists/* RUN mkdir /var/run/sshd RUN echo "${SSH_USER}:${SSH_PASSWORD}" | chpasswd RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config @@ -73,16 +75,17 @@ EXPOSE 22 # Install oAuth RUN apt-get update \ - && apt-get install -y \ + && apt-get install -y --no-install-recommends \ libpcre3 \ libpcre3-dev \ # php-pear \ && pecl install oauth \ - && echo "extension=oauth.so" > /usr/local/etc/php/conf.d/docker-php-ext-oauth.ini + && echo "extension=oauth.so" > /usr/local/etc/php/conf.d/docker-php-ext-oauth.ini \ + && rm -rf /var/lib/apt/lists/* # Install Node, NVM, NPM and Grunt RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \ - && apt-get install -y nodejs build-essential \ + && apt-get install -y --no-install-recommends nodejs build-essential \ && curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | sh \ && npm i -g grunt-cli yarn requirejs @@ -95,7 +98,7 @@ RUN echo "memory_limit=2048M" >> /usr/local/etc/php/conf.d/common.ini \ && echo "max_input_time=1000" >> /usr/local/etc/php/conf.d/common.ini # Install Mhsendmail -RUN DEBIAN_FRONTEND=noninteractive apt-get -y install golang-go \ +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends golang-go \ && mkdir /opt/go \ && export GOPATH=/opt/go \ && go get github.com/mailhog/mhsendmail