Skip to content

Commit 6ab5331

Browse files
committed
[#17] move jobs to code quality workflow
1 parent 8220319 commit 6ab5331

File tree

2 files changed

+64
-63
lines changed

2 files changed

+64
-63
lines changed

.github/workflows/ci.yml

-63
Original file line numberDiff line numberDiff line change
@@ -63,69 +63,6 @@ jobs:
6363
- name: Publish coverage report
6464
uses: codecov/codecov-action@v3
6565

66-
generate-oas-files:
67-
name: Generate and upload OAS files for all versions
68-
needs: tests
69-
runs-on: ubuntu-latest
70-
strategy:
71-
matrix:
72-
version: ['v1', 'v2']
73-
steps:
74-
- uses: actions/checkout@v4
75-
- uses: actions/setup-python@v5
76-
with:
77-
python-version: '3.10'
78-
- uses: actions/setup-node@v4
79-
with:
80-
node-version: '18'
81-
82-
- name: Install system packages
83-
run: |
84-
sudo apt-get update \
85-
&& sudo apt-get install -y --no-install-recommends \
86-
libgdal-dev \
87-
gdal-bin
88-
89-
- name: Install dependencies
90-
run: pip install -r requirements/ci.txt codecov
91-
92-
- name: Generate OAS files
93-
run: ./bin/generate_schema.sh ${{ matrix.version }} openapi-${{ matrix.version }}.yaml
94-
env:
95-
DJANGO_SETTINGS_MODULE: objects.conf.ci
96-
97-
- name: Store generated OAS files
98-
uses: actions/upload-artifact@v4
99-
with:
100-
name: objects-api-${{ matrix.version }}-oas
101-
path: openapi-${{ matrix.version }}.yaml
102-
retention-days: 1
103-
104-
oas-up-to-date:
105-
name: Check for unexepected OAS changes
106-
needs: generate-oas-files
107-
runs-on: ubuntu-latest
108-
strategy:
109-
matrix:
110-
version: ['v1', 'v2']
111-
steps:
112-
- uses: actions/checkout@v4
113-
- name: Download generated OAS
114-
uses: actions/download-artifact@v4
115-
with:
116-
name: objects-api-${{ matrix.version }}-oas
117-
- name: Check for OAS changes
118-
run: |
119-
diff openapi-${{ matrix.version }}.yaml src/objects/api/${{ matrix.version }}/openapi.yaml
120-
- name: Write failure markdown
121-
if: ${{ failure() }}
122-
run: |
123-
echo 'Run the following command locally and commit the changes' >> $GITHUB_STEP_SUMMARY
124-
echo '' >> $GITHUB_STEP_SUMMARY
125-
echo '```bash' >> $GITHUB_STEP_SUMMARY
126-
echo './bin/generate_schema.sh ${{ matrix.version }}' >> $GITHUB_STEP_SUMMARY
127-
echo '```' >> $GITHUB_STEP_SUMMARY
128-
12966
docker:
13067
needs: tests
13168

.github/workflows/code-quality.yml

+64
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,67 @@ jobs:
3333
- name: Run black
3434
run: |
3535
black --check src docs
36+
37+
generate-oas-files:
38+
name: Generate and upload OAS files for all versions
39+
needs: tests
40+
runs-on: ubuntu-latest
41+
strategy:
42+
matrix:
43+
version: ['v1', 'v2']
44+
steps:
45+
- uses: actions/checkout@v4
46+
- uses: actions/setup-python@v5
47+
with:
48+
python-version: '3.10'
49+
- uses: actions/setup-node@v4
50+
with:
51+
node-version: '18'
52+
53+
- name: Install system packages
54+
run: |
55+
sudo apt-get update \
56+
&& sudo apt-get install -y --no-install-recommends \
57+
libgdal-dev \
58+
gdal-bin
59+
60+
- name: Install dependencies
61+
run: pip install -r requirements/ci.txt
62+
63+
- name: Generate OAS files
64+
run: ./bin/generate_schema.sh ${{ matrix.version }} openapi-${{ matrix.version }}.yaml
65+
env:
66+
DJANGO_SETTINGS_MODULE: objects.conf.ci
67+
68+
- name: Store generated OAS files
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: objects-api-${{ matrix.version }}-oas
72+
path: openapi-${{ matrix.version }}.yaml
73+
retention-days: 1
74+
75+
oas-up-to-date:
76+
name: Check for unexepected OAS changes
77+
needs: generate-oas-files
78+
runs-on: ubuntu-latest
79+
strategy:
80+
matrix:
81+
version: ['v1', 'v2']
82+
steps:
83+
- uses: actions/checkout@v4
84+
- name: Download generated OAS
85+
uses: actions/download-artifact@v4
86+
with:
87+
name: objects-api-${{ matrix.version }}-oas
88+
- name: Check for OAS changes
89+
run: |
90+
diff openapi-${{ matrix.version }}.yaml src/objects/api/${{ matrix.version }}/openapi.yaml
91+
- name: Write failure markdown
92+
if: ${{ failure() }}
93+
run: |
94+
echo 'Run the following command locally and commit the changes' >> $GITHUB_STEP_SUMMARY
95+
echo '' >> $GITHUB_STEP_SUMMARY
96+
echo '```bash' >> $GITHUB_STEP_SUMMARY
97+
echo './bin/generate_schema.sh ${{ matrix.version }}' >> $GITHUB_STEP_SUMMARY
98+
echo '```' >> $GITHUB_STEP_SUMMARY
99+

0 commit comments

Comments
 (0)