CI #261
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: CI | |
on: | |
push: | |
pull_request: | |
branches: [master] | |
schedule: | |
- cron: '0 6 * * 6' | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- crystal: nightly | |
os: ubuntu-latest | |
- crystal: latest | |
os: macos-latest | |
runs-on: ${{matrix.os}} | |
steps: | |
- name: Install Crystal | |
uses: oprypin/install-crystal@v1 | |
with: | |
crystal: ${{matrix.crystal}} | |
- name: Install SFML | |
uses: oprypin/install-sfml@v1 | |
with: | |
sfml: '2.5.1' | |
- name: Download source | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Check code formatting and generated files | |
if: matrix.crystal == 'latest' | |
run: | | |
.tools/hooks/pre-commit | |
- name: Install shards | |
run: | | |
shards install | |
- name: Build | |
run: | | |
make -j | |
- name: Build docs | |
run: | | |
.tools/build_docs.sh | |
- name: Build examples | |
run: | | |
echo examples/*.cr | xargs -n1 -t crystal build | |
- name: Start virtual display | |
if: runner.os == 'Linux' | |
run: | | |
echo "DISPLAY=:99.0" >>$GITHUB_ENV | |
Xvfb :99 -screen 0 1024x768x24 +extension GLX & | |
- name: Run example | |
run: | | |
LD_LIBRARY_PATH="$(pwd)" ./simple & | |
pid=$!; sleep 3; kill $pid | |
- name: Upload to GitHub Pages | |
if: runner.os == 'Linux' | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: docs | |
deploy-docs: | |
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} |