Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Mar 15, 2024
2 parents f7bf6dc + cadb888 commit c496905
Show file tree
Hide file tree
Showing 24 changed files with 103 additions and 609 deletions.
32 changes: 6 additions & 26 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,17 @@ name: docker

on:
push:
branches: [ master, main ]
branches: [ master, main ]
pull_request:
paths-ignore:
- .github/workflows/test.yml
- .github/workflows/pages.yml
repository_dispatch:
types: [ metanorma/metanorma-docker ]


jobs:
test-docker:
runs-on: ubuntu-latest
container: docker://metanorma/mn
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.METANORMA_CI_PAT_TOKEN || github.token }}
submodules: true

- name: Metanorma compile
shell: bash
run: |
source doctypes.env
for template in $DOCTYPES
do
metanorma new test/$template --type $TYPE --doctype $template --template . --overwrite
if [ -f test/${template}/document.adoc ]
then
metanorma compile --no-install-fonts test/${template}/document.adoc
else
for docfile in test/${template}/*.adoc
do
metanorma compile --no-install-fonts $docfile
done
fi
done
uses: metanorma/ci/.github/workflows/template-docker.yml@main
secrets:
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
18 changes: 18 additions & 0 deletions .github/workflows/matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"type": [ "itu" ],
"doctype": [
"focus-group",
"implementers-guide",
"joint-itu-iso-iec",
"recommendation",
"recommendation-amendment",
"recommendation-annex",
"recommendation-corrigendum",
"recommendation-errata",
"resolution",
"supplement",
"technical-paper",
"technical-report"
],
"experimental": [ false ]
}
19 changes: 19 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Auto-generated by Cimas: Do not edit it manually!
# See https://github.com/metanorma/cimas
name: pages

on:
push:
branches: [ master, main ]
pull_request:
paths-ignore:
- .github/workflows/test.yml
- .github/workflows/generate.yml
repository_dispatch:
types: [ metanorma/metanorma-docker ]

jobs:
test:
uses: metanorma/ci/.github/workflows/template-pages.yml@main
secrets:
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
103 changes: 8 additions & 95 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,103 +4,16 @@ name: test

on:
push:
branches: [ master, main ]
branches: [ master, main ]
pull_request:
paths-ignore:
- .github/workflows/docker.yml
- .github/workflows/pages.yml
repository_dispatch:
types: [ metanorma/metanorma-cli ]
types: [ metanorma/metanorma-* ]

jobs:
test:
name: Test ruby-${{ matrix.ruby }} on ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]
ruby: [ '2.6', '2.5', '2.4' ]
experimental: [ false ]
include:
- ruby: '2.7'
os: macos-latest
experimental: true
- ruby: '2.7'
os: ubuntu-latest
experimental: true
- ruby: '2.7'
os: windows-latest
experimental: true

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

- if: matrix.os == 'macos-latest'
run: brew install autoconf automake libtool

- name: Install metanorma
shell: python
env:
TRIGGER_REPO: ${{ github.event.client_payload.repo }}
TRIGGER_REF: ${{ github.event.client_payload.ref }}
run: |
import os
repo = os.environ.get("TRIGGER_REPO")
branch = os.environ.get("TRIGGER_REF")
print("Install {} {}".format(repo, branch))
if repo != "metanorma/metanorma-cli":
os.system("gem install metanorma-cli")
if branch and repo:
os.system("gem install specific_install")
os.system("gem specific_install -l https://github.com/{}.git -b {}".format(repo, branch))
- uses: actions/setup-python@v1
with:
python-version: '3.6'
architecture: 'x64'

- run: pip install xml2rfc

- name: Metanorma compile *nix
if: matrix.os != 'windows-latest'
run: |
source doctypes.env
for template in $DOCTYPES
do
metanorma new test/$template --type $TYPE --doctype $template --template . --overwrite
if [ -f test/${template}/document.adoc ]
then
metanorma compile --no-install-fonts test/${template}/document.adoc
else
for docfile in test/${template}/*.adoc
do
metanorma compile --no-install-fonts $docfile
done
fi
done
- name: Metanorma compile Windows
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
$ErrorActionPreference = "Stop" <# https://stackoverflow.com/a/16334189/902217 #>
$docTypes = ConvertFrom-StringData (Get-Content ./doctypes.env -Raw)
$docTypes.DOCTYPES.Split(" ") | % {
$t = $_.Trim('"')
metanorma new result\$t --type $($docTypes.TYPE) --doctype $t --template . --overwrite
$doc = "result\$t\document.adoc"
if (Test-Path -Path $doc) {
metanorma compile --no-install-fonts $doc
} else {
Get-ChildItem ".\result\$t" -Filter *.adoc | % {
metanorma compile --no-install-fonts $_.FullName
}
}
}
uses: metanorma/ci/.github/workflows/template-test.yml@main
secrets:
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "metanorma-cli"
4 changes: 3 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
= ITU Metanorma Templates

image:https://github.com/metanorma/mn-templates-itu/workflows/defaults/badge.svg["Build Status", link="https://github.com/metanorma/mn-templates-itu/actions?workflow=defaults"]
image:https://github.com/metanorma/mn-templates-itu/workflows/test/badge.svg["Test Status", link="https://github.com/metanorma/mn-templates-itu/actions/workflows/test.yml"]
image:https://github.com/metanorma/mn-templates-itu/workflows/pages/badge.svg["Pages Status", link="https://github.com/metanorma/mn-templates-itu/actions/workflows/pages.yml"]
image:https://github.com/metanorma/mn-templates-itu/workflows/docker/badge.svg["Build Status", link="https://github.com/metanorma/mn-templates-itu/actions/workflows/docker.yml"]

This GitHub repository contains templates for ITU documents.

Expand Down
56 changes: 6 additions & 50 deletions common/.github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,58 +9,14 @@ on:
paths-ignore:
- .gitlab-ci.yml
- .github/workflows/test.yml
- .github/workflows/macos.yml
- .github/workflows/ubuntu.yml
- .github/workflows/windows.yml
- .github/workflows/docker-pres_xml.yml
- .github/workflows/generate.yml
repository_dispatch:
types: [ metanorma/metanorma-docker ]
workflow_dispatch:

jobs:
test-docker:
runs-on: ubuntu-latest
container: docker://metanorma/mn
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.METANORMA_CI_PAT_TOKEN || github.token }}
submodules: true

- name: instal gems from local Gemfile
run: curl -L --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/gemfile-to-bundle-add.sh | bash

- run: metanorma site generate sources
env:
LC_ALL: C.UTF-8
LANG: C.UTF-8
LANGUAGE: C.UTF-8

- uses: actions/upload-artifact@master
with:
name: site
path: site

deploy-gh-pages:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: test-docker
steps:
- uses: actions/checkout@v2

- uses: actions/download-artifact@v1
with:
name: site

- uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.GH_DEPLOY_KEY }}
publish_dir: ./site
force_orphan: true
user_name: ${{ github.actor }}
user_email: ${{ format('{0}@users.noreply.github.com', github.actor) }}
commit_message: "${{ format('Deploy to GitHub Pages: {0}', github.sha) }}"

- uses: kolpav/purge-artifacts-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
expire-in: 0
uses: metanorma/ci/.github/workflows/sample-docker.yml@main
secrets:
pat_username: metanorma-ci
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
19 changes: 19 additions & 0 deletions common/.github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Auto-generated by Cimas: Do not edit it manually!
# See https://github.com/metanorma/cimas
name: generate

on:
push:
branches: [ master, main ]
pull_request:
paths-ignore:
- .gitlab-ci.yml
- .github/workflows/test.yml
- .github/workflows/docker.yml
workflow_dispatch:

jobs:
test-docker:
uses: metanorma/ci/.github/workflows/sample-gen.yml@main
secrets:
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
Loading

0 comments on commit c496905

Please sign in to comment.