Skip to content

gen: update then template to match new action #461

gen: update then template to match new action

gen: update then template to match new action #461

Workflow file for this run

name: Go Continuous Integration
on:
push:
branches:
- master
pull_request:
jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Run Go linters
uses: golangci/golangci-lint-action@v3
with:
args: --verbose
skip-pkg-cache: true
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Run tests
run: go test -race ./...
integration-test:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.USER_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: install GitHub cli
run: |
sudo apt update
sudo apt install gh -y
- name: validate pull request is not created yet
run: |
PULL_REQUESTS=$(gh pr list -R ${{ secrets.TEST_REPO }} --search "'add atlas ci workflow' in:title" --json headRefName | jq length)
if [ $PULL_REQUESTS -ne 0 ]; then
echo "Pull request already created"
exit 1
fi
- name: build extension
run: |
go build
- name: install extension
run: |
gh extension install .
- name: run GitHub atlas extension
run: |
gh atlas init-action -R ${{ secrets.TEST_REPO }} --token=${{ secrets.TEST_ATLAS_TOKEN }} --dir-name="test-sqlite" --driver="sqlite" "sqlite_dir"
- name: validate pull request is created
uses: nick-fields/retry@v2
with:
timeout_seconds: 20
retry_wait_seconds: 5
max_attempts: 4
command: PULL_REQUESTS=$(gh pr list -R ${{ secrets.TEST_REPO }} --search "'add atlas ci workflow' in:title" --json headRefName | jq length) && [ $PULL_REQUESTS -eq 1 ]
- name: cleanup the created pr, branch and secret
if: always()
run: |
BRANCH=$(gh pr list -R ${{ secrets.TEST_REPO }} --search "'add atlas ci workflow' in:title" --json headRefName | jq -r '.[0].headRefName')
gh pr close -R ${{ secrets.TEST_REPO }} $BRANCH -d
BRANCH_SUFFIX=${BRANCH: -6}
SECRET_NAME="ATLAS_CLOUD_TOKEN_$BRANCH_SUFFIX"
gh secret delete -R ${{ secrets.TEST_REPO }} $SECRET_NAME