GitHub Actionsに使うテンプレート一式
Last active
July 11, 2020 06:08
-
-
Save tadashi-aikawa/2bfc154d0d64f4e8b321ff96676dc6a1 to your computer and use it in GitHub Desktop.
GitHub Actions
This file contains hidden or 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: Test report | |
if: matrix.python == 3.7 && success() | |
env: | |
CC_TEST_REPORTER_ID: <your_reporter_id> | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
./cc-test-reporter after-build |
This file contains hidden or 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
- uses: codecov/codecov-action@v1 | |
if: matrix.python == 3.8 && success() | |
with: | |
fail_ci_if_error: true |
This file contains hidden or 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: 'Tests' | |
on: | |
push: | |
paths: | |
- '.github/**/*' | |
- 'src/*' | |
- 'src/**/*' | |
- '*.js' | |
- '*.json' | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: ['10.x', '12.x'] | |
name: Node ${{ matrix.node }} | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node }} | |
- run: npm install | |
- run: npm run build | |
- run: npm test | |
- name: 'Slack notification (not success)' | |
uses: homoluctus/slatify@master | |
if: '! success()' | |
with: | |
type: ${{ job.status }} | |
username: GitHub Actions (Failure) | |
job_name: ':nodejs:*${{ matrix.node }}* Tests' | |
mention: channel | |
mention_if: always | |
icon_emoji: 'tio2' | |
url: ${{ secrets.SLACK_WEBHOOK }} | |
notify: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Slack Notification (success)' | |
uses: homoluctus/slatify@master | |
if: always() | |
with: | |
type: ${{ job.status }} | |
username: GitHub Actions (Success) | |
job_name: ':nodejs: All tests' | |
icon_emoji: ':renne:' | |
url: ${{ secrets.SLACK_WEBHOOK }} |
This file contains hidden or 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: "Tests" | |
on: | |
push: | |
paths: | |
- ".github/**/*" | |
- "<yourapp>/*" | |
- "<yourapp>/**/*" | |
- "tests/*" | |
- "tests/**/*" | |
- "Pipfile.lock" | |
- "test.bats" | |
- "Makefile" | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: ["3.6", "3.7", "3.8"] | |
name: Python ${{ matrix.python }} | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip pipenv | |
sed -ri 's/python_version = ".+"/python_version = "${{ matrix.python }}"/g' Pipfile | |
pipenv install --dev --skip-lock | |
- run: make test | |
- name: Test report | |
if: matrix.python == 3.7 && success() | |
env: | |
CC_TEST_REPORTER_ID: <your_test_report_id> | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
./cc-test-reporter after-build | |
- name: CLI tests | |
run: | | |
sudo npm install -g bats | |
make test-cli | |
- name: "Slack notification (not success)" | |
uses: homoluctus/slatify@master | |
if: "! success()" | |
with: | |
type: ${{ job.status }} | |
username: GitHub Actions (Failure) | |
job_name: ":python:*${{ matrix.python }}* Tests" | |
mention: channel | |
mention_if: always | |
icon_emoji: "tio2" | |
url: ${{ secrets.SLACK_WEBHOOK }} | |
notify: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Slack Notification (success)" | |
uses: homoluctus/slatify@master | |
if: always() | |
with: | |
type: ${{ job.status }} | |
username: GitHub Actions (Success) | |
job_name: ":python: All tests" | |
icon_emoji: ":renne:" | |
url: ${{ secrets.SLACK_WEBHOOK }} |
This file contains hidden or 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: Install dependencies | |
run: | | |
python -m pip install --upgrade pip pipenv | |
sed -ri 's/python_version = ".+"/python_version = "${{ matrix.python }}"/g' Pipfile | |
pipenv install --dev --skip-lock |
This file contains hidden or 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: "Tests" | |
on: | |
push: | |
paths: | |
- '.github/**/*' | |
- '<yourapp>/*' | |
- '<yourapp>/**/*' | |
- 'tests/*' | |
- 'tests/**/*' | |
- 'poetry.lock' | |
- 'Makefile' | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: ["3.6", "3.7", "3.8"] | |
name: Python ${{ matrix.python }} | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip poetry | |
poetry install | |
- name: CLI tests | |
run: | | |
sudo npm install -g bats | |
sudo chmod +rx $HOME/.config -R | |
make test-cli | |
- name: "Slack notification (not success)" | |
uses: homoluctus/slatify@master | |
if: "! success()" | |
with: | |
type: ${{ job.status }} | |
username: GitHub Actions (Failure) | |
job_name: ":python:*${{ matrix.python }}* Tests" | |
mention: channel | |
mention_if: always | |
icon_emoji: "tio2" | |
url: ${{ secrets.SLACK_WEBHOOK }} | |
notify: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Slack Notification (success)" | |
uses: homoluctus/slatify@master | |
if: always() | |
with: | |
type: ${{ job.status }} | |
username: GitHub Actions (Success) | |
job_name: ":python: All tests" | |
icon_emoji: ":renne:" | |
url: ${{ secrets.SLACK_WEBHOOK }} |
This file contains hidden or 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: Install dependencies | |
run: | | |
python -m pip install --upgrade pip poetry | |
poetry install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment