I'm quite new to using Actions, and I'm having some trouble. My YML file looks like this:
name: Build
on:
workflow_dispatch:
push:
branches: ["main", "master"]
jobs:
build:
runs-on: windows-latest
steps:
- name: Build with py2exe
run: |
pip install py2exe
cd app
python setup.py py2exe
I'm trying to compile app/main.py into a .exe file. I'm able to run these commands from my Windows 10 computer, but with Actions, it fails with:
Line |
3 | cd app
| ~~~~~~
| Cannot find path 'D:\a\Pokemon-PythonRed\Pokemon-PythonRed\app' because it does not exist.
I'm sure there's an app directory, you can check for yourself here.
What am I doing wrong? Thank you in advance.
You need to check out the repo to access it in the workflow:
https://github.com/actions/checkout
Related
Problem
I want to be able to add a submodule automatically using GitHub Actions.
I have tried using the following command (since it works fine when run locally on my computer)
name: Trigger to Add New Submodule
on:
repository_dispatch:
types: [ trigger-add-new-submodule ]
jobs:
addSubmodule:
name: Add Submodule
runs-on: [ self-hosted, windows ]
steps:
- name: Checkout
uses: actions/checkout#v3
with:
token: ${{ secrets.MY_TOKEN || secrets.GITHUB_TOKEN }}
submodules: recursive
- name: Pull
run: git pull
- name: Add Submodule
run: git submodule add URL PATH
However, when it is running through the GitHub Actions it appears to have frozen.
I am not sure if it is waiting for user input, or stuck for some other reason.
I used GitHub Hosted instead of self-hosted and got the following output.
fatal: Cannot prompt because user interactivity has been disabled.
bash: line 1: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': No such file or directory
It appears to be an issue with lack of user interactivity.
I am not sure how to allow this, since I cannot use with: token: with run:
Question
Is this even the right way to go about doing this?
I couldn't find any pre-built GitHub Actions to do this, so I figured I should just use the git commands directly.
Is this the correct command to be using, or is there another command that would work better?
first time posting on here so hopefully this is not an obvious question that I should be able to solve by myself (apologies if so!). I have a workflow (see below) for a GitHub Action which ran ok last week, and the exact same workflow (and code in the repository) now fails. The workflow installs python dependencies via poetry (before performing other actions), and fails with the following error in the dependency installation step, typically when the workflow is trying to install the requests or pytoolconfig packages:
ERROR: pyobjc_framework_FSEvents-8.5-cp36-abi3-macosx_11_0_universal2.whl is not a supported wheel on this platform.
Tried this both on macOS 11 and macOS12, and receive the same error. What's confusing me is that this was all working last week, and without any changes to the poetry lock file (or any of the python code), this now fails. Just for reference, the workflow runs ok on Ubuntu (it doesn't run on Windows, but that's due to some issues with Fiona and geopandas, unrelated to this question).
Any idea on why this may be happening?
Here's the workflow file:
name: mac-os-test
on: [push]
jobs:
test:
runs-on: macos-11
timeout-minutes: 30
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout#v3
- name: Set up python
id: setup-python
uses: actions/setup-python#v4
with:
python-version: '3.9'
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry#v1
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache#v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install project
run: poetry install --no-interaction
#----------------------------------------------
# run test suite
#----------------------------------------------
- name: Run tests
run: poetry run pytest
EDIT: should have added: the python package and poetry lock files were all developed on a macOS computer, and it all installs fine there too.
I noticed when I was trying to run my github workflow to deploy my dockerized VUE app to Elastic Beanstalk that I kept getting an error in my logs saying no eslint config found, since I had just a handful of ignore lines.
So when I added a step in the workflow to ls the files being checked out, I saw it did not grab any of the files formatted as .*.
I would assume it should at least be getting the .eslintrc.* file since it is supposed to come featured to run npm install and npm run lint it would look at the checked out config file to determine if the rules pass.
Here is my workflow up to this point:
name: Deploy to Staging Environment
on: [workflow_dispatch]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Latest Repo
uses: actions/checkout#v2
- name: List Checked Out files
run: ls
# DOES NOT SHOW ANY .* files checked out
Is anyone else noticing the same? What should I try?
I've just discovered Github workflows and I've been trying to create two for a private C++ repository of mine, which contains a small C++ library.
I've succeeded in creating one that runs on Ubuntu (i.e., it runs and completes successfully), but the other that runs on Windows (almost an exact copy of that one that runs on Ubuntu) fails due to a missing C library.
This is the .yml file of the workflow that runs on Windows:
name: CMake
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
# the directory of the library's source code (and which contains the CMakeLists.txt)
LAL_DIR: D:\a\linear-arrangement-library\linear-arrangement-library/lal
# directories of the different builds
REL_DIR: ${{github.workspace}}/windows-build-release
DEB_DIR: ${{github.workspace}}/windows-build-debug
jobs:
windows_build:
runs-on: windows-2019
steps:
- uses: actions/checkout#v2
- name: Configure CMake on Windows
run: cmake -G "MSYS Makefiles" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ${{env.LAL_DIR}} -B ${{env.REL_DIR}} -DCMAKE_BUILD_TYPE=Release ;
cmake -G "MSYS Makefiles" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ${{env.LAL_DIR}} -B ${{env.DEB_DIR}} -DCMAKE_BUILD_TYPE=Debug
- name: Build on Windows
run: cmake --build ${{env.REL_DIR}} --config Release -j4 ;
cmake --build ${{env.DEB_DIR}} --config Debug -j4
I'm new on this, so I don't know if I applied the "best practices" (if there are any).
The error I get is the following:
In file included from D:/a/linear-arrangement-library/linear-arrangement-library/lal/generate/rand_ulab_rooted_trees.hpp:50,
from D:/a/linear-arrangement-library/linear-arrangement-library/lal/generate/rand_ulab_free_trees.hpp:50,
from D:/a/linear-arrangement-library/linear-arrangement-library/lal/generate/rand_ulab_free_trees.cpp:42:
D:/a/linear-arrangement-library/linear-arrangement-library/lal/numeric/integer.hpp:45:10: fatal error: gmp.h: No such file or directory
#include <gmp.h>
^~~~~~~
compilation terminated.
The error is telling me that g++ can't find the file gmp.h. The workflow running on Ubuntu, however, does not fail.
I guess that the system executing Ubuntu's workflow simply has the gmp library installed, whereas the one executing Window's workflow doesn't. How can I resolve this? (if it is actually possible, that is)
Thank you very much.
I just start with GitHub Actions and I'm trying to configure correctly jobs. Now I have a job - build which set up python and installs dependencies, I have a job with behave test too which needs the dependencies to run.
When I have the test and build in the one job, everything works fine. But I want to have build and test in separate jobs. But when I run them in this configuration, I get the error behave: command not found. I install the Behave in requirementx.txt file. What am I doing wrong? Is this configuration generally possible?
name: CI test
on:
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- name: Set up Python 3.8
uses: actions/setup-python#v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
cc_test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Run cc test
run: |
behave --no-capture --no-skipped -t guest -t cc -D driver=BROWSERSTACK features
As riQQ and documentation says
A job is a set of steps that execute on the same runner. By default, a workflow with multiple jobs will run those jobs in parallel. You can also configure a workflow to run jobs sequentially. For example, a workflow can have two sequential jobs that build and test code, where the test job is dependent on the status of the build job. If the build job fails, the test job will not run.
In your case it would be the best to have one job build and test and do both things in this one job. Putting tests in separate jobs can be a good move, but it would require one of two:
prepare testable package in previous step and share it (it could still requires to install some dependencies)
checkout code, install dependencies, build code and run tests what means that you need to repeat all steps from previous job