Skip to content

Commit

Permalink
chore: fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
liuq19 committed Feb 13, 2025
1 parent d8ef674 commit f17ac90
Show file tree
Hide file tree
Showing 13 changed files with 165 additions and 240 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '35 21 * * 4'

jobs:
analyze:
name: Analyze
runs-on: [self-hosted, X64]
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Clear repository
run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE

- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild

Check notice

Code scanning / CodeQL

Workflow Should Use Default Setup Note

CodeQL Action could use default setup instead of advanced configuration.
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
33 changes: 0 additions & 33 deletions .github/workflows/fuzzing-linux-x64.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
build:
strategy:
matrix:
os: [macos-latest, X64]
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Clear repository
Expand All @@ -30,4 +30,4 @@ jobs:
run: |
cd ./fuzz
make fuzz
make runopt
make runopt
27 changes: 0 additions & 27 deletions .github/workflows/generic_test-opt.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/generic_test.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/license-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: pull_request

jobs:
build:
runs-on: [self-hosted, X64]
runs-on: ubuntu-latest
steps:
- name: Clear repository
run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
- name: spell check
uses: codespell-project/actions-codespell@v2
with:
skip: loader/internal/iasm/obj/macho.go,loader/internal/iasm/obj/macho.go,loader/internal/iasm/obj/macho.go,loader/internal/iasm/obj/macho.go,loader/internal/iasm/x86_64/encodings.go:720,loader/internal/iasm/x86_64/program.go,loader/internal/iasm/x86_64/program.go,loader/internal/iasm/x86_64/program.go,loader/internal/iasm/expr/ast.go,loader/internal/iasm/expr/errors.go
skip: ./loader/internal/iasm/obj/macho.go,./loader/internal/iasm/x86_64/encodings.go,./loader/internal/iasm/x86_64/program.go,./loader/internal/iasm/expr/ast.go,./loader/internal/iasm/expr/errors.go
72 changes: 72 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@

name: Unit Test

on: pull_request

jobs:
build:
strategy:
max-parallel: 4
matrix:
go-version: [1.20.x, 1.21.x, 1.22.x, 1.23.x]
runner_arch: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
include:
# 排除 ARM 架构上的旧版本
- runner_arch: ubuntu-latest
go-version: 1.17.x
- runner_arch: ubuntu-latest
go-version: 1.18.x
- runner_arch: ubuntu-latest
go-version: 1.19.x

runs-on: ${{ matrix.runner_arch }}

steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
cache: true

- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
${{ github.workspace }}/go.sum
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

- name: Unit Test JIT
run: |
GOMAXPROCS=4 go test -race -covermode=atomic -coverprofile=coverage.txt ./...
- name: Unit Test VM
run: |
SONIC_USE_OPTDEC=1 SONIC_USE_FASTMAP=1 SONIC_ENCODER_USE_VM=1 GOMAXPROCS=4 go test -race -covermode=atomic -coverprofile=coverage.txt ./...
- name: Loader Test
run: |
cd ./loader
go test -v -race ./...
- name: Data Race
run: |
./scripts/test_race.sh
- name: PCSP Test
env:
GOVERSION: ${{ matrix.go-version }}
run: python3 ./scripts/test_pcsp.py

- name: Generic Test JIT
if: ${{ !startsWith(matrix.go-version, '1.17.') }}
run: GOMAXPROCS=4 go test -v -race ./generic_test

- name: Generic Test VM
if: ${{ !startsWith(matrix.go-version, '1.17.') }}
run: GOMAXPROCS=4 SONIC_USE_OPTDEC=1 SONIC_USE_FASTMAP=1 SONIC_ENCODER_USE_VM=1 go test -v -race ./generic_test

- name: Codecov
run: bash <(curl -s https://codecov.io/bash)

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions Job or Workflow does not set permissions
42 changes: 0 additions & 42 deletions .github/workflows/unit_test-linux-arm.yml

This file was deleted.

46 changes: 0 additions & 46 deletions .github/workflows/unit_test-linux-opt-x64.yml

This file was deleted.

Loading

0 comments on commit f17ac90

Please sign in to comment.