Skip to content

Commit bb60f78

Browse files
Multiple workflow changes (#705)
1 parent 8069471 commit bb60f78

File tree

9 files changed

+138
-129
lines changed

9 files changed

+138
-129
lines changed
Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,51 @@
1-
name: Unit Tests
1+
name: Continuous Integration
22
on:
33
workflow_dispatch: null
44
push:
55
pull_request:
66
jobs:
7+
docker-build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Build the Docker image
12+
run: docker build . --file Dockerfile --tag linode/cli:$(date +%s) --build-arg="github_token=$GITHUB_TOKEN"
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
16+
lint:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: checkout repo
20+
uses: actions/checkout@v4
21+
22+
- name: setup python 3
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.x'
26+
27+
- name: install dependencies
28+
run: make install
29+
30+
- name: run linter
31+
run: make lint
32+
733
unit-tests-on-ubuntu:
834
runs-on: ubuntu-latest
935
strategy:
1036
matrix:
11-
python-version: [ '3.9','3.10','3.11', '3.12' ]
37+
python-version: [ "3.9","3.10","3.11", "3.12", "3.13" ]
1238
steps:
1339
- name: Clone Repository
1440
uses: actions/checkout@v4
1541

16-
- name: Update system packages
17-
run: sudo apt-get update -y
18-
1942
- name: Setup Python
2043
uses: actions/setup-python@v5
2144
with:
2245
python-version: ${{ matrix.python-version }}
2346

24-
- name: Install Python wheel
25-
run: pip install wheel boto3
26-
27-
- name: Update cert
28-
run: pip install certifi -U
29-
30-
- name: Install deps
31-
run: pip install .[dev]
47+
- name: Install Python dependencies
48+
run: pip install -U certifi
3249

3350
- name: Install Package
3451
run: make install
@@ -47,16 +64,10 @@ jobs:
4764
- name: Setup Python
4865
uses: actions/setup-python@v5
4966
with:
50-
python-version: '3.x'
51-
52-
- name: Install Python wheel
53-
run: pip install wheel boto3
54-
55-
- name: Update cert
56-
run: pip install certifi -U
67+
python-version: "3.x"
5768

58-
- name: Install deps
59-
run: pip install .[dev]
69+
- name: Install Python dependencies
70+
run: pip install -U certifi
6071

6172
- name: Install Package
6273
shell: pwsh

.github/workflows/codeql.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: "CodeQL Advanced"
2+
3+
on:
4+
push:
5+
branches: [ "dev", "main" ]
6+
pull_request:
7+
branches: [ "dev", "main" ]
8+
schedule:
9+
- cron: "0 13 * * 5"
10+
11+
jobs:
12+
analyze:
13+
name: Analyze (${{ matrix.language }})
14+
runs-on: ubuntu-latest
15+
permissions:
16+
security-events: write
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- language: python
23+
build-mode: none
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Initialize CodeQL
29+
uses: github/codeql-action/init@v3
30+
with:
31+
languages: ${{ matrix.language }}
32+
build-mode: ${{ matrix.build-mode }}
33+
34+
- name: Perform CodeQL Analysis
35+
uses: github/codeql-action/analyze@v3
36+
with:
37+
category: "/language:${{matrix.language}}"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: 'Dependency review'
2+
on:
3+
pull_request:
4+
branches: [ "dev", "main", "proj/*" ]
5+
6+
permissions:
7+
contents: read
8+
pull-requests: write
9+
10+
jobs:
11+
dependency-review:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: 'Checkout repository'
15+
uses: actions/checkout@v4
16+
- name: 'Dependency Review'
17+
uses: actions/dependency-review-action@v4
18+
with:
19+
comment-summary-in-pr: on-failure

.github/workflows/docker-build.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/publish-pypi.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/pull-request.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/release-notify-slack.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
1-
name: OCI Image Publish
1+
name: Release
22
on:
33
workflow_dispatch: null
44
release:
55
types: [ published ]
66
jobs:
7+
notify:
8+
needs: pypi-release
9+
if: github.repository == 'linode/linode-cli'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Notify Slack - Main Message
13+
id: main_message
14+
uses: slackapi/[email protected]
15+
with:
16+
method: chat.postMessage
17+
token: ${{ secrets.SLACK_BOT_TOKEN }}
18+
payload: |
19+
channel: ${{ secrets.CLI_SLACK_CHANNEL_ID }}
20+
blocks:
21+
- type: section
22+
text:
23+
type: mrkdwn
24+
text: "*New Release Published: _linode-cli_ <${{ github.event.release.html_url }}|${{ github.event.release.tag_name }}> is now live!* :tada:"
25+
726
oci_publish:
827
name: Build and publish the OCI image
928
runs-on: ubuntu-latest
@@ -58,3 +77,31 @@ jobs:
5877
build-args: |
5978
linode_cli_version=${{ steps.cli_version.outputs.result }}
6079
github_token=${{ secrets.GITHUB_TOKEN }}
80+
81+
pypi-release:
82+
runs-on: ubuntu-latest
83+
steps:
84+
- name: Checkout
85+
uses: actions/checkout@v4
86+
87+
- name: Setup Python
88+
uses: actions/setup-python@v5
89+
with:
90+
python-version: '3.x'
91+
92+
- name: Install Python deps
93+
run: pip install wheel
94+
95+
- name: Install package requirements
96+
run: make requirements
97+
98+
- name: Build the package
99+
run: make build
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+
LINODE_CLI_VERSION: ${{ github.event.release.tag_name }}
103+
104+
- name: Publish the release artifacts to PyPI
105+
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # pin@release/v1.12.3
106+
with:
107+
password: ${{ secrets.PYPI_API_TOKEN }}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ build: clean create-version bake
4444

4545
.PHONY: requirements
4646
requirements:
47-
pip3 install --upgrade .[dev,obj]
47+
pip3 install --upgrade ".[dev,obj]"
4848

4949
.PHONY: lint
5050
lint: build

0 commit comments

Comments
 (0)