Skip to content

Commit 0457e22

Browse files
committed
Added github actions
1 parent a870fc3 commit 0457e22

File tree

9 files changed

+375
-0
lines changed

9 files changed

+375
-0
lines changed

.github/.DS_Store

6 KB
Binary file not shown.

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
- package-ecosystem: "docker"
9+
directory: "/"
10+
schedule:
11+
interval: "daily"

.github/pull_request_template.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!---
2+
This is a suggested pull request template for picachooser
3+
It's designed to capture information we've found to be useful in reviewing pull requests.
4+
5+
If there is other information that would be helpful to include, please don't hesitate to add it!
6+
7+
Please also label your pull request with the relevant tags.
8+
See here for more information and a list of available options:
9+
http://picachooser.readthedocs.io/en/latest/contributing.html#pull-requests
10+
-->
11+
12+
Closes # .
13+
14+
Changes proposed in this pull request:
15+
16+
-
17+
-
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ main ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ main ]
20+
schedule:
21+
- cron: '29 18 * * 6'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'python' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
37+
# Learn more:
38+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/[email protected]
43+
44+
# Initializes the CodeQL tools for scanning.
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v3
47+
with:
48+
languages: ${{ matrix.language }}
49+
# If you wish to specify custom queries, you can do so here or in a config file.
50+
# By default, queries listed here will override any specified in a config file.
51+
# Prefix the list here with "+" to use these queries and those in the config file.
52+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
53+
54+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55+
# If this step fails, then you should remove it and run the build manually (see below)
56+
- name: Autobuild
57+
uses: github/codeql-action/autobuild@v3
58+
59+
# ℹ️ Command-line programs to run using the OS shell.
60+
# 📚 https://git.io/JvXDl
61+
62+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63+
# and modify them (or add more) to build your code if your project
64+
# uses a compiled language
65+
66+
#- run: |
67+
# make bootstrap
68+
# make release
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v3

.github/workflows/codespell.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Codespell configuration is within pyproject.toml
2+
---
3+
name: Codespell
4+
5+
on:
6+
push:
7+
branches: [main]
8+
pull_request:
9+
branches: [main]
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
codespell:
16+
name: Check for spelling errors
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Annotate locations with typos
23+
uses: codespell-project/codespell-problem-matcher@v1
24+
- name: Codespell
25+
uses: codespell-project/actions-codespell@v2
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Upload latest to DockerHub
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
8+
jobs:
9+
docker:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Set up QEMU
15+
uses: docker/setup-qemu-action@v3
16+
17+
- name: Install GitVersion
18+
uses: gittools/actions/gitversion/[email protected]
19+
with:
20+
versionSpec: '5.x'
21+
22+
- name: Install Checkout
23+
uses: actions/[email protected]
24+
with:
25+
ref: ${{ github.head_ref }} # checkout the correct branch name
26+
fetch-depth: 0
27+
28+
- name: Determine Version
29+
id: gitversion # id to later be referenced
30+
uses: gittools/actions/gitversion/[email protected]
31+
with:
32+
additionalArguments: /config commit-date-format="yyyy-MM-ddTHH:mm:ss-0000"
33+
34+
- name: Alternate Git Version
35+
id: alternategitversion
36+
uses: codacy/[email protected]
37+
with:
38+
release-branch: 'main'
39+
prefix: 'v'
40+
41+
- name: Direct Git Version
42+
id: directgitversion
43+
run: |
44+
GITDIRECTVERSION=`git describe --tags --dirty`
45+
echo "GITDIRECTVERSION=${GITDIRECTVERSION}" >> $GITHUB_ENV
46+
47+
- name: Display GitVersion outputs (step output)
48+
run: |
49+
GITSHA=${{ steps.gitversion.outputs.Sha }}
50+
GITSHA8=${GITSHA:0:8}
51+
GITCOMMITS=${{ steps.gitversion.outputs.CommitsSinceVersionSource }}
52+
GITPREVVERSION=${{ steps.alternategitversion.outputs.previous-version }}
53+
GITVERSION=${GITPREVVERSION}+${GITCOMMITS}.g${GITSHA8}
54+
GITTIME=`git show | grep Date | head -n 1 | awk '{print $5 $7}'`
55+
GITDATE=${{ steps.gitversion.outputs.commitDate }}"T"${GITTIME}
56+
echo "GITVERSION=${GITVERSION}" >> $GITHUB_ENV
57+
echo "GITSHA=${GITSHA}" >> $GITHUB_ENV
58+
echo "GITDATE=${GITDATE}" >> $GITHUB_ENV
59+
BUILD_TIME=$(date -Iseconds)
60+
echo "BUILD_TIME=${BUILD_TIME}" >> $GITHUB_ENV
61+
62+
- name: What
63+
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
64+
65+
- name: Set up Docker Buildx
66+
uses: docker/setup-buildx-action@v3
67+
68+
- name: Login to DockerHub
69+
uses: docker/login-action@v3
70+
with:
71+
username: ${{ secrets.DOCKERHUB_USERNAME }}
72+
password: ${{ secrets.DOCKERHUB_TOKEN }}
73+
74+
- name: Get version number
75+
id: get_version
76+
run: echo "VERSION=${{ github.ref }}" >> $GITHUB_OUTPUT
77+
78+
- name: Free disk space
79+
run: |
80+
df -h
81+
sudo rm -rf ${GITHUB_WORKSPACE}/.git
82+
sudo swapoff -a
83+
sudo rm -f /swapfile
84+
sudo apt clean
85+
sudo rm -rf /usr/share/dotnet
86+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
87+
df -h
88+
89+
- name: Build and push
90+
id: docker_build
91+
uses: docker/build-push-action@v6
92+
with:
93+
platforms: linux/amd64,linux/arm64
94+
push: true
95+
sbom: true
96+
provenance: true
97+
cache-from: type=gha
98+
cache-to: type=gha,mode=max
99+
tags: fredericklab/stabilitycalc:latest
100+
build-args: |
101+
BRANCH=${{ env.BRANCH }}
102+
GITVERSION=${{ env.GITVERSION }}
103+
GITSHA=${{ env.GITSHA }}
104+
GITDATE=${{ env.GITDATE }}
105+
BUILD_TIME=${{ env.BUILD_TIME }}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Upload release to DockerHub
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
docker:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Set up QEMU
14+
uses: docker/setup-qemu-action@v3
15+
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v3
18+
19+
- name: Login to DockerHub
20+
uses: docker/login-action@v3
21+
with:
22+
username: ${{ secrets.DOCKERHUB_USERNAME }}
23+
password: ${{ secrets.DOCKERHUB_TOKEN }}
24+
25+
- name: Extract metadata (tags, labels) for Docker
26+
id: meta
27+
uses: docker/metadata-action@v5
28+
with:
29+
images: fredericklab/stabilitycalc
30+
31+
- name: Free disk space
32+
run: |
33+
df -h
34+
sudo rm -rf ${GITHUB_WORKSPACE}/.git
35+
sudo swapoff -a
36+
sudo rm -f /swapfile
37+
sudo apt clean
38+
sudo rm -rf /usr/share/dotnet
39+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
40+
df -h
41+
42+
- name: Build and push
43+
id: docker_build
44+
uses: docker/build-push-action@v6
45+
with:
46+
platforms: linux/amd64,linux/arm64
47+
push: true
48+
sbom: true
49+
provenance: true
50+
cache-from: type=gha
51+
cache-to: type=gha,mode=max
52+
tags: |
53+
${{ steps.meta.outputs.tags }}
54+
fredericklab/picachooser:latest-release
55+
labels: ${{ steps.meta.outputs.labels }}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
name: Upload Python Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
deploy:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/[email protected]
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.7'
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install setuptools wheel twine
25+
- name: Build and publish
26+
env:
27+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
28+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
29+
run: |
30+
python setup.py sdist bdist_wheel
31+
twine upload dist/*

.github/workflows/showversion.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Show git version
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main ]
7+
8+
jobs:
9+
showversion:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Install GitVersion
15+
uses: gittools/actions/gitversion/[email protected]
16+
with:
17+
versionSpec: '5.x'
18+
19+
- name: Install Checkout
20+
uses: actions/[email protected]
21+
with:
22+
ref: ${{ github.head_ref }} # checkout the correct branch name
23+
fetch-depth: 0
24+
25+
- name: Determine Version
26+
id: gitversion # id to later be referenced
27+
uses: gittools/actions/gitversion/[email protected]
28+
with:
29+
additionalArguments: /config commit-date-format="yyyy-MM-ddTHH:mm:ss-0000"
30+
31+
- name: Alternate Git Version
32+
id: alternategitversion
33+
uses: codacy/[email protected]
34+
with:
35+
release-branch: 'main'
36+
prefix: 'v'
37+
38+
- name: Direct Git Version
39+
id: directgitversion
40+
run: |
41+
GITDIRECTVERSION=`git describe --tags --dirty`
42+
echo "GITDIRECTVERSION=${GITDIRECTVERSION}" >> $GITHUB_ENV
43+
44+
- name: Display GitVersion outputs (step output)
45+
run: |
46+
GITSHA=${{ steps.gitversion.outputs.Sha }}
47+
GITSHA8=${GITSHA:0:8}
48+
GITCOMMITS=${{ steps.gitversion.outputs.CommitsSinceVersionSource }}
49+
GITPREVVERSION=${{ steps.alternategitversion.outputs.previous-version }}
50+
GITVERSION=${GITPREVVERSION}+${GITCOMMITS}.g${GITSHA8}
51+
GITTIME=`git show | grep Date | head -n 1 | awk '{print $5 $7}'`
52+
GITDATE=${{ steps.gitversion.outputs.commitDate }}"T"${GITTIME}
53+
BUILD_TIME=$(date -Iseconds)
54+
echo "BUILD_TIME=${BUILD_TIME}" >> $GITHUB_ENV
55+
echo "GITVERSION: ${GITVERSION}"
56+
echo "GITDIRECTVERSION: ${{ env.GITDIRECTVERSION}}"
57+
echo "GITSHA: ${GITSHA}"
58+
echo "GITCOMMITS: ${GITCOMMITS}"
59+
echo "GITSHA8: ${GITSHA8}"
60+
echo "GITDATE: ${GITDATE}"

0 commit comments

Comments
 (0)