Skip to content

ci: improve caching strategy #95

ci: improve caching strategy

ci: improve caching strategy #95

Workflow file for this run

name: CI
on:
push:
paths-ignore: ['**/*.md']
pull_request:
paths-ignore: ['**/*.md']
env:
REPO_NAME: ${{ github.event.repository.name }}
MOD_PATH: ~/.vmodules/vibe
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Install V
uses: vlang/[email protected]
with:
check-latest: true
- name: Setup Dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libcurl4-openssl-dev
version: 1.0
- name: Checkout ${{ env.REPO_NAME }}
uses: actions/checkout@v3
with:
path: ${{ env.REPO_NAME }}
- name: Setup ${{ env.REPO_NAME }}
run: cp -r ${{ env.REPO_NAME }} ${{ env.MOD_PATH }}
- name: Cache
uses: actions/cache/save@v3
with:
path: |
vlang
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}
lint:
needs: setup
uses: tobealive/vibe/.github/workflows/lint.yml@main
test:
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
optimization: ['', -cstrict]
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/[email protected]
- name: Setup Dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libcurl4-openssl-dev
version: 1.0
- name: Run tests
run: v -cg ${{ matrix.optimization }} test ${{ env.MOD_PATH }}
different-compilers:
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [gcc, clang]
optimization: ['', -prod]
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/[email protected]
- name: Setup Dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libcurl4-openssl-dev
version: 1.0
- name: Build
run: v -cg -shared -cc ${{ matrix.compiler }} ${{ matrix.optimization }} ${{ env.MOD_PATH }}
clang-sanitizers:
needs: different-compilers
runs-on: ubuntu-latest
strategy:
matrix:
sanitizer: [address, leak]
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/[email protected]
- name: Setup Dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libcurl4-openssl-dev
version: 1.0
- name: Test
run: v -cc clang -cflags -fsanitize=${{ matrix.sanitizer }} test ${{ env.MOD_PATH }}
gcc-sanitizers:
needs: different-compilers
runs-on: ubuntu-latest
strategy:
matrix:
sanitizer: [leak, address]
env:
SANITIZER: ${{ matrix.sanitizer }}
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/[email protected]
- name: Setup Dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libcurl4-openssl-dev
version: 1.0
- name: Test
run: |
if [[ $SANITIZER == "address" ]]; then
v -cc gcc -cflags -fsanitize=address -cflags -fsanitize-address-use-after-scope -cflags -fsanitize=pointer-compare -cflags -fsanitize=pointer-subtract test ${{ env.MOD_PATH }}
else
v -cc gcc -cflags -fsanitize=${{ matrix.sanitizer }} test ${{ env.MOD_PATH }}
fi