Skip to content

Commit

Permalink
Merge branch 'staging' into feature/implicated-systems
Browse files Browse the repository at this point in the history
  • Loading branch information
clari182 committed Dec 3, 2024
2 parents 8c68760 + 56907df commit 444cae6
Show file tree
Hide file tree
Showing 30 changed files with 841 additions and 187 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ jobs:
- name: Install Netlify CLI
run: npm install netlify-cli -g

- name: Set branch context URL
run: |
if [[ ! -z "${{ inputs.netlify-alias }}" ]]; then
netlify env:set NEXTAUTH_URL ${{ inputs.site-url || vars.SITE_URL }} --scope functions --context "branch:${{ inputs.netlify-alias }}"
fi
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ vars.NETLIFY_SITE_ID }}

- name: Build using Netlify
run: netlify build --context ${{ inputs.netlify-context }} --offline
working-directory: site/gatsby-site
Expand All @@ -95,11 +104,9 @@ jobs:
GATSBY_ALGOLIA_SEARCH_KEY: ${{ vars.GATSBY_ALGOLIA_SEARCH_KEY }}
GATSBY_AVAILABLE_LANGUAGES: ${{ vars.GATSBY_AVAILABLE_LANGUAGES }}
GATSBY_REALM_APP_ID: ${{ vars.GATSBY_REALM_APP_ID }}
GOOGLE_TRANSLATE_API_KEY: ${{ secrets.GOOGLE_TRANSLATE_API_KEY }}
MONGODB_CONNECTION_STRING: ${{ secrets.MONGODB_CONNECTION_STRING }}
MONGODB_REPLICA_SET: ${{ secrets.MONGODB_REPLICA_SET }}
MONGODB_TRANSLATIONS_CONNECTION_STRING: ${{ secrets.MONGODB_TRANSLATIONS_CONNECTION_STRING }}
TRANSLATE_SUBMISSION_DATE_START: ${{ vars.TRANSLATE_SUBMISSION_DATE_START }}
MONGODB_MIGRATIONS_CONNECTION_STRING: ${{ secrets.MONGODB_MIGRATIONS_CONNECTION_STRING }}
GATSBY_REALM_APP_GRAPHQL_URL: ${{ secrets.GATSBY_REALM_APP_GRAPHQL_URL }}
GATSBY_PRISMIC_REPO_NAME: ${{ vars.GATSBY_PRISMIC_REPO_NAME }}
Expand All @@ -114,7 +121,6 @@ jobs:
CLOUDFLARE_R2_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
REALM_GRAPHQL_API_KEY: ${{ secrets.REALM_GRAPHQL_API_KEY }}
GATSBY_COMMIT_SHA: ${{ inputs.sha }}
TRANSLATE_DRY_RUN: ${{ vars.TRANSLATE_DRY_RUN }}
REALM_API_APP_ID: ${{ vars.REALM_API_APP_ID }}
REALM_API_GROUP_ID: ${{ vars.REALM_API_GROUP_ID }}
REALM_APP_ID: ${{ vars.GATSBY_REALM_APP_ID }}
Expand All @@ -123,6 +129,8 @@ jobs:
ROLLBAR_POST_SERVER_ITEM_ACCESS_TOKEN: ${{ secrets.GATSBY_ROLLBAR_TOKEN }}
API_MONGODB_CONNECTION_STRING: ${{ secrets.API_MONGODB_CONNECTION_STRING }}
SITE_URL: ${{ inputs.site-url || vars.SITE_URL }}
NEXTAUTH_URL: ${{ inputs.site-url || vars.SITE_URL }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}

- name: Build size
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ jobs:
NOTIFICATIONS_SENDER_NAME: Test Preview
NOTIFICATIONS_SENDER: [email protected]
SITE_URL: http://localhost:8000
NEXTAUTH_URL: http://localhost:8000
NEXTAUTH_SECRET: dummy

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,10 @@ jobs:
GATSBY_ALGOLIA_SEARCH_KEY: ${{ vars.GATSBY_ALGOLIA_SEARCH_KEY }}
GATSBY_AVAILABLE_LANGUAGES: ${{ vars.GATSBY_AVAILABLE_LANGUAGES }}
GATSBY_REALM_APP_ID: ${{ vars.GATSBY_REALM_APP_ID }}
GOOGLE_TRANSLATE_API_KEY: ${{ secrets.GOOGLE_TRANSLATE_API_KEY }}
MONGODB_CONNECTION_STRING: ${{ secrets.MONGODB_CONNECTION_STRING }}
MONGODB_REPLICA_SET: ${{ secrets.MONGODB_REPLICA_SET }}
MONGODB_TRANSLATIONS_CONNECTION_STRING: ${{ secrets.MONGODB_TRANSLATIONS_CONNECTION_STRING }}
MONGODB_MIGRATIONS_CONNECTION_STRING: ${{ secrets.MONGODB_MIGRATIONS_CONNECTION_STRING }}
TRANSLATE_SUBMISSION_DATE_START: ${{ vars.TRANSLATE_SUBMISSION_DATE_START }}
GATSBY_REALM_APP_GRAPHQL_URL: ${{ secrets.GATSBY_REALM_APP_GRAPHQL_URL }}
GATSBY_PRISMIC_REPO_NAME: ${{ vars.GATSBY_PRISMIC_REPO_NAME }}
PRISMIC_ACCESS_TOKEN: ${{ secrets.PRISMIC_ACCESS_TOKEN }}
Expand All @@ -109,6 +107,8 @@ jobs:
REALM_API_PRIVATE_KEY: ${{ secrets.REALM_API_PRIVATE_KEY }}
ROLLBAR_POST_SERVER_ITEM_ACCESS_TOKEN: ${{ secrets.GATSBY_ROLLBAR_TOKEN }}
API_MONGODB_CONNECTION_STRING: ${{ secrets.API_MONGODB_CONNECTION_STRING }}
NEXTAUTH_URL: http://localhost:8000
NEXTAUTH_SECRET: 678x1irXYWeiOqTwCv1awvkAUbO9eHa5xzQEYhxhMms= # only used in local tests

- name: Cache build
uses: actions/cache/save@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-playwright-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,9 @@ jobs:
GATSBY_ALGOLIA_SEARCH_KEY: ${{ vars.GATSBY_ALGOLIA_SEARCH_KEY }}
GATSBY_AVAILABLE_LANGUAGES: ${{ vars.GATSBY_AVAILABLE_LANGUAGES }}
GATSBY_REALM_APP_ID: ${{ vars.GATSBY_REALM_APP_ID }}
GOOGLE_TRANSLATE_API_KEY: ${{ secrets.GOOGLE_TRANSLATE_API_KEY }}
MONGODB_CONNECTION_STRING: mongodb://127.0.0.1:4110/
MONGODB_TRANSLATIONS_CONNECTION_STRING: mongodb://127.0.0.1:4110/
MONGODB_MIGRATIONS_CONNECTION_STRING: mongodb://127.0.0.1:4110/
TRANSLATE_SUBMISSION_DATE_START: ${{ vars.TRANSLATE_SUBMISSION_DATE_START }}
GATSBY_REALM_APP_GRAPHQL_URL: ${{ secrets.GATSBY_REALM_APP_GRAPHQL_URL }}
GATSBY_PRISMIC_REPO_NAME: ${{ vars.GATSBY_PRISMIC_REPO_NAME }}
PRISMIC_ACCESS_TOKEN: ${{ secrets.PRISMIC_ACCESS_TOKEN }}
Expand Down Expand Up @@ -137,6 +135,8 @@ jobs:
NOTIFICATIONS_SENDER_NAME: Test Preview
NOTIFICATIONS_SENDER: [email protected]
SITE_URL: http://localhost:8000
NEXTAUTH_URL: http://localhost:8000
NEXTAUTH_SECRET: 678x1irXYWeiOqTwCv1awvkAUbO9eHa5xzQEYhxhMms= # only used in local tests

- name: Upload Playwright traces
if: failure()
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ jobs:
NOTIFICATIONS_SENDER_NAME: Test Preview
NOTIFICATIONS_SENDER: [email protected]
SITE_URL: http://localhost:8000
NEXTAUTH_URL: http://localhost:8000
NEXTAUTH_SECRET: 678x1irXYWeiOqTwCv1awvkAUbO9eHa5xzQEYhxhMms= # only used in local tests

- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
Expand Down
134 changes: 134 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Run tests
on:
workflow_call:
inputs:
environment:
description: The Github environment to load secrets from
type: string
required: true
sha:
description: The commit SHA to run the tests against
type: string
required: true
runner-label:
description: The label of the runner to use
type: string
cache-modifier:
description: A modifier for the cache key used to bypass existing cache
type: string
required: false
default: ""

jobs:
test:
name: Run Cypress tests
environment: ${{ inputs.environment }}
runs-on:
labels: ${{ inputs.runner-label || 'ubuntu-latest' }}
defaults:
run:
shell: bash
working-directory: site/gatsby-site
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving the Dashboard hanging ...
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
# run 4 copies of the current job in parallel
containers: [1, 2, 3, 4]
# stop the job if it runs over 20 minutes
# to prevent a hanging process from using all your CI minutes
timeout-minutes: 80
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.sha }}

- name: Read node modules from cache
id: cache-nodemodules
uses: actions/cache/restore@v4
env:
cache-name: cache-install-folder
with:
path: |
site/gatsby-site/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}-${{ inputs.cache-modifier }}

- name: Install NPM dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
uses: cypress-io/github-action@v6
with:
working-directory: site/gatsby-site
runTests: false
install-command: npm ci

- name: Restore build cache
uses: actions/cache/restore@v4
env:
cache-name: cache-build-folder
with:
path: |
site/gatsby-site/public
site/gatsby-site/netlify/functions
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ inputs.sha }}-${{ inputs.cache-modifier }}

- name: Extract branch name
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
id: extract_branch

- name: Cypress run
uses: cypress-io/github-action@v6
with:
working-directory: site/gatsby-site
install: false
config-file: cypress.config.js
record: true
parallel: true
group: "Cypress e2e tests"
tag: ${{ steps.extract_branch.outputs.branch }}
start: npx -y pm2 start npm --name "web-server" -- run serve && npx pm2 logs "web-server"
wait-on: http://127.0.0.1:8000
wait-on-timeout: 60
env:
# Recommended: pass the GitHub token lets this action correctly
# determine the unique run id necessary to re-run the checks
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_PROJECT_ID: ${{ vars.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
E2E_ADMIN_USERNAME: ${{ secrets.E2E_ADMIN_USERNAME }}
E2E_ADMIN_PASSWORD: ${{ secrets.E2E_ADMIN_PASSWORD }}
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
GATSBY_ALGOLIA_APP_ID: ${{ vars.GATSBY_ALGOLIA_APP_ID }}
GATSBY_ALGOLIA_SEARCH_KEY: ${{ vars.GATSBY_ALGOLIA_SEARCH_KEY }}
GATSBY_AVAILABLE_LANGUAGES: ${{ vars.GATSBY_AVAILABLE_LANGUAGES }}
GATSBY_REALM_APP_ID: ${{ vars.GATSBY_REALM_APP_ID }}
MONGODB_CONNECTION_STRING: ${{ secrets.MONGODB_CONNECTION_STRING }}
MONGODB_REPLICA_SET: ${{ secrets.MONGODB_REPLICA_SET }}
MONGODB_TRANSLATIONS_CONNECTION_STRING: ${{ secrets.MONGODB_TRANSLATIONS_CONNECTION_STRING }}
MONGODB_MIGRATIONS_CONNECTION_STRING: ${{ secrets.MONGODB_MIGRATIONS_CONNECTION_STRING }}
GATSBY_REALM_APP_GRAPHQL_URL: ${{ secrets.GATSBY_REALM_APP_GRAPHQL_URL }}
GATSBY_ROLLBAR_TOKEN: ${{ secrets.GATSBY_ROLLBAR_TOKEN }}
INSTRUMENT: true
# Since this is triggered on a pull request, we set the commit message to the pull request title
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
CLOUDFLARE_R2_ACCOUNT_ID: ${{ vars.CLOUDFLARE_R2_ACCOUNT_ID }}
CLOUDFLARE_R2_BUCKET_NAME: ${{ vars.CLOUDFLARE_R2_BUCKET_NAME }}
GATSBY_CLOUDFLARE_R2_PUBLIC_BUCKET_URL: ${{ vars.GATSBY_CLOUDFLARE_R2_PUBLIC_BUCKET_URL }}
CLOUDFLARE_R2_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
CLOUDFLARE_R2_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
REALM_GRAPHQL_API_KEY: ${{ secrets.REALM_GRAPHQL_API_KEY }}
REALM_APP_ID: ${{ secrets.REALM_APP_ID }}
REALM_API_APP_ID: ${{ vars.REALM_API_APP_ID }}
REALM_API_GROUP_ID: ${{ vars.REALM_API_GROUP_ID }}
REALM_API_PUBLIC_KEY: ${{ secrets.REALM_API_PUBLIC_KEY }}
REALM_API_PRIVATE_KEY: ${{ secrets.REALM_API_PRIVATE_KEY }}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
15 changes: 15 additions & 0 deletions .github/workflows/translate-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Translate Reports - Production

on:
schedule:
- cron: "0 5 * * *" # Run every day at 5 AM GMT

workflow_dispatch:

jobs:
call-translate:
uses: ./.github/workflows/translate.yml
secrets: inherit
with:
environment: production

15 changes: 15 additions & 0 deletions .github/workflows/translate-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Translate Reports - Staging

on:
schedule:
- cron: "0 5 * * *" # Run every day at 5 AM GMT

workflow_dispatch:

jobs:
call-translate:
uses: ./.github/workflows/translate.yml
secrets: inherit
with:
environment: staging

38 changes: 38 additions & 0 deletions .github/workflows/translate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Translate Reports

on:
workflow_call:
inputs:
environment:
description: The Github environment to load secrets from
type: string
required: true

jobs:
translate:
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Install NPM dependencies
run: npm ci
working-directory: site/gatsby-site

- name: Run translation script
run: npm run translate-reports
working-directory: site/gatsby-site
env:
MONGODB_TRANSLATIONS_CONNECTION_STRING: ${{ secrets.MONGODB_TRANSLATIONS_CONNECTION_STRING }}
GOOGLE_TRANSLATE_API_KEY: ${{ secrets.GOOGLE_TRANSLATE_API_KEY }}
GATSBY_AVAILABLE_LANGUAGES: ${{ vars.GATSBY_AVAILABLE_LANGUAGES }}
TRANSLATE_SUBMISSION_DATE_START: ${{ vars.TRANSLATE_SUBMISSION_DATE_START }}
TRANSLATE_DRY_RUN: ${{ vars.TRANSLATE_DRY_RUN }}

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
 
<a href="https://github.com/responsible-ai-collaborative/aiid/actions/workflows/staging.yml"><img src="https://github.com/responsible-ai-collaborative/aiid/actions/workflows/staging.yml/badge.svg?branch=staging"></a>
&nbsp;
<a href="https://github.com/responsible-ai-collaborative/aiid/actions/workflows/translate-production.yml"><img src="https://github.com/responsible-ai-collaborative/aiid/actions/workflows/translate-production.yml/badge.svg?branch=main"></a>
&nbsp;
<a href="https://github.com/responsible-ai-collaborative/aiid/actions/workflows/db-backup.yml"><img src="https://github.com/responsible-ai-collaborative/aiid/actions/workflows/db-backup.yml/badge.svg?branch=main"></a>
&nbsp;
<a href="https://codecov.io/gh/responsible-ai-collaborative/aiid"><img src="https://codecov.io/gh/responsible-ai-collaborative/aiid/graph/badge.svg?token=SKMVE2G1GU"></a>
Expand Down
2 changes: 1 addition & 1 deletion site/gatsby-site/blog/join-raic/index.fr.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
titre: "Rejoignez l'équipe fondatrice de Responsible AI Collaborative"
title: "Rejoignez l'équipe fondatrice de Responsible AI Collaborative"
metaTitle: "Rejoignez l'équipe fondatrice de Responsible AI Collaborative"
metaDescription: ''
date: '2022-03-29'
Expand Down
Loading

0 comments on commit 444cae6

Please sign in to comment.