官网挂了,dingding群失效 #3112
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: Sealer-Test-Image | |
on: | |
push: | |
branches: "release*" | |
issue_comment: | |
types: | |
- created | |
workflow_dispatch: { } | |
pull_request_target: | |
types: [ opened, synchronize, reopened ] | |
branches: "*" | |
paths-ignore: | |
- 'docs/**' | |
- '*.md' | |
- '*.yml' | |
- '.github' | |
permissions: | |
statuses: write | |
jobs: | |
build: | |
name: test | |
runs-on: ubuntu-latest | |
if: ${{ (github.event.issue.pull_request && (github.event.comment.body == '/test all' || github.event.comment.body == '/test image')) || github.event_name == 'push' || github.event_name == 'pull_request_target' }} | |
env: | |
GO111MODULE: on | |
steps: | |
- name: Get PR details | |
if: ${{ github.event_name == 'issue_comment' }} | |
uses: xt0rted/pull-request-comment-branch@v1 | |
id: comment-branch | |
- name: Set commit status as pending | |
if: ${{ github.event_name == 'issue_comment' }} | |
uses: myrotvorets/set-commit-status-action@master | |
with: | |
sha: ${{ steps.comment-branch.outputs.head_sha }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: pending | |
- name: Github API Request | |
id: request | |
uses: octokit/request-action@v2.1.7 | |
with: | |
route: ${{ github.event.issue.pull_request.url }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get PR informations | |
id: pr_data | |
run: | | |
echo "repo_name=${{ fromJson(steps.request.outputs.data).head.repo.full_name }}" >> $GITHUB_STATE | |
echo "repo_clone_url=${{ fromJson(steps.request.outputs.data).head.repo.clone_url }}" >> $GITHUB_STATE | |
echo "repo_ssh_url=${{ fromJson(steps.request.outputs.data).head.repo.ssh_url }}" >> $GITHUB_STATE | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.sha }} | |
path: src/github.com/sealerio/sealer | |
- name: Install deps | |
run: | | |
sudo su | |
sudo apt-get update | |
sudo apt-get install -y libgpgme-dev libbtrfs-dev libdevmapper-dev | |
sudo mkdir /var/lib/sealer | |
- name: Set up Go 1.17 | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.17 | |
id: go | |
- name: Install sealer and ginkgo | |
shell: bash | |
run: | | |
docker run --rm -v ${PWD}:/usr/src/sealer -w /usr/src/sealer registry.cn-qingdao.aliyuncs.com/sealer-io/sealer-build:v1 make linux | |
export SEALER_DIR=${PWD}/_output/bin/sealer/linux_amd64 | |
echo "$SEALER_DIR" >> $GITHUB_PATH | |
go install github.com/onsi/ginkgo/ginkgo@v1.16.2 | |
go install github.com/onsi/gomega/...@v1.12.0 | |
GOPATH=`go env GOPATH` | |
echo "$GOPATH/bin" >> $GITHUB_PATH | |
working-directory: src/github.com/sealerio/sealer | |
- name: Run sealer image test and generate coverage | |
shell: bash | |
working-directory: src/github.com/sealerio/sealer | |
env: | |
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} | |
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} | |
REGISTRY_URL: ${{ secrets.REGISTRY_URL }} | |
IMAGE_NAME: ${{ secrets.IMAGE_NAME}} | |
if: ${{ github.event.comment.body == '/test image' || github.event.comment.body == '/test all' || github.event_name == 'push' || github.event_name == 'pull_request_target' }} | |
run: | | |
ginkgo -v -focus="sealer image" -cover -covermode=atomic -coverpkg=./... -coverprofile=/tmp/coverage-image.out -trace test | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: /tmp/coverage-login.out, /tmp/coverage-image.out | |
flags: e2e-tests | |
name: codecov-umbrella | |
- name: Set final commit status | |
uses: myrotvorets/set-commit-status-action@master | |
if: contains(github.event.comment.body, '/test') && always() | |
with: | |
sha: ${{ steps.comment-branch.outputs.head_sha }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: ${{ job.status }} |