Update main.yml #229
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: Build and test Absytree | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "build" | |
cancel-in-progress: true | |
jobs: | |
build-absytree-linux: | |
name: Build Absytree Linux | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
container: ["nimlang/nim:2.0.0-regular"] | |
container: | |
image: ${{ matrix.container }} | |
volumes: | |
- ${{ github.workspace }}:/app | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v3 | |
#- uses: jiro4989/setup-nim-action@v1 | |
# with: | |
# nim-version: '2.0.x' | |
# repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: add Absytree as git safe.directory so nimble can install stuff | |
run: git config --global --add safe.directory /__w/Absytree/Absytree | |
- name: nimble setup | |
run: PATH=/github/home/.nimble/bin:$PATH nimble setup | |
- run: apt-get update | |
continue-on-error: true | |
- run: apt-get install gcc-mingw-w64 libx11-xcb-dev -y | |
continue-on-error: true | |
# linux builds | |
- run: nimble buildAbsytreeServer | |
- if: always() | |
run: nimble buildLspWs | |
- if: always() | |
run: nimble buildBrowser | |
- if: always() | |
run: nimble buildDesktop --app:console -D:forceLogToFile -D:enableGui=false -D:enableTerminal=true --out:astt | |
- if: always() | |
run: nimble buildDesktop --app:gui -D:forceLogToFile -D:enableGui=true -D:enableTerminal=false --out:ast | |
# create release packages | |
- run: nim ./tools/package_release.nims | |
- run: ls -la release_linux | |
- run: ls -la release_web | |
# make zips | |
- name: Zip release_linux | |
uses: vimtor/action-zip@v1 | |
with: | |
files: release_linux | |
dest: release_linux.zip | |
- name: Zip release_web | |
uses: vimtor/action-zip@v1 | |
with: | |
files: release_web | |
dest: release_web.zip | |
# upload artifacts | |
- name: Upload release_linux | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release_linux | |
path: release_linux.zip | |
- name: Upload release_web | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release_web | |
path: release_web.zip | |
build-absytree-windows: | |
name: Build Absytree Windows | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v3 | |
- uses: jiro4989/setup-nim-action@v1 | |
with: | |
nim-version: '2.0.x' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: nimble setup | |
continue-on-error: true | |
run: nimble setup | |
- name: nimble setup | |
run: nimble setup | |
# windows builds | |
- if: always() | |
run: nimble buildDesktop --app:console -D:forceLogToFile -D:enableGui=false -D:enableTerminal=true --out:astt.exe | |
- if: always() | |
run: nimble buildDesktop --app:gui -D:forceLogToFile -D:enableGui=true -D:enableTerminal=false --out:ast.exe | |
- if: always() | |
run: nimble buildAbsytreeServerWindows | |
- if: always() | |
run: nimble buildLspWsWindows | |
# create release packages | |
- run: nim ./tools/package_release.nims | |
# make zips | |
- name: Zip release_windows | |
uses: vimtor/action-zip@v1 | |
with: | |
files: release_windows | |
dest: release_windows.zip | |
# upload artifacts | |
- name: Upload release_windows | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release_windows | |
path: release_windows.zip | |
run-tests: | |
name: Run tests | |
runs-on: ubuntu-latest | |
container: | |
image: nimlang/nim:2.0.0-regular | |
volumes: | |
- ${{ github.workspace }}:/app | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v3 | |
- name: add Absytree as git safe.directory so nimble can install stuff | |
run: git config --global --add safe.directory /__w/Absytree/Absytree | |
- name: nimble setup | |
run: PATH=/github/home/.nimble/bin:$PATH nimble setup | |
- name: Run tests | |
run: testament --print category unit | |
- name: Build test report | |
if: always() | |
run: testament html | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: testresults.html | |
path: testresults.html | |
# Build job | |
build-page: | |
runs-on: ubuntu-latest | |
needs: run-tests | |
if: always() | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: testresults.html | |
continue-on-error: true | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Build with Jekyll | |
uses: actions/jekyll-build-pages@v1 | |
with: | |
source: ./ | |
destination: ./_site | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build-page | |
if: always() | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |