update openssf best parctices badge (#2208) #4736
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: CI | |
on: | |
push: | |
branches: | |
- master | |
- release-* | |
pull_request: {} | |
workflow_dispatch: {} | |
env: | |
GO_VERSION: '1.21' | |
GOLANGCI_VERSION: 'v1.55.2' | |
# Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run | |
# a step 'if env.AWS_USR' != ""', so we copy these to succinctly test whether | |
# credentials have been provided before trying to run steps that need them. | |
DOCKER_USR: ${{ secrets.DOCKER_USR }} | |
AWS_USR: ${{ secrets.AWS_USR }} | |
jobs: | |
typos-check: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout Actions Repository | |
uses: actions/checkout@v4 | |
- name: Check spelling with custom config file | |
uses: crate-ci/[email protected] | |
with: | |
config: ./typos.toml | |
verify: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Verify Code | |
run: make verify | |
golangci-lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Lint golang code | |
uses: golangci/[email protected] | |
with: | |
version: ${{ env.GOLANGCI_VERSION }} | |
args: --verbose | |
skip-cache: true | |
mode: readonly | |
# markdownlint-misspell-shellcheck: | |
# runs-on: ubuntu-22.04 | |
# # this image is build from Dockerfile | |
# # https://github.com/pouchcontainer/pouchlinter/blob/master/Dockerfile | |
# container: pouchcontainer/pouchlinter:v0.1.2 | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# - name: Run misspell | |
# run: find ./* -name "*" | xargs misspell -error | |
# - name: Lint markdown files | |
# run: find ./ -name "*.md" | grep -v enhancements | grep -v .github | |
# - name: Check markdown links | |
# run: | | |
# set +e | |
# for name in $(find . -name \*.md | grep -v CHANGELOG); do | |
# if [ -f $name ]; then | |
# markdown-link-check -q $name -c .github/workflows/markdown-link-check.config.json; | |
# if [ $? -ne 0 ]; then | |
# code=1 | |
# fi | |
# fi | |
# done | |
# bash -c "exit $code"; | |
unit-tests: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Fetch History | |
run: git fetch --prune --unshallow | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
# - name: Cache Go Dependencies | |
# uses: actions/cache@v3 | |
# with: | |
# path: ~/go/pkg/mod | |
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
# restore-keys: ${{ runner.os }}-go- | |
- name: Run Unit Tests | |
run: make test | |
- name: Publish Unit Test Coverage | |
# only publish result in openyurt repo | |
if: github.repository == 'openyurtio/openyurt' | |
uses: codecov/[email protected] | |
with: | |
name: codecov-umbrella | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: unittests | |
files: ./cover.out,./yurttunnel-cover.out | |
version: v0.6.0 | |
fail_ci_if_error: true | |
verbose: true | |
e2e-tests: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
# - uses: actions/cache@v3 | |
# with: | |
# path: ~/go/pkg/mod | |
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
# restore-keys: ${{ runner.os }}-go- | |
- name: Install Required Commands | |
run: | | |
go install sigs.k8s.io/[email protected] | |
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.28.7/bin/linux/amd64/kubectl && sudo install kubectl /usr/local/bin/kubectl | |
- name: Build Images | |
run: make docker-build | |
- name: Local Up Openyurt Cluster With Kind | |
run: NODES_NUM=3 DISABLE_DEFAULT_CNI=true make local-up-openyurt | |
- name: Run e2e Tests | |
run: make e2e-tests |