持續整合
Github action
- awesome-actions
- marketplace
- Viewing your GitHub Actions usage
- Environment variables
- GitHub-hosted runners
- How to run GitHub Actions workflow only if the pushed files are in a specific folder
- python
- Deploying Self-Hosted GitHub Actions Runners with Docker
- Running Github Actions On Local Machine
- Containerised Lambdas, Terraform & GitHub Actions
- 好文分享 — How to run pytest in parallel on GitHub actions - MyApollo
- [GitHub] 使用 GitHub CLI (gh) 觸發還在 PR 中的 GitHub Actions workflow 測試 | EPH 的程式日記
make is ok tests/auto_test.sh: line 7: virtualenv: command not found
``` = name: Github Actions CI
on: push: branches: [ develop, feature/, hotfix/ ]
jobs: build: runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Build RDS/Reddis/ElasticSearch by docker-compose
run: |
cd test_tools/docker-compose
docker-compose up -d
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r portal/djangoprojects/mysite/requirements.txt
pip install -r portal/djangoprojects/mysite/unit_test_requirements.txt
- name: Run Tests
run: |
cd portal/djangoprojects/mysite/
python manage.py test --exclude-tag=aws
```
Execute job in a workflow only if some file in a subfolder is changed
yaml=
jobs:
# JOB to run change detection
changes:
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
backend:
- 'backend/**'
frontend:
- 'frontend/**'
# JOB to build and test backend code
backend:
needs: changes
if: ${{ needs.changes.outputs.backend == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- ...
# JOB to build and test frontend code
frontend:
needs: changes
if: ${{ needs.changes.outputs.frontend == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- ...
mysql
- Docker MySQL Github Actions Connection Refused
- Can't connect Node.js with Docker MySQL database in GitHub actions
Configuring OpenID Connect in Amazon Web Services
- Configuring OpenID Connect in Amazon Web Services
- Configure AWS Credentials" Action For GitHub Actions
- AWS Policy - StringLike for multiple
Edit the trust relationship in IAM Role setting to add the sub field to the validation conditions
"Condition": {"StringLike": {"token.actions.githubusercontent.com:sub": "repo:github_account/repo_name:*"}}
for any repo in your GitHub account
scoped to a specific branch
multiple repos
"Condition": {"StringLike": {"token.actions.githubusercontent.com:sub": [
"repo:github_account_1/repo_name:*",
"repo:github_account_2/repo_name:*",
"repo:github_account_3/repo_name:*"
]}}
total example
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::999999999999:oidc-provider/token.actions.githubusercontent.com"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"token.actions.githubusercontent.com:aud": "sts.amazonaws.com"
},
"StringLike": {
"token.actions.githubusercontent.com:sub": [
"repo:Tom/*:*",
"repo:Jimmy/*:*",
"repo:Mary/*:*"
]
}
}
}
]
}