[refactor] merge tui&util, refine tui for pattern seq #21
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
defaults: | |
run: | |
shell: bash | |
env: | |
GO_VERSION: 1.18.10 | |
# GO_VERSION: 1.16.15 | |
OSEXT_MAP: '{"Linux": "linux", "macOS": "macos", "Windows": "exe"}' | |
CACHE_PREFIX: upload-${{ github.run_id }}-${{ github.run_attempt }} | |
SAVE_ARTIFACT: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }} | |
jobs: | |
# Job1: build and test | |
build: | |
# For various OSes | |
name: Build on ${{ matrix.vm-os }} | |
runs-on: ${{ matrix.vm-os }} | |
strategy: | |
max-parallel: 10 | |
fail-fast: false | |
matrix: | |
vm-os: [ubuntu-20.04, macos-12, windows-2022] | |
outputs: | |
save_artifact: ${{ env.SAVE_ARTIFACT }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Go Build | |
env: | |
OSEXT: ${{ fromJSON(env.OSEXT_MAP)[runner.os] }} | |
run: | | |
export | |
git status | |
go version | |
make build | |
make artifact | |
- name: Go Run | |
run: | | |
make preview | |
- name: Cache Artifact | |
uses: actions/cache/save@v3 | |
if: ${{ fromJSON(env.SAVE_ARTIFACT) }} | |
with: | |
path: _upload | |
key: ${{ env.CACHE_PREFIX }}-${{ runner.os }} | |
enableCrossOsArchive: true | |
- name: Analyze | |
if: ${{ runner.os == 'Linux' }} | |
run: | | |
# tokei -- count | |
wget -cqL https://github.com/XAMPPRocky/tokei/releases/download/v12.1.2/tokei-i686-unknown-linux-musl.tar.gz -O tokei.tgz | |
tar zxf tokei.tgz tokei && chmod +x tokei && $SUDO mv tokei /usr/local/bin && rm tokei.tgz | |
echo "=== Tokei Result ===" | |
tokei | |
# revive -- lint | |
wget -cqL https://github.com/mgechev/revive/releases/download/v1.3.3/revive_linux_amd64.tar.gz -O revive.tgz | |
tar zxf revive.tgz revive && chmod +x revive && $SUDO mv revive /usr/local/bin && rm revive.tgz | |
wget -cqL https://bitbucket.org/ai69/common/raw/master/revive.toml -O revive.toml | |
echo "=== Revive Result ===" | |
revive -config revive.toml -formatter friendly ./... | |
# Job2: collect artifacts | |
collect: | |
name: Upload Artifact | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ fromJSON(needs.build.outputs.save_artifact) }} | |
steps: | |
- name: Restore Cache Linux | |
uses: actions/cache/restore@v3 | |
with: | |
path: _upload | |
key: ${{ env.CACHE_PREFIX }}-Linux | |
enableCrossOsArchive: true | |
fail-on-cache-miss: true | |
- name: Restore Cache macOS | |
uses: actions/cache/restore@v3 | |
with: | |
path: _upload | |
key: ${{ env.CACHE_PREFIX }}-macOS | |
enableCrossOsArchive: true | |
fail-on-cache-miss: true | |
- name: Restore Cache Windows | |
uses: actions/cache/restore@v3 | |
with: | |
path: _upload | |
key: ${{ env.CACHE_PREFIX }}-Windows | |
enableCrossOsArchive: true | |
fail-on-cache-miss: true | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dist-gh${{ github.run_number }} | |
path: _upload |