Skip to content

Commit

Permalink
Replace CircleCI with GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jvasseur committed Aug 21, 2023
1 parent 114e064 commit 52a4d0a
Show file tree
Hide file tree
Showing 43 changed files with 659 additions and 1,618 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ insert_final_newline = true
[{package.json,yarn.lock}]
indent_size = 2

[generators/*/templates/circleci.yaml.ejs]
[generators/*/templates/workflow.yaml.ejs]
indent_size = 2

[generators/*/templates/ansible/**/*.yaml.ejs]
Expand Down
50 changes: 0 additions & 50 deletions generators/app/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fs from 'fs';
import path from 'path';
import YAML from 'yaml';
import helpers from 'yeoman-test';
import * as CircleCI from '../../utils/circleci';

describe('When running the generator with React', () => {
let root: string;
Expand Down Expand Up @@ -33,16 +32,6 @@ describe('When running the generator with React', () => {

expect(config.devDependencies.vite).toBeDefined();
});

test('It add the right dependencies to the deploy job', async () => {
const content = await fs.promises.readFile(path.resolve(root, '.circleci', 'config.yml'), 'utf8');
const config = CircleCI.Config.fromRaw(YAML.parse(content));

expect(config.workflows.build?.jobs.deploy?.requires).toEqual([
'backend-archive',
'frontend-archive',
]);
});
});

describe('When running the generator with Next.js', () => {
Expand Down Expand Up @@ -74,45 +63,6 @@ describe('When running the generator with Next.js', () => {

expect(config.dependencies.next).toBeDefined();
});

test('It add the right dependencies to the deploy job', async () => {
const content = await fs.promises.readFile(path.resolve(root, '.circleci', 'config.yml'), 'utf8');
const config = CircleCI.Config.fromRaw(YAML.parse(content));

expect(config.workflows.build?.jobs.deploy?.requires).toEqual([
'backend-archive',
'frontend-archive',
]);
});
});

describe('When running the generator with Symfony', () => {
let root: string;

beforeAll(async () => {
const result = await helpers.run(__dirname)
.withPrompts({
backend: 'symfony',
contactEmail: 'test@example.com',
add: false,
twig: true,
});

root = result.cwd;
});

afterAll(async () => {
await fs.promises.rm(root, { recursive: true });
});

test('It add the right dependencies to the deploy job', async () => {
const content = await fs.promises.readFile(path.resolve(root, '.circleci', 'config.yml'), 'utf8');
const config = CircleCI.Config.fromRaw(YAML.parse(content));

expect(config.workflows.build?.jobs.deploy?.requires).toEqual([
'backend-build',
]);
});
});

describe('When running the generator with Flutter', () => {
Expand Down
7 changes: 0 additions & 7 deletions generators/express/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import path from 'path';
import execa from 'execa';
import YAML from 'yaml';
import helpers from 'yeoman-test';
import { Config } from '../../utils/circleci';

describe('When running the generator', () => {
let root: string;
Expand Down Expand Up @@ -90,12 +89,6 @@ describe('When running the generator with kubernetes deployment', () => {
await fs.promises.rm(root, { recursive: true });
});

test('It generates a valid CircleCI config', async () => {
const content = await fs.promises.readFile(path.join(root, '.circleci', 'config.yml'), 'utf8');

Config.fromRaw(YAML.parse(content));
});

test('It generates a valid terraform config', async () => {
const cwd = path.join(root, 'environments', 'staging');

Expand Down
6 changes: 1 addition & 5 deletions generators/express/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ExpressGenerator extends PackageGenerator {

this.configureDockerCompose('docker-compose.yaml.ejs');

this.configureCircleCI('circleci.yaml.ejs');
this.renderTemplate('workflow.yaml.ejs', `.github/workflows/${packageName}.yaml`);

switch (this.config.get('deployment')) {
case DeploymentChoice.Ansible:
Expand All @@ -32,10 +32,6 @@ class ExpressGenerator extends PackageGenerator {
encrypt: createEncrypt(this.readDestination('ansible/vault_pass.txt').trim()),
cookieSecret: cryptoRandomString({ length: 64, type: 'alphanumeric' }),
});

this.updateCircleCIConfig((config) => {
config.workflows.build!.jobs.deploy!.requires.push(`${packageName}-archive`);
});
break;
case DeploymentChoice.Kubernetes: {
const packageVar = varName(packageName);
Expand Down
186 changes: 0 additions & 186 deletions generators/express/templates/circleci.yaml.ejs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
---
- import_role:
name: build
name: find_github_artifact
vars:
job_name: <%= packageName %>-archive
repository_name: <%= repositoryName %>
workflow_name: <%= packageName %>
delegate_to: localhost
when: artifact_url is not defined
- import_role:
name: deploy
name: deploy_artifact
environment: '{{ <%= varName(packageName) %>_env }}'
vars:
path: /home/<%= packageName %>
artifact_path: <%= packageName %>.tar.gz
job_name: <%= packageName %>-archive
repository_name: <%= repositoryName %>
before_finalize:
- ./node_modules/.bin/typeorm --dataSource dist/infrastructure/database/data-source.js migration:run
after_finalize:
Expand Down

This file was deleted.

Loading

0 comments on commit 52a4d0a

Please sign in to comment.