Skip to content

feat(ci): add circle ci configuration #5

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

Merged
merged 1 commit into from
May 28, 2024
Merged
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
120 changes: 100 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,110 @@
# See: https://circleci.com/docs/configuration-reference
version: 2.1

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/jobs-steps/#jobs-overview & https://circleci.com/docs/configuration-reference/#jobs
jobs:
say-hello:
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/executor-intro/ & https://circleci.com/docs/configuration-reference/#executor-job
docker:
# Specify the version you desire here
# See: https://circleci.com/developer/images/image/cimg/base
- image: cimg/base:current
# Settings common to each job
job_defaults: &job_defaults
working_directory: ~/angular-docs-es
docker:
- image: cimg/node:lts-browsers

orbs:
node: circleci/[email protected]
build-tools: circleci/[email protected]
browser-tools: circleci/[email protected]

# Add steps to the job
# See: https://circleci.com/docs/jobs-steps/#steps-overview & https://circleci.com/docs/configuration-reference/#steps
commands:
# Command for checking out the source code from GitHub. This also ensures that the source code
# can be merged to the main branch without conflicts.
checkout_and_rebase:
description: Checkout and verify clean merge with main
steps:
# Checkout the code as the first step.
- checkout
- run:
name: "Say hello"
command: "echo Hello, World!"
name: Set git user.name and user.email for rebase.
# User is required for rebase.
command: |
git config user.name "Admin"
git config user.email "[email protected]"
- build-tools/merge-with-parent:
parent: main
setup:
description: 'Set up executor'
steps:
- attach_workspace:
at: ~/
setup_firebase_auth:
description: 'Set up Firebase authentication'
steps:
- run:
name: Create a google_service_account.json
command: |
echo $GSA_KEY > $GOOGLE_APPLICATION_CREDENTIALS

# ----------------------------------
# Job definitions.
# ----------------------------------

jobs:
# ----------------------------------
# initialize job
# ----------------------------------
initialize:
<<: *job_defaults
steps:
- checkout_and_rebase
- node/install-packages
- persist_to_workspace:
root: ~/
paths:
- angular-docs-es
# -----------------------------------
# Build job.
# -----------------------------------
build:
<<: *job_defaults
steps:
- setup
- checkout
- run:
name: Build project in CI mode (pre build)
command: npm run build:ci
- run:
name: Installing packages
working_directory: ./build
command: yarn install
- run:
name: Build adev-es docs
working_directory: ./build
command: yarn bazel build //adev:build --fast_adev --local_ram_resources="HOST_RAM*.90" --jobs=1
- persist_to_workspace:
root: ~/
paths:
- angular-docs-es/build/dist/bin/adev/build/browser

# -----------------------------------
# Firebase deploy to staging job.
# -----------------------------------
firebase-deploy-staging:
<<: *job_defaults
steps:
- setup
- setup_firebase_auth
- run:
name: 'Deploy Main Branch to Firebase Hosting'
command: |
npm run deploy:staging

# Orchestrate jobs using workflows
# See: https://circleci.com/docs/workflows/ & https://circleci.com/docs/configuration-reference/#workflows
workflows:
say-hello-workflow: # This is the name of the workflow, feel free to change it to better match your workflow.
# Inside the workflow, you define the jobs you want to run.
build-workflow:
jobs:
- say-hello
- initialize
- build:
requires:
- initialize
- firebase-deploy-staging:
filters:
branches:
only:
- main
requires:
- build
16 changes: 16 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"projects": {
"default": "angular-hispano-staging",
"staging": "angular-hispano-staging"
},
"targets": {
"angular-hispano-staging": {
"hosting": {
"staging": [
"angular-hispano-docs-staging"
]
}
}
},
"etags": {}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ yarn-error.log
# System files
.DS_Store
Thumbs.db

# Firebase Caching
.firebase
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ $ npm run build

Cuando se completa la compilación, el resultado de la compilación se envía al directorio `build/dist/bin/adev/build`. Puedes configurar un servidor de desarrollo con tu herramienta favorita y comprobar los sitios construidos.

Construye el proyecto en CI

```
$ npm run build:ci
```

La compilación del proyecto en CI funciona de manera diferente, primero ejecutamos el comando `npm run build:ci`, este comando realizará un `pre-built` del proyecto, es decir que no construirá la documentación y solo creará el directorio `build` y copiará los archivos necesarios. La construcción de la documentación se realizará directamente en la configuración de CI.

## Gracias por tu colaboración!

Esperamos que te unas a nosotros en este esfuerzo por hacer que la documentación de Angular sea más accesible para la comunidad hispanohablante.
17 changes: 17 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"hosting": {
"target": "staging",
"public": "build/dist/bin/adev/build/browser",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Loading
Loading