Skip to content
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

Simplify Makefile targets. #655

Closed
wants to merge 2 commits into from
Closed
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
37 changes: 2 additions & 35 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,12 @@ references:
docker:
- image: circleci/ruby:2.6.0-node-browsers

env_vars_test: &env_vars_test
environment:
- JEKYLL_NO_GITHUB: "true" # Remove Github API integration.
- JEKYLL_ENV: "production"
- NOKOGIRI_USE_SYSTEM_LIBRARIES: "true"
- ELASTICSEARCH_URL: "" # Disable searchyll for test.

env_vars_prod: &env_vars_prod
environment:
- JEKYLL_ENV: "production"
- NOKOGIRI_USE_SYSTEM_LIBRARIES: "true"

install_dependencies: &install_dependencies
run:
name: install-dependencies
command: |
make include-npm-deps
make bundle-install-deployment
which rsync || sudo apt-get install rsync

get_crawler_yml_files: &get_crawler_yml_files
run:
name: get-crawler-yml-files
command: |
make download-data

build_bundle_jekyll: &build_bundle_jekyll
run:
name: build-bundle-jekyll
command: |
make build-swagger
make jekyll-build
make test

setup_ssh_gh_pages: &setup_ssh_gh_pages
add_ssh_keys:
fingerprints:
Expand All @@ -58,7 +30,6 @@ references:
name: publish_changes_gh_pages
command: |
cp -r .well-known _site/
cp -r github _site/

# Move artifacts to a temporary location
mv _site /tmp/gh-pages
Expand Down Expand Up @@ -95,22 +66,18 @@ references:
jobs:
test:
<<: *load_image
<<: *env_vars_test
steps:
- checkout
- << : *install_dependencies
- << : *get_crawler_yml_files
- << : *build_bundle_jekyll
- run: make build
- << : *notify_on_failure

build_and_deploy_gh_pages:
<<: *load_image
<<: *env_vars_prod
steps:
- checkout
- << : *install_dependencies
- << : *get_crawler_yml_files
- << : *build_bundle_jekyll
- run: make test
- << : *setup_ssh_gh_pages
- << : *publish_changes_gh_pages
- << : *notify_on_failure
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
.jekyll-metadata
.sass-cache
.bundle
_data/github_members.json
_data/github_teams.json
_data/github_members.yml
_data/github_teams.yml
_data/github_tech_list.yml
_site
node_modules
swagger/.cache
Expand Down
5 changes: 0 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ COPY Makefile .
COPY package-lock.json .
COPY package.json .

RUN make include-npm-deps
RUN make bundle-install
RUN make download-data
RUN make build-swagger

EXPOSE 4000 8080 35729

CMD ["make", "local"]
36 changes: 19 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.PHONY: build deploy
download-data:
export NOKOGIRI_USE_SYSTEM_LIBRARIES = true

setup:
# Download crawler data
wget --max-redirect 0 https://crawler.developers.italia.it/softwares.yml -O _data/crawler/softwares.yml
wget --max-redirect 0 https://crawler.developers.italia.it/amministrazioni.yml -O _data/crawler/amministrazioni.yml
wget --max-redirect 0 https://crawler.developers.italia.it/software_categories.yml -O _data/crawler/software_categories.yml
Expand All @@ -8,27 +10,27 @@ download-data:
wget --max-redirect 0 https://crawler.developers.italia.it/software_scopes.yml -O _data/crawler/software_scopes.yml
wget --max-redirect 0 https://crawler.developers.italia.it/software_tags.yml -O _data/crawler/software_tags.yml

bundle-setup:
# Bundle setup
gem install bundler:2.1.4
bundle config set path vendor/
bundle install --deployment

bundle-install: bundle-setup
bundle install
# Get issues (/assets/issues.js) and contributors (_data/github_*.yml) from GitHub
bundle exec scripts/github_importer.rb

bundle-install-deployment: bundle-setup
bundle install --deployment
npm ci

build-swagger:
cd swagger && npm run build

test:
JEKYLL_NO_GITHUB=true bundle exec htmlproofer ./_site --assume-extension --check-html --allow-hash-href --empty-alt-ignore --only-4xx --disable-external
local: build-swagger
npx webpack-dev-server --config webpack.dev.js --color --progress -d --host 0.0.0.0 | JEKYLL_NO_GITHUB=true bundle exec jekyll serve --livereload --incremental --host=0.0.0.0
jekyll-build:
local: setup
npx webpack-dev-server --config webpack.dev.js --color --progress -d --host 0.0.0.0 | bundle exec jekyll serve --livereload --incremental --host=0.0.0.0

build: setup
JEKYLL_ENV=production bundle exec jekyll build
NODE_ENV=production npm run build
include-npm-deps:
npm ci
build: | build-bundle-deployment include-npm-deps download-data build-swagger jekyll-build
build-test: | build test

test: build
# Disable searchyll indexing with Elasticsearch in tests.
ELASTICSEARCH_URL="" bundle exec htmlproofer ./_site --assume-extension --check-html --allow-hash-href --empty-alt-ignore --only-4xx --disable-external

.PHONY: setup local test build
13 changes: 1 addition & 12 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ github_username: italia
#piwik: teamdigitale
google_analytics: UA-96140462-1

# Github importer
github_api_url: https://api.github.com
github_folder: github
github_projects_prefix: ['spid-', '18app', 'anpr-','daf-','dati-','pianotriennale-','lg-','design-','security-','cie-']
github_access_token: ENV_GITHUB_ACCESS_TOKEN
github_blacklist_repos: []
github_issues_types: ['bug','enhancement','new project', 'Hacktoberfest']
github_tech_list: [
'angular', 'react', 'design', 'html', 'arduino', 'bootstrap', 'frontend',
'perl','python', 'cpp', 'scala', 'php', 'csharp', 'java', 'android', 'ios', 'dotnet',
'wordpress', 'metabase', 'ansible', 'docker', 'magento', 'joomla', 'django']

# Build settings
markdown: kramdown
plugins:
Expand All @@ -65,6 +53,7 @@ exclude:
- package.json
- package-lock.json
- README.md
- scripts
- swagger/.cache
- swagger/dist
- swagger/node_modules
Expand Down
2 changes: 1 addition & 1 deletion _layouts/github-issues.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{% include linklist.html items=subnav dynamic=true %}

{% endcomment %}
{% assign github_tech_list = site.github_tech_list %}
{% assign github_tech_list = site.data.github_tech_list %}

{% capture projects_escaped_json %}
{{ t.todo_projects_dict | jsonify | replace: "'", "&apos;" }}
Expand Down
197 changes: 0 additions & 197 deletions _plugins/GithubImporter.rb

This file was deleted.

2 changes: 1 addition & 1 deletion assets/js/github-issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $(document).ready(function () {
"url": datatables_language_url[current_language]
},
"ajax": {
"url": "/github/issues.json",
"url": "/assets/github_issues.json",
"dataSrc": ""
},
"order": [[0, "desc"]],
Expand Down
Loading