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

Create a CI pipeline in github workflows #477

Merged
merged 53 commits into from
Aug 19, 2024
Merged
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
68b6455
Improvements to the docker setup:
scottaubrey Aug 13, 2024
81b14ab
run all services in docker
scottaubrey Aug 13, 2024
1b61478
improve docs
scottaubrey Aug 13, 2024
72f7282
Remove unused network
scottaubrey Aug 13, 2024
1b56f66
create a CI pipeline running in github workflows, that tests and then…
scottaubrey Aug 13, 2024
91578c4
fix ci running PHPCS
scottaubrey Aug 13, 2024
011c5a7
fix missing checkout step
scottaubrey Aug 13, 2024
84273df
combine test and lint step to reduce image builds
scottaubrey Aug 13, 2024
7a67dbd
fix some labels
scottaubrey Aug 13, 2024
d5c5561
output more logs
scottaubrey Aug 13, 2024
405591e
install dependencies
scottaubrey Aug 13, 2024
80f72f1
improve ordering of steps
scottaubrey Aug 13, 2024
851fe00
improve ordering of steps
scottaubrey Aug 13, 2024
a2d8053
Build dependencies in image and during setup
scottaubrey Aug 13, 2024
8f1e3e6
Merge branch 'improve-docker' into github-workflow-ci
scottaubrey Aug 13, 2024
b642637
remove unnecessary step
scottaubrey Aug 13, 2024
d7cd670
fix issues with getting exptected results form the wrong API
scottaubrey Aug 13, 2024
b2b8e8d
add missing config for running tests
scottaubrey Aug 13, 2024
db5ffe6
bring api-dummy up with app
scottaubrey Aug 13, 2024
8f2be28
only bring the app upp, and reduce repeated tests
scottaubrey Aug 13, 2024
a33405c
add missing util used by project_tests.sh
scottaubrey Aug 13, 2024
99ada8b
Merge branch 'improve-docker' into github-workflow-ci
scottaubrey Aug 13, 2024
d13667f
fix app service dependency on api-dummy, add a healthcheck
scottaubrey Aug 13, 2024
2c511bd
Merge branch 'improve-docker' into github-workflow-ci
scottaubrey Aug 13, 2024
ac3133b
undo unnecessary change
scottaubrey Aug 13, 2024
c916294
add missing too for smoke tests
scottaubrey Aug 13, 2024
dedb57a
Merge branch 'improve-docker' into github-workflow-ci
scottaubrey Aug 13, 2024
eb2bdfe
remove superflous renaming config
scottaubrey Aug 14, 2024
58eb6f5
fixes to allow project_tests.sh to run in docker
scottaubrey Aug 14, 2024
3fb0dc0
Merge branch 'improve-docker' into github-workflow-ci
scottaubrey Aug 14, 2024
b9ee038
construct a slimmer and more focused dev image and prod image
scottaubrey Aug 14, 2024
db5dbaa
Merge branch 'improve-docker' into github-workflow-ci
scottaubrey Aug 14, 2024
1617b49
fix missing target from other services
scottaubrey Aug 14, 2024
2db37bc
Merge branch 'improve-docker' into github-workflow-ci
scottaubrey Aug 14, 2024
a809956
add missing composer to dev image build
scottaubrey Aug 14, 2024
c41e7fc
Merge branch 'improve-docker' into github-workflow-ci
scottaubrey Aug 14, 2024
44c05ff
try to push image to temporary tag
scottaubrey Aug 14, 2024
69c8fd3
build correct image target
scottaubrey Aug 14, 2024
9656391
only build image on master
scottaubrey Aug 14, 2024
0f66336
improve incorrect docs
scottaubrey Aug 14, 2024
ca9527c
Merge branch 'improve-docker' into github-workflow-ci
scottaubrey Aug 14, 2024
20f4522
fix warnings with capitalisation
scottaubrey Aug 15, 2024
37f16ad
use apache for production server
scottaubrey Aug 15, 2024
f749ff9
Merge branch 'improve-docker' into github-workflow-ci
scottaubrey Aug 15, 2024
c358836
automate branch name for tagging, test not on master again
scottaubrey Aug 15, 2024
d92df7d
use apt-get, streamline package installs
scottaubrey Aug 15, 2024
35f8189
Merge branch 'improve-docker' into github-workflow-ci
scottaubrey Aug 15, 2024
0d2a6a3
disable building on non-master branches
scottaubrey Aug 15, 2024
c53b233
update localstack setup to match remove-gearman branch
scottaubrey Aug 15, 2024
62dbe82
Merge branch 'improve-docker' into github-workflow-ci
scottaubrey Aug 15, 2024
58049f5
grant correct writable path permissions
scottaubrey Aug 16, 2024
ee79b83
Merge branch 'improve-docker' into github-workflow-ci
scottaubrey Aug 16, 2024
672a0b7
Merge branch 'develop' into github-workflow-ci
scottaubrey Aug 19, 2024
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
70 changes: 70 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI Pipeline

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
branches:
- master
tags:
- '*'

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Copy example config
run: cp config.php.dist config.php
- name: Bring up test stack
run: docker compose up app --wait
- name: Debug bring up test stack
if: failure()
run: docker compose logs
- name: Project Tests
run: docker compose exec app bash /app/project_tests.sh
- name: Smoke Tests
run: docker compose exec app bash /app/smoke_tests.sh
- name: Take down test stack
if: always()
run: docker compose down
build-and-push:
needs: [tests]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
env:
IMAGE_REPO: ghcr.io/elifesciences/search
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get current date
id: date
run: echo "date=$(date --utc +%Y%m%d.%H%M)" >> $GITHUB_OUTPUT
- name: Get sha with 8 chars long
id: commit_sha
run: echo "commit_sha=${GITHUB_SHA:0:8}" >> $GITHUB_OUTPUT
- name: Build and push client image
uses: docker/build-push-action@v5
with:
push: true
load: false
platforms: linux/amd64,linux/arm64
target: prod
tags: |
${{ env.IMAGE_REPO }}:latest
${{ env.IMAGE_REPO }}:${{ github.sha }}
${{ env.IMAGE_REPO }}:${{ env.BRANCH_NAME }}-${{ steps.commit_sha.outputs.commit_sha }}-${{ steps.date.outputs.date }}