-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #578 from Crown-Commercial-Service/release-2.0.0
STAGING - Release 2.0.0
- Loading branch information
Showing
79 changed files
with
2,259 additions
and
1,175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: "Deploy latest code to GPaaS" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
description: 'The name of the environment we are deploying to' | ||
required: true | ||
type: string | ||
secrets: | ||
CF_API: | ||
description: 'The GPaaS API' | ||
required: true | ||
CF_USERNAME: | ||
description: 'The GPaaS Username' | ||
required: true | ||
CF_PASSWORD: | ||
description: 'The GPaaS Password' | ||
required: true | ||
CF_ORG: | ||
description: 'The org to deploy to' | ||
required: true | ||
|
||
concurrency: | ||
group: deploy-${{ inputs.environment }} | ||
|
||
jobs: | ||
run-unit-tests: | ||
uses: ./.github/workflows/rubyonrails.yml | ||
|
||
run-docker-tests: | ||
uses: ./.github/workflows/docker-image.yml | ||
|
||
deploy-to-application: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- run-unit-tests | ||
- run-docker-tests | ||
environment: | ||
name: ${{ inputs.environment }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Deploy to GPaaS | ||
uses: citizen-of-planet-earth/cf-cli-action@master | ||
with: | ||
cf_api: ${{ secrets.CF_API }} | ||
cf_username: ${{ secrets.CF_USERNAME }} | ||
cf_password: ${{ secrets.CF_PASSWORD }} | ||
cf_org: ${{ secrets.CF_ORG }} | ||
cf_space: ${{ inputs.environment }} | ||
command: push -f config/manifests/${{ inputs.environment }}.yml --strategy rolling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Build | ||
uses: docker/build-push-action@v5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
name: "Ruby on Rails CI" | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- develop | ||
- staging | ||
- main | ||
pull_request: | ||
workflow_call: | ||
inputs: | ||
publish_test_report: | ||
description: 'A trigger to publish the test report' | ||
default: false | ||
required: false | ||
type: boolean | ||
secrets: | ||
cc_test_reporter_id: | ||
description: 'The code climate test report ID' | ||
required: false | ||
|
||
jobs: | ||
unit-test: | ||
|
@@ -25,14 +30,14 @@ jobs: | |
env: | ||
RAILS_ENV: test | ||
DATABASE_URL: "postgis://rails:password@localhost:5432/rails_test" | ||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
CC_TEST_REPORTER_ID: ${{ secrets.cc_test_reporter_id }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Ruby and gems | ||
uses: ruby/setup-ruby@v1.154.0 | ||
uses: ruby/setup-ruby@v1.159.0 | ||
with: | ||
bundler-cache: true | ||
|
||
|
@@ -49,4 +54,4 @@ jobs: | |
uses: paambaati/[email protected] | ||
with: | ||
debug: true | ||
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'develop' }} | ||
if: ${{ inputs.publish_test_report }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: "Set up deployment of latest code to GPaaS" | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- staging | ||
- main | ||
|
||
jobs: | ||
determine-environment: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
ENV_NAME: ${{ steps.determine_environment.outputs.ENV_NAME }} | ||
steps: | ||
- name: Determine the environment to deploy to | ||
id: determine_environment | ||
run: | | ||
echo "ENV_NAME=$( | ||
case ${{ github.ref }} in | ||
"refs/heads/develop") | ||
echo "development" | ||
;; | ||
"refs/heads/staging") | ||
echo "pre-production" | ||
;; | ||
"refs/heads/main") | ||
echo "production" | ||
;; | ||
*) | ||
echo "FAIL" | ||
;; | ||
esac | ||
)" >> $GITHUB_OUTPUT | ||
- name: Fail if not an environment | ||
run: | | ||
echo "ERROR: No environment found" | ||
exit 1 | ||
if: steps.determine_environment.outputs.ENV_NAME == 'FAIL' | ||
|
||
- name: Show where we are deploying to | ||
run: echo "We will deploy to ${{ steps.determine_environment.outputs.ENV_NAME }}" | ||
|
||
deploy-to-gpaas: | ||
uses: ./.github/workflows/deploy_to_gpaas.yml | ||
needs: | ||
- determine-environment | ||
with: | ||
environment: ${{ needs.determine-environment.outputs.ENV_NAME }} | ||
secrets: | ||
CF_API: ${{ secrets.CF_API }} | ||
CF_USERNAME: ${{ secrets.CF_USERNAME }} | ||
CF_PASSWORD: ${{ secrets.CF_PASSWORD }} | ||
CF_ORG: ${{ secrets.CF_ORG }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: "Run our tests" | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- develop | ||
- staging | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
run-unit-tests: | ||
uses: ./.github/workflows/rubyonrails.yml | ||
with: | ||
publish_test_report: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'develop' }} | ||
secrets: | ||
cc_test_reporter_id: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
|
||
run-docker-build: | ||
uses: ./.github/workflows/docker-image.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
16 | ||
20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.2.1 | ||
3.2.2 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,47 @@ | ||
FROM ruby:3.2.1 | ||
|
||
# Pass in nodejs version | ||
ARG NODE_VERSION=20.0.0 | ||
|
||
# Pull in the nodejs image | ||
FROM node:${NODE_VERSION}-alpine AS node | ||
|
||
# Pull in relevant ruby image | ||
FROM ruby:3.2.2-alpine | ||
|
||
# As this is a multistage Docker image build | ||
# we will pull in the contents from the previous node image build stage | ||
# to our current ruby build image stage | ||
# so that the ruby image build stage has the correct nodejs version | ||
COPY --from=node /usr/lib /usr/lib | ||
COPY --from=node /usr/local/share /usr/local/share | ||
COPY --from=node /usr/local/lib /usr/local/lib | ||
COPY --from=node /usr/local/include /usr/local/include | ||
COPY --from=node /usr/local/bin /usr/local/bin | ||
|
||
# Set the app directory | ||
WORKDIR /app | ||
|
||
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ | ||
apt-get update && \ | ||
apt-get install -y nodejs && \ | ||
npm install -g [email protected] | ||
# Install application dependencies | ||
RUN apk add --update --no-cache \ | ||
npm \ | ||
ca-certificates \ | ||
build-base \ | ||
libpq-dev \ | ||
git \ | ||
tzdata \ | ||
curl | ||
|
||
COPY Gemfile Gemfile.lock ./ | ||
RUN npm install -g [email protected] --force | ||
|
||
RUN yarn install --check-files | ||
|
||
RUN gem install bundler && bundle install --jobs 20 --retry 5 | ||
|
||
COPY . . | ||
|
||
RUN rake assets:precompile | ||
COPY Gemfile Gemfile.lock ./ | ||
|
||
RUN gem install bundler && bundle install --jobs 20 --retry 5 | ||
|
||
RUN NODE_OPTIONS=--openssl-legacy-provider rake assets:precompile | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["rails", "server", "-b", "0.0.0.0"] | ||
CMD ["rails", "server", "-b", "0.0.0.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.