Execute github actions workflows only on PRs for now

At the moment, the check-if-duplicate-action needs a bit more tinkering, since
it will skip testing other PRs, if the previous one was successful. Another thing
that might need a revision is to make the duplicate checking job be a bit more subtle
and not be visible where it shouldn't be.
This commit is contained in:
ionutboangiu
2023-07-20 08:31:28 -04:00
committed by Dan Christian Bogos
parent 4fffeeba21
commit c987c3e72e
2 changed files with 60 additions and 62 deletions

View File

@@ -1,37 +1,36 @@
name: Build & Unit Tests
permissions: {} # no need any permissions
permissions: {}
on:
push:
branches: [v0.10]
# push:
# branches: [v0.10]
pull_request:
branches: [v0.10]
jobs:
check-if-duplicate-action:
continue-on-error: true
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'never'
skip_after_successful_duplicate: 'true'
paths_ignore: '["v0.10/docs/**"]'
paths: '["v0.10/**.go", "v0.10/.github"]'
# check-if-duplicate-action:
# continue-on-error: true
# runs-on: ubuntu-latest
# outputs:
# should_skip: ${{ steps.skip_check.outputs.should_skip }}
# steps:
# - id: skip_check
# uses: fkirc/skip-duplicate-actions@v5
# with:
# concurrent_skipping: 'never'
# skip_after_successful_duplicate: 'true'
# paths_ignore: '["v0.10/docs/**"]'
# paths: '["v0.10/**.go", "v0.10/.github"]'
build:
needs: check-if-duplicate-action
if: needs.check-if-duplicate-action.outputs.should_skip != 'true'
# needs: check-if-duplicate-action
# if: needs.check-if-duplicate-action.outputs.should_skip != 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
go: ['stable'] # could be a good idea to consider oldstable as well
go: ["stable"] # could be a good idea to consider oldstable as well
steps:
- name: Check out code
@@ -47,7 +46,7 @@ jobs:
run: gofmt -s -w . && git diff --exit-code
- name: Go Vet
continue-on-error: true # will soon be removed
continue-on-error: true # option will soon be removed
run: go vet ./...
- name: Go Tidy
@@ -66,4 +65,4 @@ jobs:
run: go test -count=1 ./... # should probably also add -race flag in the future
- name: Go Benchmark
run: go test -run=- -bench=. -benchtime=1x ./...
run: go test -run=- -bench=. -benchtime=1x ./...

View File

@@ -1,52 +1,51 @@
name: Integration Tests
on:
push:
branches: [ v0.10 ]
# push:
# branches: [v0.10]
pull_request:
branches: [ v0.10 ]
branches: [v0.10]
jobs:
check-if-duplicate-action:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'never'
skip_after_successful_duplicate: 'true'
paths_ignore: '["v0.10/docs/**"]'
paths: '["v0.10/**.go", "v0.10/*.sh", "v0.10/.github", "v0.10/data/ansible/conf/samples/**", "v0.10/data/tariffplans"]'
# check-if-duplicate-action:
# # continue-on-error: true # Uncomment once integration is finished
# runs-on: ubuntu-latest
# outputs:
# should_skip: ${{ steps.skip_check.outputs.should_skip }}
# steps:
# - id: skip_check
# uses: fkirc/skip-duplicate-actions@v5
# with:
# concurrent_skipping: 'never'
# skip_after_successful_duplicate: 'true'
# paths_ignore: '["v0.10/docs/**"]'
# paths: '["v0.10/**.go", "v0.10/*.sh", "v0.10/.github", "v0.10/data/ansible/conf/samples/**", "v0.10/data/tariffplans"]'
integration-tests:
needs: check-if-duplicate-action
if: needs.check-if-duplicate-action.outputs.should_skip != 'true'
# needs: check-if-duplicate-action
# if: needs.check-if-duplicate-action.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Ansible
run: |
python -m pip install --upgrade pip
pip install ansible
- name: Checkout code
uses: actions/checkout@v3
- name: Run Ansible Playbook
run: |
ansible-playbook data/ansible/integration_tests/main.yaml -i localhost, -c local -e "ansible_user=$(whoami)"
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Run integration tests
run: |
sudo su <<EOF
source /etc/profile
./integration_test.sh
EOF
- name: Install Ansible
run: |
python -m pip install --upgrade pip
pip install ansible
- name: Run Ansible Playbook
run: |
ansible-playbook data/ansible/integration_tests/main.yaml -i localhost, -c local -e "ansible_user=$(whoami)"
- name: Run integration tests
run: |
sudo su <<EOF
source /etc/profile
./integration_test.sh
EOF