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 da10e4c commit f21f2f2
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 244 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ jobs:

macOS:
uses: ./.github/workflows/macos.yml
permissions:
contents: write

windows:
uses: ./.github/workflows/windows.yml

release:
needs: [linux, macos, windows]
uses: ./.github/workflows/release.yml
permissions:
contents: write
24 changes: 10 additions & 14 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,22 @@ name: Lint
on:
workflow_call:

env:
REPO_NAME: ${{ github.event.repository.name }}

jobs:
fmt:
verify:
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ env.REPO_NAME }}
uses: actions/checkout@v4
with:
path: ${{ env.REPO_NAME }}
- name: Restore Cache
uses: actions/cache/restore@v3
- uses: actions/checkout@v4
- name: Restore cache
uses: actions/cache/restore@v4
with:
path: |
vlang
~/v
~/.vmodules
key: ${{ runner.os }}-
fail-on-cache-miss: true
- name: Setup V
run: vlang/v symlink && v version
- name: Check Formatting
run: v fmt ${{ env.REPO_NAME }} && v fmt -verify ${{ env.REPO_NAME }}
run: ~/v/v symlink && v version
- name: Verify formatting
run: v fmt -verify . && exit 0 || v fmt -diff . && exit 1
- name: Vet
run: v vet -W .
134 changes: 36 additions & 98 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,32 @@ name: Linux
on:
workflow_call:

env:
REPO_NAME: ${{ github.event.repository.name }}

jobs:
setup:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.REPO_NAME }}
steps:
- name: Checkout ${{ env.REPO_NAME }}
uses: actions/checkout@v4
with:
path: ${{ env.REPO_NAME }}
- uses: actions/checkout@v4
- name: Checkout V
uses: actions/checkout@v4
with:
repository: 'vlang/v'
path: vlang
path: v
- name: Setup V
run: cd ../vlang && make -j4 && ./v symlink && v version
run: mv v ~/v && cd ~/v && make -j4 && ./v symlink && v version
- run: v install
- name: Cache
uses: actions/cache/save@v3
uses: actions/cache/save@v4
with:
path: |
vlang
~/v
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}

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

# TODO: update VFLAGS
test:
needs: setup
strategy:
Expand All @@ -51,24 +43,18 @@ jobs:
runs-on: ubuntu-latest
env:
VFLAGS: -cg -cc ${{ matrix.cc }} ${{ matrix.optimization }} -o lvb
defaults:
run:
working-directory: ${{ env.REPO_NAME }}
steps:
- name: Checkout ${{ env.REPO_NAME }}
uses: actions/checkout@v4
with:
path: ${{ env.REPO_NAME }}
- uses: actions/checkout@v4
- name: Restore Cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: |
vlang
~/v
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Setup V
run: ../vlang/v symlink && v version
run: ~/v/v symlink && v version
- name: Build
run: v .
- name: Run
Expand All @@ -79,105 +65,57 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
cc: [gcc, clang]
sanitizer: [address, leak]
include:
- cc: gcc
sanitizer: thread
- 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: clang
sanitizer: undefined
- cc: clang
sanitizer: memory
fail-fast: false
env:
VFLAGS: -cg -cc ${{ matrix.cc }} -o lvb
defaults:
run:
working-directory: ${{ env.REPO_NAME }}
VFLAGS: -cg -cc ${{ matrix.cc }}
steps:
- name: Checkout ${{ env.REPO_NAME }}
uses: actions/checkout@v4
with:
path: ${{ env.REPO_NAME }}
- name: Restore Cache
uses: actions/cache/restore@v3
- uses: actions/checkout@v4
- 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
run: ../vlang/v symlink && v version
run: ~/v/v symlink && v -showcc self && v doctor
- name: Setup zig
uses: goto-bus-stop/setup-zig@v2
- name: Build
run: |
if [[ ${{ matrix.cc }} == "gcc" && ${{ matrix.sanitizer }} == "address" ]]; then
cmd="v $VFLAGS -cflags -fsanitize=address -cflags -fsanitize-address-use-after-scope -cflags -fsanitize=pointer-compare -cflags -fsanitize=pointer-subtract ."
else
cmd="v $VFLAGS -cflags -fsanitize=${{ matrix.sanitizer }} ."
fi
echo "$cmd"
eval "$cmd"
run: v -cflags -fsanitize=${{ matrix.sanitizer }} -o lvb .
- name: Run
run: ./lvb .

deploy:
needs: [test, test-sanitzed, lint]
runs-on: ubuntu-latest
permissions:
contents: write
env:
ARTIFACT: lvb-linux-amd64
VFLAGS: -cc gcc -prod
defaults:
run:
working-directory: ${{ env.REPO_NAME }}
steps:
- name: Checkout ${{ env.REPO_NAME }}
uses: actions/checkout@v4
with:
path: ${{ env.REPO_NAME }}
- 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
run: ../vlang/v symlink && v version
- name: Build
run: v -cc gcc -prod -o $ARTIFACT .
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT }}
path: ${{ env.REPO_NAME }}/${{ env.ARTIFACT }}
- name: Release Artifacts
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v1
with:
files: ${{ env.REPO_NAME }}/${{ env.ARTIFACT }}

deploy-example:
needs: [test]
needs: test
runs-on: ubuntu-latest
permissions:
contents: write
env:
VFLAGS: -cc ${{ matrix.cc }} -prod
ARTIFACT: gui_project-linux-amd64
defaults:
run:
working-directory: ${{ env.REPO_NAME }}
steps:
- name: Checkout ${{ env.REPO_NAME }}
uses: actions/checkout@v4
with:
path: ${{ env.REPO_NAME }}
- uses: actions/checkout@v4
- name: Restore Cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: |
vlang
~/v
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Setup V
run: ../vlang/v symlink && v version
run: ~/v/v symlink && v version
- name: Install dependencies
run: |
sudo apt install -y -qq libgtk-3-dev libwebkit2gtk-4.0-dev
Expand All @@ -190,7 +128,7 @@ jobs:
./build.vsh
mv ./gui_project ./$ARTIFACT
- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT }}
path: ${{ env.REPO_NAME }}/examples/gui_project/${{ env.ARTIFACT }}
path: examples/gui_project/${{ env.ARTIFACT }}
73 changes: 9 additions & 64 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,24 @@ name: macOS
on:
workflow_call:

env:
REPO_NAME: ${{ github.event.repository.name }}

jobs:
setup:
runs-on: macos-latest
defaults:
run:
working-directory: ${{ env.REPO_NAME }}
steps:
- name: Checkout ${{ env.REPO_NAME }}
uses: actions/checkout@v4
with:
path: ${{ env.REPO_NAME }}
- uses: actions/checkout@v4
- name: Checkout V
uses: actions/checkout@v4
with:
repository: 'vlang/v'
path: vlang
path: v
- name: Setup V
run: cd ../vlang && make -j4 && ./v symlink && v version
run: mv v ~v && cd ~/v && make -j4 && ./v symlink && v version
- run: v install
- name: Cache
uses: actions/cache/save@v3
uses: actions/cache/save@v4
with:
path: |
vlang
~/v
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}

Expand All @@ -47,65 +38,19 @@ jobs:
runs-on: macos-latest
env:
VFLAGS: -cg -cc ${{ matrix.cc }} ${{ matrix.optimization }} -o lvb
defaults:
run:
working-directory: ${{ env.REPO_NAME }}
steps:
- name: Checkout ${{ env.REPO_NAME }}
uses: actions/checkout@v4
with:
path: ${{ env.REPO_NAME }}
- uses: actions/checkout@v4
- name: Restore Cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: |
vlang
~/v
~/.vmodules
key: ${{ runner.os }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Setup V
run: ../vlang/v symlink && v version
run: ~/v/v symlink && v version
- name: Build
run: v .
- name: Run
run: ./lvb .

deploy:
needs: test
runs-on: macos-latest
permissions:
contents: write
env:
ARTIFACT: lvb-macos-amd64
defaults:
run:
working-directory: ${{ env.REPO_NAME }}
steps:
- name: Checkout ${{ env.REPO_NAME }}
uses: actions/checkout@v4
with:
path: ${{ env.REPO_NAME }}
- 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
run: ../vlang/v symlink && v version
- name: Build
run: v -cc clang -prod -o $ARTIFACT .
- name: Verify
run: v fmt . && v fmt -verify .
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT }}
path: ${{ env.REPO_NAME }}/${{ env.ARTIFACT }}
- name: Release Artifacts
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v1
with:
files: ${{ env.REPO_NAME }}/${{ env.ARTIFACT }}
Loading

0 comments on commit f21f2f2

Please sign in to comment.