diff --git a/.github/mscorefonts.yml b/.github/mscorefonts.yml new file mode 100644 index 00000000..abfd2194 --- /dev/null +++ b/.github/mscorefonts.yml @@ -0,0 +1,35 @@ +# https://packages.debian.org/ru/sid/ttf-mscorefonts-installer +Andale Mono: +- Regular +Arial Black: +- Regular +Arial: +- Bold +- Italic +- Bold Italic +Comic Sans MS: +- Bold +Courier New: +- Bold +- Italic +- Bold Italic +Georgia: +- Bold +- Italic +- Bold Italic +Impact: +- Regular +Times New Roman: +- Bold +- Italic +- Bold Italic +Trebuchet: +- Bold +- Italic +- Bold Italic +Verdana: +- Bold +- Italic +- Bold Italic +Webdings: +- Regular diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml deleted file mode 100644 index 566ee563..00000000 --- a/.github/workflows/macos.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: macos - -on: - push: - branches: - - master - pull_request: - -jobs: - build: - runs-on: macos-latest - steps: - - uses: actions/checkout@master - - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - # cabextract for fonts - - name: Setup prerequisites - run: | - # Install Maven - brew install maven - - # Install cabextract - brew install cabextract - -# - name: Install Microsoft Vista fonts -# run: | -# export MN_PDF_FONT_PATH=${GITHUB_WORKSPACE}/fonts -# export MS_FONT_PATH=${MN_PDF_FONT_PATH}/truetype/vista -# export RENAME_FONTS=false -# curl -Ls https://raw.githubusercontent.com/metanorma/vista-fonts-installer/master/vista-fonts-installer.sh | bash - - - name: Build - env: - GH_TOKEN: ${{ github.token }} - GH_USERNAME: ${{ github.actor }} - run: | - make all - - - name: Run tests - env: - GH_TOKEN: ${{ github.token }} - GH_USERNAME: ${{ github.actor }} - run: | - make test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12ffdd86..d53cc038 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,6 @@ name: release on: push: - # Sequence of patterns matched against refs/tags tags: - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 @@ -10,58 +9,36 @@ jobs: build: name: Release to Maven and GitHub runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ github.token }} steps: - name: Set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - # cabextract for fonts - - name: Setup prerequisites - run: | - sudo apt-get update - sudo apt-get -y install cabextract libxml2-utils - - # If necessary - echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections - sudo apt-get install ttf-mscorefonts-installer - -# - name: Setup Cambria fonts -# run: | -# curl -Ls https://raw.githubusercontent.com/metanorma/vista-fonts-installer/master/vista-fonts-installer.sh | sudo bash + - run: | + sudo gem install fontist + fontist update + fontist manifest-install --confirm-license .github/mscorefonts.yml - uses: actions/checkout@master - - name: Build - env: - GH_TOKEN: ${{ github.token }} - GH_USERNAME: ${{ github.actor }} - run: | - make all + - run: make all - - name: Run tests - env: - GH_TOKEN: ${{ github.token }} - GH_USERNAME: ${{ github.actor }} - run: | - make test + - run: make test - name: Deploy to Maven env: - # for download barcode4j - GH_TOKEN: ${{ github.token }} - GH_USERNAME: ${{ github.actor }} # for deploy mn2pdf - GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} - GITHUB_USERNAME: ${{ secrets.PAT_USERNAME }} + GITHUB_PUBLISH_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }} + GITHUB_PUBLISH_USERNAME: metanorma-ci run: | make deploy - name: Create Release id: create_release uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ github.token }} with: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} @@ -89,7 +66,7 @@ jobs: - name: Notify mn2pdf-ruby uses: peter-evans/repository-dispatch@v1 with: - token: ${{ secrets.PAT_TOKEN }} + token: ${{ secrets.METANORMA_CI_PAT_TOKEN }} repository: metanorma/mn2pdf-ruby event-type: metanorma/mn2pdf client-payload: '{ "ref": "${{ github.ref }}" }' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..95ce98e5 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,58 @@ +name: test + +on: + push: + branches: + - master + pull_request: + +jobs: + test: + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} + strategy: + fail-fast: false + matrix: + java: [ 1.8, 1.11 ] + os: [ ubuntu-latest, windows-latest, macos-latest ] + experimental: [ false ] + env: + GITHUB_TOKEN: ${{ github.token }} + + steps: + - uses: actions/checkout@master + + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + + - uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - if: matrix.os == 'ubuntu-latest' + run: sudo gem install fontist + + - if: matrix.os != 'ubuntu-latest' + run: gem install fontist + + - run: | + fontist update + fontist manifest-install --confirm-license .github/mscorefonts.yml + + - uses: actions/cache@v2 + with: + path: ~/.fontist + key: fontist-${{ runner.os }} + restore-keys: fontist-${{ runner.os }} + + # - if: matrix.os == 'windows-latest' + # run: choco install --no-progress make + + - run: make all + + - run: make test diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml deleted file mode 100644 index 8d9b4b80..00000000 --- a/.github/workflows/ubuntu.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: ubuntu - -on: - push: - branches: - - master - pull_request: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - # cabextract for fonts - - name: Setup prerequisites - run: | - sudo apt-get update - sudo apt-get -y install gettext-base cabextract libxml2-utils - - # If necessary - echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections - sudo apt-get install ttf-mscorefonts-installer - -# - name: Setup Cambria fonts -# run: | -# curl -Ls https://raw.githubusercontent.com/metanorma/vista-fonts-installer/master/vista-fonts-installer.sh | sudo bash - - - name: Build - env: - GH_TOKEN: ${{ github.token }} - GH_USERNAME: ${{ github.actor }} - run: | - make all - - - name: Run tests - env: - GH_TOKEN: ${{ github.token }} - GH_USERNAME: ${{ github.actor }} - run: | - make test diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index da2a4e26..00000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: windows - -on: - push: - branches: - - master - pull_request: - -jobs: - build: - runs-on: windows-latest - steps: - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - - name: Setup prerequisites - run: choco install --no-progress make gnuwin32-coreutils.install 7zip.install - - - uses: actions/checkout@master - - - name: Build - env: - GH_TOKEN: ${{ github.token }} - GH_USERNAME: ${{ github.actor }} - run: | - make all SHELL=cmd - - - name: Run tests - env: - GH_TOKEN: ${{ github.token }} - GH_USERNAME: ${{ github.actor }} - MN_PDF_FONT_PATH: C:\Windows\Fonts - run: | - make test SHELL=cmd diff --git a/Makefile b/Makefile index 53555e96..17670fec 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,9 @@ #!make +ifeq ($(OS),Windows_NT) +SHELL ?= cmd +else SHELL ?= /bin/bash +endif #JAR_VERSION := $(shell mvn -q -Dexec.executable="echo" -Dexec.args='$${project.version}' --non-recursive exec:exec -DforceStdout) JAR_VERSION := 1.36 diff --git a/README.adoc b/README.adoc index 3c4ce3d7..c0fe63e0 100644 --- a/README.adoc +++ b/README.adoc @@ -1,8 +1,6 @@ = Metanorma mn2pdf -image:https://github.com/metanorma/mn2pdf/workflows/ubuntu/badge.svg["Build Status", link="https://github.com/metanorma/mn2pdf/actions?workflow=ubuntu"] -image:https://github.com/metanorma/mn2pdf/workflows/macos/badge.svg["Build Status", link="https://github.com/metanorma/mn2pdf/actions?workflow=macos"] -image:https://github.com/metanorma/mn2pdf/workflows/windows/badge.svg["Build Status", link="https://github.com/metanorma/mn2pdf/actions?workflow=windows"] +image:https://github.com/metanorma/mn2pdf/workflows/test/badge.svg["Build Status", link="https://github.com/metanorma/mn2pdf/actions?workflow=test"] == Installing Build Tools diff --git a/settings.xml b/settings.xml index 77b854a0..e1623ab0 100644 --- a/settings.xml +++ b/settings.xml @@ -31,8 +31,8 @@ metanorma - ${env.GH_USERNAME} - ${env.GH_TOKEN} + ${env.GITHUB_ACTOR} + ${env.GITHUB_TOKEN} metanorma_mn2pdf