final test #36
This file contains 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: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
sync-trello-pre-feature-branch: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
pip3 install requests | |
- name: Run Python script | |
run: python3 pipeline/pipeline.py --step pre_feature_branch | |
env: | |
GH_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
GH_COMMIT_HASH: ${{ github.event.head_commit.id }} | |
GH_COMMIT_LINK_URL: ${{ github.event.head_commit.url }} | |
GH_FULL_NAME: ${{ github.event.repository.full_name }} | |
GH_PROJECT_URL: ${{ github.event.repository.html_url }} | |
TRELLO_BOARD_ID: ${{ secrets.TRELLO_BOARD_ID }} | |
TRELLO_API_KEY: ${{ secrets.TRELLO_API_KEY }} | |
TRELLO_API_TOKEN: ${{ secrets.TRELLO_API_TOKEN }} | |
if: ${{ github.event_name }} == "push" | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build Docker image | |
run: | | |
docker build -t ${{ github.event.repository.full_name }}:${{ github.event.head_commit.id }} . | |
# - name: Save Docker image to file | |
# run: | | |
# docker save ${{ github.event.repository.full_name }}:${{ github.event.head_commit.id }} -o docker-image-${{ github.event.head_commit.id }}.tar | |
# - name: Upload Docker image artifact | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: docker-image-${{ github.event.head_commit.id }} | |
# path: docker-image-${{ github.event.head_commit.id }}.tar | |
needs: sync-trello-pre-feature-branch | |
if: ${{ github.event_name }} == "push" | |
unittest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
pip3 install requests | |
- name: Test with pytest | |
run: | | |
pip install pytest pytest-cov | |
pytest --junitxml=results.xml | |
- name: Upload pytest test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-results | |
path: results.xml | |
needs: build | |
if: ${{ github.event_name }} == "push" | |
sync-trello-feature-branch: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
pip3 install requests | |
echo "https://example.com" > environment_url.txt | |
- name: Run Python script | |
run: python3 pipeline/pipeline.py --step intra_feature_branch | |
env: | |
GH_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
GH_COMMIT_HASH: ${{ github.event.head_commit.id }} | |
GH_COMMIT_LINK_URL: ${{ github.event.head_commit.url }} | |
GH_FULL_NAME: ${{ github.event.repository.full_name }} | |
GH_PROJECT_URL: ${{ github.event.repository.html_url }} | |
TRELLO_BOARD_ID: ${{ secrets.TRELLO_BOARD_ID }} | |
TRELLO_API_KEY: ${{ secrets.TRELLO_API_KEY }} | |
TRELLO_API_TOKEN: ${{ secrets.TRELLO_API_TOKEN }} | |
needs: unittest | |
if: ${{ github.event_name }} == "push" |