Skip to content

ci: rework compiler selection and docs deployment #349

ci: rework compiler selection and docs deployment

ci: rework compiler selection and docs deployment #349

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
build:
strategy:
fail-fast: false
matrix:
branch: [devel]
target: [linux, macos, windows]
arch: [i386, amd64]
include:
- target: linux
builder: ubuntu-20.04
- target: macos
builder: macos-11
- target: windows
builder: windows-2019
shell: msys2 {0}
- target: windows
arch: i386
msystem: mingw32
- target: windows
arch: amd64
msystem: ucrt64
- target: linux
arch: amd64
branch: devel
builddocs: true
exclude:
- target: macos
arch: i386
name: ${{ matrix.target }} on ${{ matrix.arch }} (Nim ${{ matrix.branch }})
runs-on: ${{ matrix.builder }}
defaults:
run:
shell: ${{ matrix.shell || 'bash' }}
working-directory: nim-sys
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
with:
path: nim-sys
submodules: "recursive"
- name: Configure Nim for 32 bit GCC (Linux-only)
if: matrix.arch == 'i386' && runner.os == 'Linux'
run: |
sudo apt-fast update -qq
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
--no-install-recommends -yq gcc-10-i686-linux-gnu
mkdir -p ~/.config/nim
cat << EOF > ~/.config/nim/nim.cfg
gcc.exe = "i686-linux-gnu-gcc-10"
gcc.linkerexe = "i686-linux-gnu-gcc-10"
EOF
- name: Setup MSYS2 (Windows-only)
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2.22.0
with:
msystem: ${{ matrix.msystem }}
- name: Setup Nim
uses: alaviss/setup-nim@0.1.1
with:
path: nim
version: ${{ matrix.branch }}
architecture: ${{ matrix.arch }}
- name: Install dependencies
run: nimble install -y --depsOnly
- name: Run tests
run: nimble test
- name: Build docs
shell: bash
run: |
branch=${{ github.ref }}
branch=${branch##*/}
for i in src/sys/*.nim src/sys/ioqueue/*.nim; do
nimble doc --project --outdir:htmldocs \
'--git.url:https://github.com/${{ github.repository }}' \
'--git.commit:${{ github.sha }}' \
"--git.devel:$branch" \
"$i"
done
# Ignore failures for older Nim
cp htmldocs/{the,}index.html || true
- name: Upload GitHub Pages artifact
if: matrix.builddocs
uses: actions/upload-pages-artifact@v3.0.0
with:
path: nim-sys/htmldocs
deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy page
id: deployment
uses: actions/deploy-pages@v4.0.3