Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
feat: use @socialgouv/actions (#524)
Browse files Browse the repository at this point in the history
* feat: use @socialgouv/actions

* test

* dockerfile

* dockerfile

* dockerfile

* dockerfile

* fix: mv server

* fix: add PG to app container

* dockerfile

* dockerfile

* dockerfile

* port

* fix
  • Loading branch information
Julien Bouquillon authored Sep 16, 2021
1 parent f4bd5f7 commit be58df3
Show file tree
Hide file tree
Showing 30 changed files with 454 additions and 396 deletions.
2 changes: 2 additions & 0 deletions .github/dev.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SOCIALGOUV_BASE_DOMAIN=dev.fabrique.social.gouv.fr
RANCHER_PROJECT_ID=c-gjtkk:p-94v9x
2 changes: 2 additions & 0 deletions .github/preprod.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SOCIALGOUV_BASE_DOMAIN=dev.fabrique.social.gouv.fr
RANCHER_PROJECT_ID=c-gjtkk:p-94v9x
2 changes: 2 additions & 0 deletions .github/prod.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SOCIALGOUV_BASE_DOMAIN=fabrique.social.gouv.fr
RANCHER_PROJECT_ID=c-5rj5b:p-tgccq
2 changes: 1 addition & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"$schema": "http://json.schemastore.org/renovate",
"extends": ["github>SocialGouv/renovate-config:light", ":automergeAll"]
"extends": ["github>SocialGouv/renovate-config:light"]
}
24 changes: 0 additions & 24 deletions .github/stale.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '18 6 * * 2'
- cron: '22 3 * * 4'

jobs:
analyze:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/deactivate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 🇫🇷

on:
pull_request:
types: [closed]

jobs:
bury_review_env:
name: 🪦 Review
runs-on: ubuntu-latest
steps:
- uses: SocialGouv/actions/k8s-funeral@master
with:
kube-config: ${{ secrets.KUBECONFIG }}
15 changes: 0 additions & 15 deletions .github/workflows/gitlab.yaml

This file was deleted.

98 changes: 98 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Production

on:
push:
tags:
- v*

concurrency:
group: preproduction
cancel-in-progress: true

jobs:
##############################################################################
## BUILD AND REGISTER DOCKER IMAGE
##############################################################################
register:
name: Build & Register docker images
runs-on: ubuntu-latest
steps:
- name: Get project name
run: |
echo "project=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Application
uses: SocialGouv/actions/autodevops-build-register@master
with:
project: ${{ env.project }}
token: ${{ secrets.GITHUB_TOKEN }}
imageName: ${{ env.project }}/app

- name: Hasura
uses: SocialGouv/actions/autodevops-build-register@master
with:
project: ${{ env.project }}
token: ${{ secrets.GITHUB_TOKEN }}
imageName: ${{ env.project }}/hasura
dockercontext: ./hasura
dockerfile: ./hasura/Dockerfile

##############################################################################
## GENERATE PREPRODUCTION MANIFESTS
##############################################################################
manifests:
name: Preproduction manifests
runs-on: ubuntu-latest
steps:
- name: Use k8s manifests generation
uses: SocialGouv/actions/k8s-manifests@master
with:
environment: "preprod"

##############################################################################
## DEPLOY PREPRODUCTION APPLICATION
##############################################################################
deploy-preprod:
name: Deploy preproduction
runs-on: ubuntu-latest
needs: [register, manifests]
environment:
name: preproduction
url: https://sample-next-app-preprod.${{ env.SOCIALGOUV_BASE_DOMAIN }}
steps:
- name: Use autodevops deployment
uses: SocialGouv/actions/autodevops-deploy@master
with:
environment: "preprod"
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.KUBECONFIG }}

##############################################################################
## GENERATE PRODUCTION MANIFESTS
##############################################################################
manifests-prod:
name: Production manifests
runs-on: ubuntu-latest
steps:
- name: Use k8s manifests generation
uses: SocialGouv/actions/k8s-manifests@master
with:
environment: "prod"

##############################################################################
## DEPLOY PRODUCTION APPLICATION
##############################################################################
deploy-prod:
name: Deploy production
runs-on: ubuntu-latest
needs: [deploy-preprod, manifests-prod]
environment:
name: production
url: https://sample-next-app.${{ env.SOCIALGOUV_BASE_DOMAIN }}
steps:
- name: Use autodevops deployment
uses: SocialGouv/actions/autodevops-deploy@master
with:
environment: "prod"
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.KUBECONFIG }}
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release

on:
workflow_dispatch:
push:
branches: [master, alpha, beta, next]

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 17
extra_plugins: |
@semantic-release/[email protected]
@semantic-release/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.SOCIALGROOVYBOT_BOTO_PAT }}
67 changes: 67 additions & 0 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Review

on:
push:
branches:
- "**"
tags-ignore:
- v*

concurrency:
cancel-in-progress: true
group: ${{ github.ref }}

jobs:
##############################################################################
## BUILD AND REGISTER DOCKER IMAGES
##############################################################################
register:
name: Build & Register
runs-on: ubuntu-latest
steps:
- name: Get project name
run: |
echo "project=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Application
uses: SocialGouv/actions/autodevops-build-register@master
with:
project: ${{ env.project }}
token: ${{ secrets.GITHUB_TOKEN }}
imageName: ${{ env.project }}/app

- name: Hasura
uses: SocialGouv/actions/autodevops-build-register@master
with:
project: ${{ env.project }}
token: ${{ secrets.GITHUB_TOKEN }}
imageName: ${{ env.project }}/hasura
dockercontext: ./hasura
dockerfile: ./hasura/Dockerfile

##############################################################################
## GENERATE KUBERNETES MANIFESTS
##############################################################################
manifests:
name: Generate k8s manifests
runs-on: ubuntu-latest
steps:
- name: Use k8s manifests generation
uses: SocialGouv/actions/k8s-manifests@master
with:
environment: "dev"

##############################################################################
## DEPLOY APPLICATION OVER KUBERNETES
##############################################################################
deploy:
name: Deploy application
runs-on: ubuntu-latest
needs: [register, manifests]
steps:
- name: Use autodevops deployment
uses: SocialGouv/actions/autodevops-deploy@master
with:
environment: "dev"
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.KUBECONFIG }}
27 changes: 0 additions & 27 deletions .github/workflows/sync-autodevops-branch.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Tests

on:
pull_request:
branches:
- '**'

concurrency:
cancel-in-progress: true
group: ${{ github.head_ref }}

jobs:

##############################################################################
## TEST APPLICATION
##############################################################################
test:
name: Test application
runs-on: ubuntu-latest
steps:

- name: Checkout repository
uses: actions/checkout@v2

- name: Node setup
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Yarn cache setup
uses: c-hive/gha-yarn-cache@v1

- name: Install dependencies
run: yarn --frozen-lockfile --prefer-offline

- name: Run tests
run: yarn test --coverage
39 changes: 0 additions & 39 deletions .github/workflows/workflows-src.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/🇫🇷.yaml

This file was deleted.

Loading

0 comments on commit be58df3

Please sign in to comment.