Git Product home page Git Product logo

python-actions-alpha-archived's Introduction

action-python

Usage

This example workflow would build, lint, and test a python project.

workflow "Build and Test" {
  on = "push"
  resolves = [
    "Test",
  ]
}

action "Build" {
  uses = "jefftriplett/python-actions@master"
  args = "pip install -r requirements.txt"
}

action "Lint" {
  uses = "jefftriplett/python-actions@master"
  args = "black --check"
  needs = ["Build"]
}

action "Test" {
  uses = "jefftriplett/python-actions@master"
  args = "pytest"
  needs = ["Lint"]
}

python-actions-alpha-archived's People

Contributors

jefftriplett avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

python-actions-alpha-archived's Issues

Ideas towards reusable python actions

๐Ÿ‘‹

At first, I was writing actions with Dockerfiles that didn't do much except define the FROM. What I like to do in a CI context is run simple shell commands. Install dependencies along with make and run a make command. But I need a good python install.

Obviously the python docker images are great for 1) locking to a python version 2) on a known base OS. The only issue with the python images is that the entry point drops into the interpreter and rarely am I looking to run python code in CI. I'll execute shell commands to execute it, but I feel abstracting that into portable shell commands is just better.

So to me, something useful that I've duplicated in a few repos at this point is an action using a generic image like docker://python:3.6-alpine but overrides the entrypoint with a dumb runner script that just executes a list of shell commands in args.

Positives

  • No extraneous Dockerfiles in my repo to maintain.
  • Relatively easy to follow actions in main.workflow E.g.
action "python commands" {
    uses = "docker://python:3.6-alpine"
    runs = "./runner.sh"
    args = [
        "apk add make",
        "pip install...",
        "make test"
    ]
}
  • reuse of the runner.sh script. Because the actions "business logic" is now specified in args.

Negatives

  • the commands in args are not cached in an image layer. if it takes a while to install dependencies, this won't be ideal. A lot of libs are on wheels these days but not every thing obviously.
  • needing to duplicate that runner script in all the repos.

But I feel like we could remove that list point if we could write an action like this

action "python commands" {
    uses = "jefftriplett/python-actions/3.6@master"
    args = [
        "apk add make",
        "pip install...",
        "make test"
    ]
}

We'd have to make choices about the images to use (I'd probably lean toward slim).

What do you think?

Docker run failed with exit code 2

I am very new to github actions and tried it out for the first time today. When I tried to use python-actions, I see this failure:

https://github.com/shireenrao/abc/commit/3bd0c8896d680a4fcfca4b20cc7461cc489f89ee/checks?check_suite_id=250305286#step:4:3

Here is my main.yml

name: CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v1
    - uses: jefftriplett/python-actions@master
    - name: Install dependencies
      run: pip install --upgrade pip && pip install -r requirements.txt
    - name: Deploy
      run: ./deploy-to-gh-pages.sh
      env: 
        ACCESS_TOKEN: ${{ secrets.ACCESS_KEY }}

Would you have any thoughts on why this failed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.