github.com/xxf098/lite-proxy@v0.15.1-0.20230422081941-12c69f323218/.github/workflows/test.yaml (about)

     1  name: Build
     2  
     3  on:
     4    push:
     5      branches:
     6      - master
     7    pull_request:
     8      branches:
     9      - master
    10  
    11  # A workflow run is made up of one or more jobs that can run sequentially or in parallel
    12  jobs:
    13    # The "build" workflow
    14    build:
    15      strategy:
    16        matrix:
    17          # Include amd64 on all platforms.
    18          goos: [linux]
    19          goarch: [amd64]
    20        fail-fast: false    
    21      # The type of runner that the job will run on
    22      runs-on: ubuntu-latest
    23      env:
    24        GOOS: ${{ matrix.goos }}
    25        GOARCH: ${{ matrix.goarch }}
    26        GOARM: ${{ matrix.goarm }}
    27        CGO_ENABLED: 0    
    28  
    29      # Steps represent a sequence of tasks that will be executed as part of the job
    30      steps:
    31      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    32      - uses: actions/checkout@v2
    33    
    34      - name: Show workflow information
    35        id: get_filename
    36        run: |
    37          export _NAME=$(jq ".[\"$GOOS-$GOARCH$GOARM\"].friendlyName" -r < release/friendly-filenames.json)
    38          echo "GOOS: $GOOS, GOARCH: $GOARCH, GOARM: $GOARM, RELEASE_NAME: $_NAME"
    39          echo "::set-output name=ASSET_NAME::$_NAME"
    40          echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV    
    41      
    42      - name: Check out code into the Go module directory
    43        uses: actions/checkout@v3
    44  
    45      - name: Setup Go
    46        uses: actions/setup-go@v3
    47        with:
    48          go-version: 1.20.1
    49          cache: true
    50          
    51      - uses: actions/setup-node@v3
    52        with:
    53          node-version: 16      
    54      
    55      # Install all the dependencies
    56      - name: Install dependencies
    57        run: |
    58          go version
    59          cp $(go env GOROOT)/misc/wasm/wasm_exec.js ./web/gui/wasm_exec.js
    60          npm install --prefix web/gui build
    61          NODE_ENV=production  npm run --prefix web/gui build
    62          GOOS=js GOARCH=wasm go get -u ./...
    63          GOOS=js GOARCH=wasm go build -o ./web/gui/dist/main.wasm ./wasm
    64      
    65          
    66      # Run build of the application
    67      - name: Run build
    68        run: go build -o lite
    69      
    70      # Run testing on the code
    71      - name: Run testing
    72        if: matrix.goos != 'windows'
    73        run: ls -thla lite
    74  
    75      - name: Create ZIP archive
    76        run: |
    77          zip -9vr lite-$ASSET_NAME.zip lite
    78          FILE=./lite-$ASSET_NAME.zip
    79  
    80      - name: Upload ZIP file to Artifacts
    81        uses: actions/upload-artifact@v2
    82        with:
    83          name: lite-${{ steps.get_filename.outputs.ASSET_NAME }}.zip
    84          path: lite-${{ steps.get_filename.outputs.ASSET_NAME }}.zip