Skip to content

Commit e01c7cc

Browse files
authored
ci: better ci workflows (#358)
1 parent 47bc807 commit e01c7cc

12 files changed

+84
-99
lines changed

.github/workflows/issue_acknowledged.yml

-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ jobs:
1313
uses: actions-ecosystem/[email protected]
1414
continue-on-error: true
1515
with:
16-
github_token: ${{ secrets.GITHUB_TOKEN }}
1716
labels: "status: needs triage"

.github/workflows/issue_cleanup.yml

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ jobs:
1313
- name: Lock closed issues
1414
uses: dessant/[email protected]
1515
with:
16-
github-token: ${{ secrets.GITHUB_TOKEN }}
1716
issue-lock-inactive-days: 0
1817
issue-lock-comment: >
1918
Locking this issue.

.github/workflows/issue_stale.yml

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ jobs:
1313
- name: Mark non-confirmed stale issues
1414
uses: actions/stale@v4
1515
with:
16-
repo-token: ${{ secrets.GITHUB_TOKEN }}
1716
stale-issue-message: >
1817
This issue has been automatically marked as stale because it has not had
1918
any recent activity. It will be closed if no further activity occurs.

.github/workflows/issue_triage.yml

-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@ jobs:
1414
if: contains(github.event.issue, 'assignee') == false
1515
uses: actions-ecosystem/[email protected]
1616
with:
17-
github_token: ${{ secrets.GITHUB_TOKEN }}
1817
labels: "status: needs triage"

.github/workflows/pages_deploy.yml

+10-13
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,31 @@
22
name: Pages Deploy
33

44
on:
5-
workflow_dispatch:
6-
repository_dispatch:
7-
types:
8-
- switcher-webapi-released
9-
10-
env:
11-
MAIN_PY_VER: 3.9
5+
release:
6+
types: [published]
127

138
jobs:
149
deploy-pages:
15-
if: github.actor == 'TomerFi'
1610
runs-on: ubuntu-latest
11+
environment: github-pages
12+
if: ${{ github.ref != 'refs/tags/early-access' }}
1713
name: Build documentation site and deploy to GH-Pages
1814
steps:
1915
- name: Source checkout
2016
uses: actions/[email protected]
17+
with:
18+
ref: ${{ github.ref }}
2119

22-
- name: Set up Python
20+
- name: Setup Python 3.9
2321
uses: actions/[email protected]
2422
with:
25-
python-version: ${{ env.MAIN_PY_VER }}
23+
python-version: 3.9
2624

2725
- name: Cache pip repository
2826
uses: actions/[email protected]
2927
with:
3028
path: ~/.cache/pip
31-
# yamllint disable-line rule:line-length
32-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt', 'requirements_docs.txt') }}-${{ env.MAIN_PY_VER }}
29+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt', 'requirements_docs.txt') }}
3330

3431
- name: Prepare python environment
3532
run: |
@@ -48,4 +45,4 @@ jobs:
4845
github_token: ${{ secrets.GITHUB_TOKEN }}
4946
publish_dir: ./docsbuild
5047
cname: switcher-webapi.tomfi.info
51-
commit_message: 'docs: deployed documentation site '
48+
commit_message: 'docs: deployed documentation site'

.github/workflows/pr_build.yml

+6-10
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@ on:
66
branches:
77
- dev
88

9-
env:
10-
MAIN_PY_VER: 3.9
11-
129
jobs:
1310
lint-docs:
1411
runs-on: ubuntu-latest
1512
name: Lint documentation files
1613
steps:
17-
- name: Source checkout
14+
- name: Checkout sources
1815
uses: actions/[email protected]
1916

2017
- name: Lint markdown files
@@ -37,20 +34,19 @@ jobs:
3734
needs: [lint-docs]
3835
name: Build project
3936
steps:
40-
- name: Source checkout
37+
- name: Checkout sources
4138
uses: actions/[email protected]
4239

43-
- name: Set up Python
40+
- name: Setup Python 3.9
4441
uses: actions/[email protected]
4542
with:
46-
python-version: ${{ env.MAIN_PY_VER }}
43+
python-version: 3.9
4744

4845
- name: Cache pip repository
4946
uses: actions/[email protected]
5047
with:
5148
path: ~/.cache/pip
52-
# yamllint disable-line rule:line-length
53-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt', 'requirements_test.txt') }}-${{ env.MAIN_PY_VER }}
49+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt', 'requirements_test.txt') }}
5450

5551
- name: Prepare python environment
5652
run: |
@@ -90,7 +86,7 @@ jobs:
9086
needs: [lint-docs]
9187
name: Build docker
9288
steps:
93-
- name: Source checkout
89+
- name: Checkout sources
9490
uses: actions/[email protected]
9591

9692
- name: Lint Dockerfile

.github/workflows/pr_cleanup.yml

-4
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,18 @@ jobs:
1616
uses: actions-ecosystem/[email protected]
1717
continue-on-error: true
1818
with:
19-
github_token: ${{ secrets.GITHUB_TOKEN }}
2019
labels: "status: needs triage"
2120

2221
- name: Remove review label
2322
uses: actions-ecosystem/[email protected]
2423
continue-on-error: true
2524
with:
26-
github_token: ${{ secrets.GITHUB_TOKEN }}
2725
labels: "status: needs review"
2826

2927
- name: Add merged label if merged
3028
if: github.event.pull_request.merged == true
3129
uses: actions-ecosystem/[email protected]
3230
with:
33-
github_token: ${{ secrets.GITHUB_TOKEN }}
3431
labels: "status: merged"
3532

3633
handle-pr:
@@ -40,6 +37,5 @@ jobs:
4037
- name: Lock pull request
4138
uses: dessant/[email protected]
4239
with:
43-
github-token: ${{ secrets.GITHUB_TOKEN }}
4440
pr-lock-comment: "Locking this pull request."
4541
process-only: prs

.github/workflows/pr_content.yml

-2
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,11 @@ jobs:
4646
- name: Remove stale size labels
4747
uses: actions-ecosystem/[email protected]
4848
with:
49-
github_token: ${{ secrets.GITHUB_TOKEN }}
5049
labels: ${{ steps.pr_size.outputs.stale_labels }}
5150

5251
- name: Add size label
5352
uses: actions-ecosystem/[email protected]
5453
with:
55-
github_token: ${{ secrets.GITHUB_TOKEN }}
5654
labels: ${{ steps.pr_size.outputs.new_label }}
5755

5856
- name: Label if contains large files # builtin label: "lfs-detected!"

.github/workflows/pr_review.yml

-8
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: Pull request review
33

44
on:
55
pull_request_review:
6-
branches:
7-
- dev
86
types: [submitted, edited]
97

108
jobs:
@@ -16,14 +14,12 @@ jobs:
1614
uses: actions-ecosystem/[email protected]
1715
continue-on-error: true
1816
with:
19-
github_token: ${{ secrets.GITHUB_TOKEN }}
2017
labels: "status: needs triage"
2118

2219
- name: Remove review label
2320
uses: actions-ecosystem/[email protected]
2421
continue-on-error: true
2522
with:
26-
github_token: ${{ secrets.GITHUB_TOKEN }}
2723
labels: "status: needs review"
2824

2925
handle-approved:
@@ -35,13 +31,11 @@ jobs:
3531
uses: actions-ecosystem/[email protected]
3632
continue-on-error: true
3733
with:
38-
github_token: ${{ secrets.GITHUB_TOKEN }}
3934
labels: "status: changes requested"
4035

4136
- name: Add approved label
4237
uses: actions-ecosystem/[email protected]
4338
with:
44-
github_token: ${{ secrets.GITHUB_TOKEN }}
4539
labels: "status: approved"
4640

4741
handle-change-requested:
@@ -53,11 +47,9 @@ jobs:
5347
uses: actions-ecosystem/[email protected]
5448
continue-on-error: true
5549
with:
56-
github_token: ${{ secrets.GITHUB_TOKEN }}
5750
labels: "status: approved"
5851

5952
- name: Add changes requested label
6053
uses: actions-ecosystem/[email protected]
6154
with:
62-
github_token: ${{ secrets.GITHUB_TOKEN }}
6355
labels: "status: changes requested"

.github/workflows/pr_triage.yml

-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
- name: Add review label
2222
uses: actions-ecosystem/[email protected]
2323
with:
24-
github_token: ${{ secrets.GITHUB_TOKEN }}
2524
labels: "status: needs review"
2625

2726
triage-by-dependabot:
@@ -37,5 +36,4 @@ jobs:
3736
- name: Add approved label
3837
uses: actions-ecosystem/[email protected]
3938
with:
40-
github_token: ${{ secrets.GITHUB_TOKEN }}
4139
labels: "status: approved"

.github/workflows/pre_release.yml

+7-20
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,30 @@ on:
77
branches:
88
- dev
99

10-
env:
11-
MAIN_PY_VER: 3.9
12-
PLATFORMS: linux/amd64,linux/arm/v7
13-
1410
jobs:
1511
pre-release:
1612
runs-on: ubuntu-latest
13+
environment: staging
1714
name: Build pre-release and publish early access to GitHub
1815
steps:
19-
- name: Source checkout
16+
- name: Checkout sources
2017
uses: actions/[email protected]
2118

2219
- name: Lint Dockerfile
2320
uses: luke142367/[email protected]
2421
env:
2522
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2623

27-
- name: Set up Python
24+
- name: Setup Python 3.9
2825
uses: actions/[email protected]
2926
with:
30-
python-version: ${{ env.MAIN_PY_VER }}
27+
python-version: 3.9
3128

3229
- name: Cache pip repository
3330
uses: actions/[email protected]
3431
with:
3532
path: ~/.cache/pip
36-
# yamllint disable-line rule:line-length
37-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt', 'requirements_test.txt') }}-${{ env.MAIN_PY_VER }}
33+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt', 'requirements_test.txt') }}
3834

3935
- name: Prepare python environment
4036
run: |
@@ -49,7 +45,6 @@ jobs:
4945
with:
5046
path: /tmp/.buildx-cache
5147
key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }}
52-
restore-keys: ${{ runner.os }}-buildx-
5348

5449
- name: Set up QEMU
5550
uses: docker/[email protected]
@@ -73,7 +68,7 @@ jobs:
7368
with:
7469
context: .
7570
push: true
76-
platforms: ${{ env.PLATFORMS }}
71+
platforms: linux/amd64,linux/arm/v7
7772
tags: ghcr.io/tomerfi/switcher_webapi:early-access
7873
build-args: |
7974
VCS_REF=${{ github.sha }}
@@ -84,15 +79,7 @@ jobs:
8479
ghcr.io/tomerfi/switcher_webapi:early-access
8580
cache-to: type=local,dest=/tmp/.buildx-cache
8681

87-
- name: Create release
88-
uses: marvinpinto/[email protected]
89-
with:
90-
repo_token: ${{ secrets.GITHUB_TOKEN }}
91-
automatic_release_tag: early-access
92-
prerelease: true
93-
title: early-access
94-
95-
- name: Push to CodeCov
82+
- name: Push coverage report to CodeCov
9683
uses: codecov/[email protected]
9784
with:
9885
files: coverage.xml

0 commit comments

Comments
 (0)