Skip to content

Update main.yml

Update main.yml #478

Workflow file for this run

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: ["ubuntu:22.04"]
container:
image: ${{ matrix.container }}
volumes:
- ${{ github.workspace }}:/app
steps:
- name: Checkout the repo
uses: actions/checkout@v4.1.7
- run: apt-get update
continue-on-error: true
- run: apt-get install gcc-mingw-w64 libx11-xcb-dev curl wget build-essential git musl-tools -y
continue-on-error: true
- name: Install stable rust toolchain
uses: dtolnay/rust-toolchain@1.78
- run: rustup target add x86_64-unknown-linux-musl
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.29.3'
# install choosenim and nim
#- run: wget https://nim-lang.org/choosenim/init.sh -O init-choosenim.sh
#- run: ls -la
#- run: chmod +x init-choosenim.sh
#- run: CHOOSENIM_CHOOSE_VERSION="stable" ./init-choosenim.sh -y
- uses: iffy/install-nim@v5
with:
version: binary:2.0.6
- name: add Absytree as git safe.directory so nimble can install stuff
run: git config --global --add safe.directory /__w/Absytree/Absytree
continue-on-error: true
# not working because "source" doesn't exist?
#- run: echo "export PATH=/github/home/.nimble/bin:\$PATH" > ~/.profile
#- run: source ~/.profile
# continue-on-error: true
- name: Cache nimble modules
id: cache-nimble
uses: actions/cache@v3
env:
cache-name: cache-nimble-modules
with:
path: ~/.nimble
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('nimble.lock') }}
- name: nimble setup
continue-on-error: true
run: PATH=/github/home/.nimble/bin:$PATH nimble setup
# linux builds
- run: PATH=/github/home/.nimble/bin:$PATH nimble buildAbsytreeServer
- run: PATH=/github/home/.nimble/bin:$PATH nimble buildLspWs
- run: PATH=/github/home/.nimble/bin:$PATH nimble buildDesktop --app:console -D:forceLogToFile -D:enableGui=false -D:enableTerminal=true --out:ast
- run: PATH=/github/home/.nimble/bin:$PATH nimble buildDesktop --app:gui -D:forceLogToFile -D:enableGui=true -D:enableTerminal=false --out:astg
- run: PATH=/github/home/.nimble/bin:$PATH nimble buildDesktop --app:console -D:forceLogToFile -D:enableGui=false -D:enableTerminal=true -d:musl -d:nimWasmtimeBuildMusl --out:ast-musl
# create release packages
- run: PATH=/github/home/.nimble/bin:$PATH nim ./tools/package_release.nims -l
- run: ls -la release_linux
#- run: ls -la release_web
# make zips
- name: Zip release_linux
uses: vimtor/action-zip@v1.2
with:
files: release_linux
dest: release_linux.zip
#- name: Zip release_web
# uses: vimtor/action-zip@v1.2
# with:
# files: release_web
# dest: release_web.zip
# upload artifacts
- name: Upload release_linux
uses: actions/upload-artifact@v4.3.3
with:
name: release_linux
path: release_linux.zip
#- name: Upload release_web
# uses: actions/upload-artifact@v4.3.3
# 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@v4.1.7
# If I want a specific cmake version
# - name: Setup cmake
# uses: jwlawson/actions-setup-cmake@v2
# with:
# cmake-version: '3.29.3'
# If I want a specific rust version
#- name: Install latest nightly
# uses: actions-rs/toolchain@v1.0.6
# with:
# toolchain: stable
# override: true
- run: $env:TMP = "$env:USERPROFILE\T"
continue-on-error: true
- run: $env:TEMP = "$env:USERPROFILE\T"
continue-on-error: true
- run: echo $env:TMP $env:TEMP
continue-on-error: true
- uses: iffy/install-nim@v5
with:
version: binary:2.0.6
- name: Cache nimble modules
id: cache-nimble
uses: actions/cache@v3
env:
cache-name: cache-nimble-modules
with:
path: ~/.nimble
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('nimble.lock') }}
- if: ${{ steps.cache-nimble.outputs.cache-hit != 'true' }}
name: nimble setup
continue-on-error: true
run: nimble setup
- name: nimble setup
continue-on-error: true
run: nimble setup
# windows builds
- run: nimble buildDesktop --app:console -D:forceLogToFile -D:enableGui=false -D:enableTerminal=true --out:ast.exe
- run: nimble buildDesktop --app:gui -D:forceLogToFile -D:enableGui=true -D:enableTerminal=false --out:astg.exe
- run: nimble buildAbsytreeServerWindows
- run: nimble buildLspWsWindows
# create release packages
- run: nim ./tools/package_release.nims -w
# make zips
- name: Zip release_windows
uses: vimtor/action-zip@v1.2
with:
files: release_windows
dest: release_windows.zip
# upload artifacts
- name: Upload release_windows
uses: actions/upload-artifact@v4.3.3
with:
name: release_windows
path: release_windows.zip
run-tests:
name: Run tests
runs-on: ubuntu-latest
container:
image: "nimlang/nim:2.0.2-regular"
volumes:
- ${{ github.workspace }}:/app
steps:
- name: Checkout the repo
uses: actions/checkout@v4.1.7
- run: apt-get update
continue-on-error: true
- run: apt-get install gcc-mingw-w64 libx11-xcb-dev curl wget build-essential git musl-tools -y
continue-on-error: true
- name: Install stable rust toolchain
uses: dtolnay/rust-toolchain@1.78
- run: rustup target add x86_64-unknown-linux-musl
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.29.3'
- name: add Absytree as git safe.directory so nimble can install stuff
run: git config --global --add safe.directory /__w/Absytree/Absytree
- name: Cache nimble modules
id: cache-nimble
uses: actions/cache@v3
env:
cache-name: cache-nimble-modules
with:
path: ~/.nimble
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('nimble.lock') }}
- name: nimble setup
continue-on-error: true
run: PATH=/github/home/.nimble/bin:$PATH nimble setup
- run: "echo 'import nimwasmtime' > src/temp.nim && nim c -d:nimWasmtimeBuild src/temp.nim"
- name: Run tests
continue-on-error: true
run: testament --print category unit
- name: Build test report
run: testament html
- uses: actions/upload-artifact@v4.3.3
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@v4.1.7
- uses: actions/download-artifact@v4.1.7
with:
name: testresults.html
continue-on-error: true
- name: Setup Pages
uses: actions/configure-pages@v5.0.0
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1.0.12
with:
source: ./
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3.0.1
# 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@v4.0.5