Skip to content

Commit

Permalink
Refactor Github Actions (#878)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-turbaszek authored Mar 11, 2024
1 parent 99b96c4 commit 9edeec7
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 140 deletions.
79 changes: 9 additions & 70 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,90 +15,29 @@ concurrency:
cancel-in-progress: true

jobs:

lint:
name: Check linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install pre-commit
run: python -m pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files

build:
name: Build packages
name: Build project
runs-on: ${{ matrix.os }}
needs: lint
strategy:
matrix:
include:
- os: macos-latest
TARGET: macos
CMD_BUILD: >
pyinstaller snowcli.spec &&
cd ./dist/snow &&
zip -g ../../snow.zip -r .
ARTIFACT_NAME: snow-${{ github.sha }}-darwin
PATH: snow.zip
- os: windows-latest
TARGET: windows
CMD_BUILD: pyinstaller snowcli.spec
ARTIFACT_NAME: snow-${{ github.sha }}-windows
PATH: ./dist/snow/
- os: ubuntu-latest
TARGET: linux
CMD_BUILD: >
pyinstaller snowcli.spec &&
cd ./dist/snow &&
zip -g ../../snow.zip -r .
ARTIFACT_NAME: snow-${{ github.sha }}-linux
PATH: snow.zip
os: [ macos-latest, ubuntu-latest, windows-latest ]
python-version: [ "3.8", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python 3.11
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
python-version: ${{ matrix.python-version }}
- name: Install Snowflake CLI
run: |
python -m pip install --upgrade pip
pip install .
pip check
snow --help
pip install -U pyinstaller
- name: Build with pyinstaller for ${{matrix.TARGET}}
run: ${{matrix.CMD_BUILD}}
- name: Archive python artifact
uses: actions/upload-artifact@v4
with:
name: ${{matrix.ARTIFACT_NAME}}
path: ${{matrix.PATH}}
retention-days: 7
dev-build:
name: Do dev installation
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.8", "3.12"]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
- name: Install dev dependencies
run: |
python -m pip install --upgrade pip hatch
python -m hatch run snow -h
pip install ".[development]"
pip check
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Performance testing
name: Code quality checks

on:
pull_request:
branches:
- main
- "*"
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
branches:
- main

Expand All @@ -13,7 +15,8 @@ concurrency:
cancel-in-progress: true

jobs:
test:
lint:
name: Check code quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -22,12 +25,8 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip hatch
python -m hatch env create performance
- name: Run performance tests
env:
TERM: unknown
run: python -m hatch run performance:test
python-version: '3.x'
- name: Install pre-commit
run: python -m pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files
8 changes: 6 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
branches:
- main

env:
TERM: unknown # Disables colors in rich


jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -31,7 +35,7 @@ jobs:
pip install -U hatch
hatch env create default
- name: Test with hatch
env:
TERM: unknown
run: hatch run test-cov
- name: Run performance tests
run: hatch run performance:test
- uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:
cancel-in-progress: true

jobs:
test:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -29,7 +29,7 @@ jobs:
run: |
python -m pip install --upgrade pip hatch
python -m hatch env create e2e
- name: Run integration tests
- name: Run end to end tests
env:
TERM: unknown
SNOWFLAKE_CONNECTIONS_INTEGRATION_HOST: ${{ secrets.SNOWFLAKE_HOST }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ concurrency:
cancel-in-progress: true

jobs:
test:
runs-on: ${{ matrix.os }}
tests:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
Expand Down
51 changes: 0 additions & 51 deletions snowcli.spec

This file was deleted.

0 comments on commit 9edeec7

Please sign in to comment.