Skip to content

Commit

Permalink
ci: update workflows (#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm authored Oct 12, 2023
1 parent f1cb92e commit e166887
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 75 deletions.
82 changes: 7 additions & 75 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,82 +7,14 @@ on:
- cron: '31 1,12 * * *'

jobs:
code-style:
runs-on: ubuntu-latest
steps:
- name: Checkout V
uses: actions/checkout@v2
with:
repository: vlang/v
- name: Checkout V UI
uses: actions/checkout@v2
with:
path: vlib/ui
- name: Build V
run: make
# - name: v vet
# run: ./v vet vlib/ui
- name: v fmt -verify
run: ./v fmt -verify vlib/ui
lint:
uses: ./.github/workflows/lint.yml

ubuntu:
runs-on: ubuntu-latest
steps:
- name: Checkout V
uses: actions/checkout@v2
with:
repository: vlang/v
- name: Checkout V UI
uses: actions/checkout@v2
with:
path: vlib/ui
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --quiet -y libglfw3-dev libxi-dev libxcursor-dev
- name: Build V
run: make && ./v symlink
- name: Build UI examples
run: v run vlib/ui/examples/build_examples.vsh
- name: Build users.v with -prod
run: v -prod vlib/ui/examples/users.v
linux:
uses: ./.github/workflows/linux.yml

macos:
runs-on: macos-latest
steps:
- name: Checkout V
uses: actions/checkout@v2
with:
repository: vlang/v
- name: Checkout V UI
uses: actions/checkout@v2
with:
path: vlib/ui
- name: Build V
run: make && ./v symlink
- name: Build UI examples
run: v run vlib/ui/examples/build_examples.vsh
- name: Build users.v with -prod
run: v -prod vlib/ui/examples/users.v
uses: ./.github/workflows/macos.yml

windows-msvc:
runs-on: windows-latest
env:
VFLAGS: -cc msvc
steps:
- name: Checkout V
uses: actions/checkout@v2
with:
repository: vlang/v
- name: Checkout V UI
uses: actions/checkout@v2
with:
path: vlib/ui
- name: Build V
run: .\make.bat -msvc
# Don't move applying V directory to PATH, to other steps
# otherwise this step and V script won't see V executable.
- name: Build UI examples
run: .\v.exe run vlib\ui\examples\build_examples.vsh
- name: Build users.v with -prod
run: .\v.exe -prod vlib\ui\examples\users.v
windows:
uses: ./.github/workflows/windows.yml
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint

on:
workflow_call:

jobs:
fmt:
runs-on: ubuntu-latest
steps:
- name: Setup V
uses: vlang/[email protected]
with:
check-latest: true
- uses: actions/checkout@v4
with:
path: ui
- name: Check formatting
run: v fmt -verify ui/

vet:
runs-on: ubuntu-latest
if: false # TODO: satisfy vet tool
steps:
- name: Setup V
uses: vlang/[email protected]
with:
check-latest: true
- uses: actions/checkout@v4
with:
path: ui
- name: Run vet
run: v vet ui/
55 changes: 55 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Linux CI

on:
workflow_call:

env:
# Path where the module is installed for usage as V module.
MOD_PATH: $HOME/.vmodules/ui

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Setup V
uses: vlang/[email protected]
with:
check-latest: true
- uses: actions/checkout@v4
with:
path: ui
- name: Setup V UI module
shell: bash
run: |
mv ui ${{ env.MOD_PATH }}
find $HOME/.vmodules
- name: Cache
uses: actions/cache/save@v3
with:
path: |
vlang
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}

build:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Restore V 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]
with:
check-latest: true
- name: Install dependencies
run: sudo apt update && sudo apt install --quiet -y libglfw3-dev libxi-dev libxcursor-dev
- name: Build UI examples
run: v run ${{ env.MOD_PATH }}/examples/build_examples.vsh
- name: Build users.v with -prod
run: v -prod ${{ env.MOD_PATH }}/examples/users.v
53 changes: 53 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: macOS CI

on:
workflow_call:

env:
# Path where the module is installed for usage as V module.
MOD_PATH: $HOME/.vmodules/ui

jobs:
setup:
runs-on: macos-latest
steps:
- name: Setup V
uses: vlang/[email protected]
with:
check-latest: true
- uses: actions/checkout@v4
with:
path: ui
- name: Setup V UI module
shell: bash
run: |
mv ui ${{ env.MOD_PATH }}
find $HOME/.vmodules
- name: Cache
uses: actions/cache/save@v3
with:
path: |
vlang
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}

build:
needs: setup
runs-on: macos-latest
steps:
- name: Restore V 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]
with:
check-latest: true
- name: Build UI examples
run: v run ${{ env.MOD_PATH }}/examples/build_examples.vsh
- name: Build users.v with -prod
run: v -prod ${{ env.MOD_PATH }}/examples/users.v
53 changes: 53 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Windows CI

on:
workflow_call:

env:
# Path where the module is installed for usage as V module.
MOD_PATH: $HOME/.vmodules/ui

jobs:
setup:
runs-on: windows-latest
steps:
- name: Setup V
uses: vlang/[email protected]
with:
check-latest: true
- uses: actions/checkout@v4
with:
path: ui
- name: Setup V UI module
shell: bash
run: |
mv ui ${{ env.MOD_PATH }}
find $HOME/.vmodules
- name: Cache
uses: actions/cache/save@v3
with:
path: |
vlang
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}

build:
needs: setup
runs-on: windows-latest
steps:
- name: Restore V 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]
with:
check-latest: true
- name: Build UI examples
run: v run ${{ env.MOD_PATH }}/examples/build_examples.vsh
- name: Build users.v with -prod
run: v -prod ${{ env.MOD_PATH }}/examples/users.v

0 comments on commit e166887

Please sign in to comment.