mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-07-28 21:38:25 +00:00
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io> Signed-off-by: Rui Chen <rui@chenrui.dev> Co-authored-by: RB <7775707+nitrocode@users.noreply.github.com> Co-authored-by: Rui Chen <rui@chenrui.dev>
210 lines
7.0 KiB
YAML
210 lines
7.0 KiB
YAML
name: tester
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "main"
|
|
- "release-**"
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- synchronize
|
|
- ready_for_review
|
|
branches:
|
|
- "main"
|
|
- "release-**"
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
changes:
|
|
permissions:
|
|
contents: read # for dorny/paths-filter to fetch a list of changed files
|
|
pull-requests: read # for dorny/paths-filter to read pull requests
|
|
outputs:
|
|
should-run-tests: ${{ steps.changes.outputs.go == 'true' }}
|
|
if: github.event.pull_request.draft == false
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
|
|
id: changes
|
|
with:
|
|
filters: |
|
|
go:
|
|
- '**.go'
|
|
- '**.txt' # golden file test output
|
|
- 'go.*'
|
|
- '**.tmpl'
|
|
- '.github/workflows/test.yml'
|
|
test:
|
|
needs: [changes]
|
|
if: needs.changes.outputs.should-run-tests == 'true'
|
|
name: Tests
|
|
runs-on: ubuntu-24.04
|
|
container: ghcr.io/runatlantis/testing-env:latest@sha256:3d7b17d02ced2cb68ecc9d2ea3d2bef61fe8da52cf1631e4dff4de6503cb7237
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
|
|
# need to setup go toolchain explicitly
|
|
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- run: make test-all
|
|
- run: make check-fmt
|
|
|
|
###########################################################
|
|
# Notifying #contributors about test failure on main branch
|
|
###########################################################
|
|
- name: Slack failure notification
|
|
if: ${{ github.ref == 'refs/heads/main' && failure() }}
|
|
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
|
|
with:
|
|
payload: |
|
|
{
|
|
"blocks": [
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": ":x: Failed GitHub Action:"
|
|
}
|
|
},
|
|
{
|
|
"type": "section",
|
|
"fields": [
|
|
{
|
|
"type": "mrkdwn",
|
|
"text": "*Workflow:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>"
|
|
},
|
|
{
|
|
"type": "mrkdwn",
|
|
"text": "*Job:*\n${{ github.job }}"
|
|
},
|
|
{
|
|
"type": "mrkdwn",
|
|
"text": "*Repo:*\n${{ github.repository }}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
env:
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
|
|
|
|
skip-test:
|
|
needs: [changes]
|
|
if: needs.changes.outputs.should-run-tests == 'false'
|
|
name: Tests
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- run: 'echo "No build required"'
|
|
|
|
e2e-github:
|
|
runs-on: ubuntu-latest
|
|
# dont run e2e tests on forked PRs
|
|
if: github.event.pull_request.head.repo.fork == false
|
|
env:
|
|
TERRAFORM_VERSION: 1.9.2
|
|
ATLANTIS_GH_USER: ${{ secrets.ATLANTISBOT_GITHUB_USERNAME }}
|
|
ATLANTIS_GH_TOKEN: ${{ secrets.ATLANTISBOT_GITHUB_TOKEN }}
|
|
NGROK_AUTH_TOKEN: ${{ secrets.ATLANTISBOT_NGROK_AUTH_TOKEN }}
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
# This version of TF will be downloaded before Atlantis is started.
|
|
# We do this instead of setting --default-tf-version because setting
|
|
# that flag starts the download asynchronously so we'd have a race
|
|
# condition.
|
|
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3
|
|
with:
|
|
terraform_version: ${{ env.TERRAFORM_VERSION }}
|
|
|
|
- name: Setup ngrok
|
|
run: |
|
|
wget -q -O ngrok.tar.gz https://bin.equinox.io/a/4no1PS1PoRF/ngrok-v3-3.13.0-linux-amd64.tar.gz
|
|
tar -xzf ngrok.tar.gz
|
|
chmod +x ngrok
|
|
./ngrok version
|
|
- name: Setup gitconfig
|
|
run: |
|
|
git config --global user.email "maintainers@runatlantis.io"
|
|
git config --global user.name "atlantisbot"
|
|
|
|
- run: |
|
|
make build-service
|
|
./scripts/e2e.sh
|
|
e2e-gitlab:
|
|
runs-on: ubuntu-latest
|
|
# dont run e2e tests on forked PRs
|
|
if: github.event.pull_request.head.repo.fork == false
|
|
env:
|
|
TERRAFORM_VERSION: 1.9.2
|
|
ATLANTIS_GITLAB_USER: ${{ secrets.ATLANTISBOT_GITLAB_USERNAME }}
|
|
ATLANTIS_GITLAB_TOKEN: ${{ secrets.ATLANTISBOT_GITLAB_TOKEN }}
|
|
NGROK_AUTH_TOKEN: ${{ secrets.ATLANTISBOT_NGROK_AUTH_TOKEN }}
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
# This version of TF will be downloaded before Atlantis is started.
|
|
# We do this instead of setting --default-tf-version because setting
|
|
# that flag starts the download asynchronously so we'd have a race
|
|
# condition.
|
|
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3
|
|
with:
|
|
terraform_version: ${{ env.TERRAFORM_VERSION }}
|
|
|
|
- name: Setup ngrok
|
|
run: |
|
|
wget -q -O ngrok.tar.gz https://bin.equinox.io/a/4no1PS1PoRF/ngrok-v3-3.13.0-linux-amd64.tar.gz
|
|
tar -xzf ngrok.tar.gz
|
|
chmod +x ngrok
|
|
./ngrok version
|
|
- name: Setup gitconfig
|
|
run: |
|
|
git config --global user.email "maintainers@runatlantis.io"
|
|
git config --global user.name "atlantisbot"
|
|
|
|
- run: |
|
|
make build-service
|
|
./scripts/e2e.sh
|