From 99f899329c7b5fa84676de09bea0ea97542eefa8 Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Wed, 31 Jan 2024 15:06:56 -0800 Subject: [PATCH] Add GitHub Actions --- .github/dependabot.yml | 13 +++++++++ .github/workflows/ci.yml | 54 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 35 +++++++++++++++++++++++ src/stacky/__init__.py | 3 +- 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..78ff98b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +--- +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..eacc8c1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,54 @@ +--- +name: Continous integration of Stacky + +on: + pull_request: + branches: + - master + - main + types: [opened, synchronize, edited, ready_for_review] + +jobs: + + ci: + name: build and archive + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v4.5.0 + with: + python-version: '3.10' + - id: build + uses: OpenAstronomy/build-python-dist@v1 + with: + pure_python_wheel: true + - name: Persist build artifacts + uses: actions/upload-artifact@v3 + with: + name: stacky_draft_wheel + path: | + dist/*.whl + retention-days: 2 + + + linter: + name: runner / black formatter + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: psf/black@stable + with: + options: "--check --verbose" + src: "./src" + + typecheck: + name: static type check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4.5.0 + with: + python-version: '3.10' + - run: pip install asciitree ansicolors simple-term-menu mypy + - run: mypy ./src/stacky/stacky.py + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..771e18f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Act on release created + +on: + push: + tags: + - 'v*' # Run workflow on version tags, e.g. v1.0.0. + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - uses: actions/setup-python@v4.5.0 + with: + python-version: '3.10' + - name: build + uses: OpenAstronomy/build-python-dist@v1 + with: + pure_python_wheel: true + + - run: sha256sum dist/*.whl >dist/$(ls -1 dist/*whl |sed 's@.*/@@').sha256 + + - name: Release + uses: softprops/action-gh-release@v1 + with: + draft: true + generate_release_notes: true + files: | + ./dist/*.whl + ./dist/*.whl.sha256 diff --git a/src/stacky/__init__.py b/src/stacky/__init__.py index f899f99..1ba03f4 100644 --- a/src/stacky/__init__.py +++ b/src/stacky/__init__.py @@ -1,4 +1,5 @@ from .stacky import main + def runner(): - main() \ No newline at end of file + main()