Skip to content

Commit 6ee37d1

Browse files
authored
Merge pull request #12 from CIAT-DAPA/develop
Develop
2 parents 93c22ab + 440c26a commit 6ee37d1

File tree

1 file changed

+86
-91
lines changed

1 file changed

+86
-91
lines changed

.github/workflows/test_pipeline.yml

Lines changed: 86 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,39 @@ name: Devops SPCAT_ORM
55

66
on:
77
push:
8-
branches: [ "stage" ]
8+
branches: ["stage"]
99
tags:
10-
- 'v*'
11-
10+
- "v*"
1211

1312
permissions:
1413
contents: read
1514

1615
jobs:
17-
18-
# ------- START ORM PROCCESS -------- #
16+
# ------- START ORM PROCCESS -------- #
1917

2018
TestORM:
21-
2219
runs-on: ubuntu-latest
2320

2421
steps:
25-
- uses: actions/checkout@v3
26-
- name: Set up Python 3.9
27-
uses: actions/setup-python@v3
28-
with:
29-
python-version: "3.9"
30-
- name: Create environment
31-
run: |
32-
python -m venv env
33-
- name: Active environment
34-
run: |
35-
source env/bin/activate
36-
- name: Install dependencies
37-
run: |
38-
pip install -r ./requirements.txt
39-
- name: Run Tests
40-
run: |
41-
python -m unittest discover -s ./src/tests/ -p 'test_*.py'
42-
# ------- END ORM PROCCESS -------- #
43-
44-
# ------- START MERGE PROCCESS -------- #
22+
- uses: actions/checkout@v3
23+
- name: Set up Python 3.9
24+
uses: actions/setup-python@v3
25+
with:
26+
python-version: "3.9"
27+
- name: Create environment
28+
run: |
29+
python -m venv env
30+
- name: Active environment
31+
run: |
32+
source env/bin/activate
33+
- name: Install dependencies
34+
run: |
35+
pip install -r ./requirements.txt
36+
- name: Run Tests
37+
run: |
38+
python -m unittest discover -s ./src/tests/ -p 'test_*.py'
39+
# ------- END ORM PROCCESS -------- #
40+
# ------- START MERGE PROCCESS -------- #
4541

4642
MergeMainORM:
4743
needs: [TestORM]
@@ -59,76 +55,75 @@ jobs:
5955
target_branch: main
6056
github_token: ${{ github.token }}
6157

62-
# ------- END MERGE PROCCESS -------- #
58+
# ------- END MERGE PROCCESS -------- #
6359

64-
# ------- START RELEASE PROCCESS -------- #
60+
# ------- START RELEASE PROCCESS -------- #
6561

6662
PostRelease:
6763
needs: MergeMainORM
6864
name: Create Release
6965
runs-on: ubuntu-latest
7066
permissions: write-all
7167
steps:
72-
- uses: actions/checkout@v3
73-
with:
74-
fetch-depth: '0'
75-
# API Zip
76-
- name: Zip artifact for deployment
77-
run: zip releaseORM.zip ./src/* -r
78-
# Upload Artifacts
79-
- name: Upload ORM artifact for deployment job
80-
uses: actions/upload-artifact@v3
81-
with:
82-
name: ORM
83-
path: releaseORM.zip
84-
# Generate Tagname
85-
- name: Generate Tagname for release
86-
id: taggerDryRun
87-
uses: anothrNick/github-tag-action@1.61.0
88-
env:
89-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90-
WITH_V: true
91-
DRY_RUN: true
92-
DEFAULT_BUMP: patch
93-
RELEASE_BRANCHES : stage,main
94-
BRANCH_HISTORY: last
95-
# Create release
96-
- name: Create Release
97-
id: create_release
98-
uses: actions/create-release@v1
99-
env:
100-
GITHUB_TOKEN: ${{ github.token }}
101-
with:
102-
tag_name: ${{ steps.taggerDryRun.outputs.new_tag }}
103-
release_name: Release ${{ steps.taggerDryRun.outputs.new_tag }}
104-
#body_path: ./body.md
105-
body: ${{ github.event.head_commit.message }}
106-
draft: false
107-
prerelease: false
108-
# Upload Assets to release
109-
- name: Upload Release Asset ORM
110-
id: upload-orm-release-asset
111-
uses: actions/upload-release-asset@v1
112-
env:
113-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114-
with:
115-
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
116-
asset_path: ./releaseORM.zip
117-
asset_name: releaseORM.zip
118-
asset_content_type: application/zip
119-
# update version setup.py
120-
- name: Checkout code
121-
uses: actions/checkout@v3
122-
with:
123-
ref: main
124-
- name: Update version
125-
run: |
126-
sed -i "s/version='.*'/version='${{ steps.taggerDryRun.outputs.new_tag }}'/" setup.py
127-
env:
128-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
129-
- name: Commit changes
130-
uses: stefanzweifel/git-auto-commit-action@v4
131-
with:
132-
commit_message: "Update version to ${{ steps.taggerDryRun.outputs.new_tag }}"
133-
134-
# ------- END RELEASE PROCCESS -------- #
68+
- uses: actions/checkout@v3
69+
with:
70+
fetch-depth: "0"
71+
# API Zip
72+
- name: Zip artifact for deployment
73+
run: zip releaseORM.zip ./src/* -r
74+
# Upload Artifacts
75+
- name: Upload ORM artifact for deployment job
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: ORM
79+
path: releaseORM.zip
80+
# Generate Tagname
81+
- name: Generate Tagname for release
82+
id: taggerDryRun
83+
uses: anothrNick/github-tag-action@1.61.0
84+
env:
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
WITH_V: true
87+
DRY_RUN: true
88+
DEFAULT_BUMP: patch
89+
RELEASE_BRANCHES: stage,main
90+
BRANCH_HISTORY: last
91+
# Create release
92+
- name: Create Release
93+
id: create_release
94+
uses: actions/create-release@v1
95+
env:
96+
GITHUB_TOKEN: ${{ github.token }}
97+
with:
98+
tag_name: ${{ steps.taggerDryRun.outputs.new_tag }}
99+
release_name: Release ${{ steps.taggerDryRun.outputs.new_tag }}
100+
#body_path: ./body.md
101+
body: ${{ github.event.head_commit.message }}
102+
draft: false
103+
prerelease: false
104+
# Upload Assets to release
105+
- name: Upload Release Asset ORM
106+
id: upload-orm-release-asset
107+
uses: softprops/action-gh-release@v2
108+
env:
109+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110+
with:
111+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
112+
asset_path: ./releaseORM.zip
113+
asset_name: releaseORM.zip
114+
asset_content_type: application/zip
115+
# update version setup.py
116+
- name: Checkout code
117+
uses: actions/checkout@v3
118+
with:
119+
ref: main
120+
- name: Update version
121+
run: |
122+
sed -i "s/version='.*'/version='${{ steps.taggerDryRun.outputs.new_tag }}'/" setup.py
123+
env:
124+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
- name: Commit changes
126+
uses: stefanzweifel/git-auto-commit-action@v4
127+
with:
128+
commit_message: "Update version to ${{ steps.taggerDryRun.outputs.new_tag }}"
129+
# ------- END RELEASE PROCCESS -------- #

0 commit comments

Comments
 (0)