diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93de4dc8..c425be10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..225bd18e --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,32 @@ +name: Lint + +on: + workflow_call: + +jobs: + fmt: + runs-on: ubuntu-latest + steps: + - name: Setup V + uses: vlang/setup-v@v1.3 + 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/setup-v@v1.3 + with: + check-latest: true + - uses: actions/checkout@v4 + with: + path: ui + - name: Run vet + run: v vet ui/ diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 00000000..13eb1375 --- /dev/null +++ b/.github/workflows/linux.yml @@ -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/setup-v@v1.3 + 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/setup-v@v1.3 + 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 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 00000000..87bdfb9f --- /dev/null +++ b/.github/workflows/macos.yml @@ -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/setup-v@v1.3 + 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/setup-v@v1.3 + 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 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 00000000..e26eee49 --- /dev/null +++ b/.github/workflows/windows.yml @@ -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/setup-v@v1.3 + 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/setup-v@v1.3 + 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