Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Init GitHub actions #12

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
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/[email protected]
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}}'
23 changes: 13 additions & 10 deletions src/build/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 && \
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down