Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH Actions: various tweaks #217

Merged
merged 8 commits into from
Dec 28, 2021
68 changes: 46 additions & 22 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,29 @@

name: "build"

on: ["pull_request", "push"]
on: ["pull_request", "push", "workflow_dispatch"]

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
code-coverage:
name: "Code coverage"
composer:
name: "Check Composer"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout repository"
uses: "actions/checkout@v2"
- name: "Install expect"
run: |
sudo apt-get update
sudo apt-get -y install expect
- name: "Set up Ruby"
uses: "actions/setup-ruby@v1"
with:
ruby-version: "2.7"
- name: "Install Ruby dependencies"
run: |
gem install bashcov
gem install codecov
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "latest"
tools: "composer:v2"
coverage: "none"
- name: "Run expect tests"
run: "bashcov --root ./bin -- ./tests/bash-test.sh tests/tests.sh"
- name: "Publish coverage report to Codecov"
uses: "codecov/codecov-action@v1"
php-version: 7.4
tools: composer-normalize
coverage: none
- name: "Run Composer normalize"
run: "composer-normalize --dry-run"

test:
name: "Expect tests"
Expand All @@ -58,7 +50,39 @@ jobs:
- name: "Run expect tests"
run: "composer test"

code-coverage:
needs: test
if: github.repository == 'ramsey/composer-install'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I didn't know you could do this to limit certain jobs to a specific repository.

name: "Code coverage"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout repository"
uses: "actions/checkout@v2"
- name: "Install expect"
run: |
sudo apt-get update
sudo apt-get -y install expect
- name: "Set up Ruby"
uses: "ruby/setup-ruby@v1"
with:
ruby-version: "2.7"
- name: "Install Ruby dependencies"
run: |
gem install bashcov
gem install codecov
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "latest"
tools: "composer:v2"
coverage: "none"
- name: "Run expect tests"
run: "bashcov --root ./bin -- ./tests/bash-test.sh tests/tests.sh"
- name: "Publish coverage report to Codecov"
uses: "codecov/codecov-action@v2"

run:
needs: test
name: "Run action"
runs-on: "${{ matrix.operating-system }}"
strategy:
Expand Down