windows #1047
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: windows | |
on: | |
schedule: | |
- cron: "0 2 * * 2" | |
push: | |
branches: [ main ] | |
tags: [ v* ] | |
paths-ignore: | |
- .github/workflows/ubuntu.yml | |
- .github/workflows/macos-x86_64.yml | |
- .github/workflows/macos-arm64.yml | |
- .github/workflows/alpine.yml | |
- .github/workflows/release_tag.yml | |
- Makefile | |
- .cirrus.* | |
pull_request: | |
paths-ignore: | |
- .github/workflows/ubuntu.yml | |
- .github/workflows/macos-x86_64.yml | |
- .github/workflows/macos-arm64.yml | |
- .github/workflows/alpine.yml | |
- .github/workflows/release_tag.yml | |
- Makefile | |
- .cirrus.* | |
workflow_dispatch: | |
concurrency: | |
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}' | |
cancel-in-progress: true | |
jobs: | |
# https://wildwolf.name/github-actions-how-to-avoid-running-the-same-workflow-multiple-times/ | |
prepare: | |
runs-on: ubuntu-latest | |
outputs: | |
head_tag: ${{ steps.check.outputs.head_tag }} | |
foreign_pr: ${{ steps.check.outputs.foreign_pr }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Retrieve tags | |
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true | |
- name: Set output variables | |
id: check | |
run: | | |
fpr="no" | |
tag="" | |
if [[ "${{ github.ref }}" == refs/heads/* ]]; then | |
tag="$(git tag --points-at HEAD)" | |
elif [[ "${{ github.ref }}" == refs/pull/* ]] && [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.event.pull_request.base.repo.full_name }}" ]; then | |
fpr="yes" | |
fi | |
echo "foreign_pr=${fpr}" >> $GITHUB_OUTPUT | |
echo "head_tag=${tag}" >> $GITHUB_OUTPUT | |
build: | |
runs-on: windows-2019 | |
needs: prepare | |
if: "(github.event_name == 'push' && needs.prepare.outputs.head_tag == '') || github.event_name == 'pull_request'" | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
gem -v | |
systeminfo | |
- uses: metanorma/metanorma-build-scripts/gh-rubygems-setup-action@main | |
with: | |
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }} | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.1' | |
bundler: '2.4' | |
- uses: nick-invision/retry@v3 | |
with: | |
polling_interval_seconds: 5 | |
timeout_minutes: 5 | |
max_attempts: 3 | |
command: choco install --no-progress make gnuwin32-coreutils.install gzip wget git | |
- run: | | |
%ChocolateyInstall%\bin\make.exe -f Makefile.win build build/metanorma.exe | |
shell: cmd | |
env: | |
BUNDLE_DEBUG: true | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: metanorma-windows | |
path: build/metanorma.exe | |
- run: .\build\metanorma.exe help | |
build-matrix: | |
uses: metanorma/ci/.github/workflows/build-sample-matrix.yml@main | |
with: | |
smoke: false | |
flavors-only: true | |
public-only: true | |
test: | |
needs: [build, build-matrix] | |
runs-on: windows-2019 | |
continue-on-error: ${{ matrix.flavor.experimental }} | |
strategy: | |
max-parallel: 5 | |
fail-fast: false | |
matrix: ${{ fromJson(needs.build-matrix.outputs.samples-matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: Remove-Item Gemfile | |
- if: matrix.flavor.id == 'ietf' | |
uses: metanorma/ci/xml2rfc-setup-action@main | |
- uses: actions/download-artifact@v4 | |
with: | |
name: metanorma-windows | |
path: build | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.relaton | |
key: relaton-windows-${{ matrix.flavor.id }} | |
restore-keys: relaton-windows-${{ matrix.flavor.id }} | |
- name: Fetch samples (${{ matrix.flavor.id }}) | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
repository: metanorma/mn-samples-${{ matrix.flavor.id }} | |
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }} | |
path: ${{ github.workspace }}/samples | |
fetch-depth: 1 | |
- name: Test (${{ matrix.flavor.id }}) | |
timeout-minutes: 120 | |
run: | | |
build\metanorma.exe site generate samples -c samples\metanorma.yml --agree-to-terms | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: site-${{ matrix.flavor.id }} | |
path: _site | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: windows-latest | |
needs: test | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: metanorma-windows | |
path: build | |
- run: cp build/metanorma.exe metanorma-windows-x86_64.exe | |
- run: | | |
Get-FileHash -Algorithm SHA256 metanorma-windows-x86_64.exe | Select -ExpandProperty "Hash" | Out-File metanorma-windows-x86_64.exe.sha256.txt | |
Compress-Archive -Path .\build\metanorma.exe -DestinationPath metanorma-windows-x86_64.zip | |
Get-FileHash -Algorithm SHA256 metanorma-windows-x86_64.zip | Select -ExpandProperty "Hash" | Out-File metanorma-windows-x86_64.zip.sha256.txt | |
- uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
# chocolatey | |
metanorma-windows-x86_64.exe | |
metanorma-windows-x86_64.exe.sha256.txt | |
# for winget | |
metanorma-windows-x86_64.zip | |
metanorma-windows-x86_64.zip.sha256.txt | |
- name: Trigger chocolatey-metanorma | |
uses: peter-evans/repository-dispatch@v1 | |
with: | |
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }} | |
repository: metanorma/chocolatey-metanorma | |
event-type: ${{ github.repository }} | |
client-payload: '{ "ref": "${{ github.ref }}" }' | |
- name: Trigger winget-metanorma | |
uses: peter-evans/repository-dispatch@v1 | |
with: | |
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }} | |
repository: metanorma/winget-metanorma | |
event-type: ${{ github.repository }} | |
client-payload: '{ "ref": "${{ github.ref }}" }' |