Skip to content

Commit

Permalink
ci: update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed May 16, 2024
1 parent da8579a commit 0174222
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 205 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ on:
jobs:
linux:
uses: ./.github/workflows/linux.yml
permissions:
contents: write

macos:
uses: ./.github/workflows/macos.yml
Expand Down
55 changes: 21 additions & 34 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,38 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy docs to GitHub Pages
name: Docs

on:
# Runs on pushes targeting the default branch and docs path
push:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab
branches: [main]
paths-ignore: ['**.yml', '!.github/workflows/docs.yml']
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: 'pages'
cancel-in-progress: false
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main' }}

jobs:
# Single deploy job since we're just deploying
deploy:
if: github.repository == 'ttytm/webview'
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Install V
uses: vlang/setup-v@v1.3
with:
check-latest: true
- name: Checkout
uses: actions/checkout@v3
with:
path: webview
- uses: actions/checkout@v4
- name: Setup pages
uses: actions/configure-pages@v5
- name: Setup V
uses: vlang/setup-v@v1.4
- name: Build docs
run: |
cd webview
./build.vsh docs
run: ./build.vsh docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
path: 'webview/_docs'
- name: Deploy to GitHub Pages
path: '_docs'
- name: Deploy to GitHub pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
27 changes: 0 additions & 27 deletions .github/workflows/lint-docs.yml

This file was deleted.

46 changes: 29 additions & 17 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,50 @@ name: Lint
on:
workflow_call:

env:
MOD_PATH: ~/.vmodules/ttytm/webview

jobs:
fmt:
runs-on: ubuntu-latest
steps:
- name: Restore Cache
uses: actions/cache/restore@v3
- name: Restore cache
uses: actions/cache/restore@v4
with:
path: |
vlang
~/v
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Setup V
uses: vlang/setup-v@v1.3
- name: Check Formatting
run: v fmt -verify ${{ env.MOD_PATH }}
- name: Verify formatting
run: ~/v/v fmt -verify ~/.vmodules/ttytm/webview && exit 0 || ~/v/v fmt -diff . && exit 1

vet:
runs-on: ubuntu-latest
steps:
- name: Restore Cache
uses: actions/cache/restore@v3
- name: Restore cache
uses: actions/cache/restore@v4
with:
path: |
~/v
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Vet
run: ~/v/v vet -W ~/.vmodules/ttytm/webview

check-md:
runs-on: ubuntu-latest
steps:
- name: Restore cache
uses: actions/cache/restore@v4
with:
path: |
vlang
~/v
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Setup V
uses: vlang/setup-v@v1.3
- name: Run Vet
run: v vet -W ${{ env.MOD_PATH }}/src/
- name: Setup dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libcurl4-openssl-dev
version: 1.0
- name: Check markdown
run: ~/v/v check-md -hide-warnings ~/.vmodules/ttytm/webview
128 changes: 55 additions & 73 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,135 +3,117 @@ name: CI Linux
on:
workflow_call:

env:
REPO_NAME: ${{ github.event.repository.name }}
# Path where the module is installed with `v install <giturl>`
MOD_PATH: ~/.vmodules/ttytm/webview

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Install V
uses: vlang/setup-v@v1.3
- uses: actions/checkout@v4
with:
check-latest: true
- name: Setup Dependencies
path: webview
- name: Setup V
run: |
curl -Lo v_linux.zip https://github.com/vlang/v/releases/latest/download/v_linux.zip
unzip -o v_linux.zip
mv v ~/v
~/v/v symlink
- name: Setup dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libgtk-3-dev libwebkit2gtk-4.0-dev
version: 1.0
- name: Setup ~/.vmodules
run: mkdir -p ~/.vmodules/ttytm
- name: Checkout ${{ env.REPO_NAME }}
uses: actions/checkout@v3
with:
path: ${{ env.REPO_NAME }}
- name: Setup ${{ env.REPO_NAME }}
- name: Setup V module
run: |
${{ env.REPO_NAME }}/build.vsh --silent
mkdir -p ~/.vmodules/ttytm/ # `${{ env.MOD_PATH }}` runs into a dir not found error during tests.
cp -r ${{ env.REPO_NAME }} ${{ env.MOD_PATH }}
- name: Cache
uses: actions/cache/save@v3
mkdir -p ~/.vmodules/ttytm && mv webview ~/.vmodules/ttytm/webview
~/.vmodules/ttytm/webview/build.vsh --silent
- name: Save cache
uses: actions/cache/save@v4
with:
path: |
vlang
~/v
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}

lint:
needs: setup
uses: ./.github/workflows/lint.yml

build:
test:
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [tcc, gcc, clang]
optimization: ['', '-cstrict']
cc: [tcc, gcc, clang]
optimization: ['', '-W -cstrict']
exclude:
- compiler: clang
optimization: -cstrict
- cc: tcc
optimization: '-W -cstrict'
- cc: clang
optimization: '-W -cstrict'
fail-fast: false
env:
VFLAGS: -cg -cc ${{ matrix.cc }} ${{ matrix.optimization }}
steps:
- name: Restore Cache
uses: actions/cache/restore@v3
- name: Restore cache
uses: actions/cache/restore@v4
with:
path: |
vlang
~/v
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Setup V
uses: vlang/setup-v@v1.3
- name: Setup Dependencies
run: ~/v/v symlink && v -showcc self && v doctor
- name: Setup dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libgtk-3-dev libwebkit2gtk-4.0-dev
version: 1.0
- name: Build
- name: Test
run: xvfb-run v -stats test ~/.vmodules/ttytm/webview/tests/
- name: Build examples
run: |
for example_dir in $(find ${{ env.MOD_PATH }}/examples/* -maxdepth 0 -type d); do
cmd="v -cg -cc ${{ matrix.compiler }} ${{ matrix.optimization }} $example_dir/"
for example_dir in $(find ~/.vmodules/ttytm/webview/examples/* -maxdepth 0 -type d); do
cmd="v $example_dir/"
[[ "$example_dir" =~ .*"emoji-picker"$ ]] && cmd+="main.v"
echo "$cmd"
eval "$cmd"
done
test:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Restore Cache
uses: actions/cache/restore@v3
with:
path: |
vlang
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Setup V
uses: vlang/setup-v@v1.3
- name: Setup Dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libgtk-3-dev libwebkit2gtk-4.0-dev
version: 1.0
- name: Test
run: xvfb-run v -stats test ${{ env.MOD_PATH }}/tests/

test-sanitized:
needs: test
if: false # Skip sanitzed tests until issues are addressed.
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [gcc]
include:
- compiler: gcc
sanitizer: -cflags -fsanitize=undefined -cflags -fsanitize=shift -cflags -fsanitize=shift-exponent -cflags -fsanitize=shift-base -cflags -fsanitize=integer-divide-by-zero -cflags -fsanitize=unreachable -cflags -fsanitize=vla-bound -cflags -fsanitize=null -cflags -fsanitize=return -cflags -fsanitize=signed-integer-overflow -cflags -fsanitize=bounds -cflags -fsanitize=bounds-strict -cflags -fsanitize=alignment -cflags -fsanitize=object-size -cflags -fsanitize=float-divide-by-zero -cflags -fsanitize=float-cast-overflow -cflags -fsanitize=nonnull-attribute -cflags -fsanitize=returns-nonnull-attribute -cflags -fsanitize=bool -cflags -fsanitize=enum -cflags -fsanitize=vptr -cflags -fsanitize=pointer-overflow -cflags -fsanitize=builtin
# sanitizer: -cflags -fsanitize=leak
# sanitizer: -cflags -fsanitize=address -cflags -fsanitize-address-use-after-scope -cflags -fsanitize=pointer-compare -cflags -fsanitize=pointer-subtract
# - compiler: clang
# sanitizer: address
# sanitizer: memory
# sanitizer: leak
- cc: gcc
sanitizer: address,leak,undefined,shift,shift-exponent,shift-base,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,bounds-strict,alignment,object-size,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr
- cc: gcc
sanitizer: thread
- cc: clang
sanitizer: address,leak,undefined
- cc: clang
sanitizer: thread
- cc: clang
sanitizer: memory
fail-fast: false
env:
VFLAGS: -cg -cc ${{ matrix.cc }}
steps:
- name: Restore Cache
uses: actions/cache/restore@v3
- name: Restore cache
uses: actions/cache/restore@v4
with:
path: |
vlang
~/v
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Setup V
uses: vlang/setup-v@v1.3
- name: Setup Dependencies
run: ~/v/v symlink && v -showcc self && v doctor
- name: Setup dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libgtk-3-dev libwebkit2gtk-4.0-dev
version: 1.0
- name: Test
run: xvfb-run v -cc gcc ${{ matrix.sanitizer }} test ${{ env.MOD_PATH }}/tests/
run: xvfb-run v -stats -cflags -fsanitize=${{ matrix.sanitizer }} test ~/.vmodules/ttytm/webview/tests/
Loading

0 comments on commit 0174222

Please sign in to comment.