From 186fe737562038c428d843bdb0c09499d53b067a Mon Sep 17 00:00:00 2001 From: zztkm Date: Thu, 4 Aug 2022 02:31:10 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20update=20ci=20system?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yaml | 36 ++++++++++++++ .github/workflows/release.yaml | 88 ++++++++-------------------------- Taskfile.yml | 12 ++++- 3 files changed, 67 insertions(+), 69 deletions(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..6b1cb4d --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,36 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + strategy: + matrix: + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + runs-on: ${{ matrix.os }} + + steps: + - name: Install V + uses: vlang/setup-v@v1 + with: + check-latest: true + + - name: Install Task + uses: arduino/setup-task@v1 + + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@v2 + + - name: Check if code is formatted + run: | + v fmt -diff . + v fmt -verify . + - name: Build ${{ github.event.repository.name }} + run: v . + + - name: Run Tests + run: v test . \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f8d1ee0..106ca71 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,81 +3,33 @@ name: release on: push: tags: - - 'v*' + - "v*.*.*" jobs: - Release-on-Ubuntu: - name: Release on Ubuntu - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: denoland/setup-deno@v1 - with: - deno-version: v1.x - - uses: goto-bus-stop/setup-zig@v1 - with: - version: 0.9.1 - - name: make x86_64 - run: make dist - - name: make aarch64 - run: ./misc/build-aarch64.sh - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: | - dist/** + build: + strategy: + matrix: + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + runs-on: ${{ matrix.os }} - Release-on-Darwin: - name: Release on Darwin - runs-on: macos-latest steps: - - uses: actions/checkout@v3 - - uses: denoland/setup-deno@v1 - with: - deno-version: v1.x - - uses: goto-bus-stop/setup-zig@v1 - with: - version: 0.9.1 - - name: make x86_64 - run: make dist - - name: make aarch64 - run: ./misc/build-aarch64.sh - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') + - name: Install V + uses: vlang/setup-v@v1 with: - files: | - dist/** + check-latest: true - Release-on-Windows: - name: Release on Windows - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - uses: denoland/setup-deno@v1 - with: - deno-version: v1.x - #- uses: goto-bus-stop/setup-zig@v1 - # with: - # version: 0.9.1 - - uses: msys2/setup-msys2@v2 - with: - update: true - install: mingw-w64-x86_64-toolchain - msystem: MINGW64 - path-type: inherit - - name: make x86_64 - shell: msys2 {0} - run: | - mingw32-make dist - #- name: make aarch64 - # shell: msys2 {0} - # run: | - # mingw32-make ARCH=aarch64 CC="zig cc -target aarch64-windows" + - name: Install Task + uses: arduino/setup-task@v1 + + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@v2 + + - name: Build ${{ github.event.repository.name }} + run: task dist + - name: Release uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, "refs/tags/") with: files: | - dist/** \ No newline at end of file + dist/** diff --git a/Taskfile.yml b/Taskfile.yml index 4635d16..2fc4f9c 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -2,6 +2,9 @@ version: '3' +env: + TARGET: vss + tasks: doc: @@ -30,10 +33,17 @@ tasks: cmds: - rm -rf dist/ + dist: + desc: Mkdir dist + cmds: + - mkdir -p dist + - task: build + - cp $TARGET dist/ + build: desc: Build vss cmds: - - v . + - v . -o $TARGET example: desc: Setup for example