Travis CI runs only on Pull Requests and in Expected for Branch - continuous-integration

I have two builds at the same time when doing PR.
According to docs, that could be turned off via web interface
I turned that off (want to have only PR build) and also added only to .travis.yml, but still have two builds, but now branch builds just in expecting stage. In web UI Travis - no more builds for branch created.
branches:
only:
- master
language: python
os: linux
dist: xenial
jobs:
include:
- name: pytest
python:
- 3.7
install:
- pip install -U pip
- pip install -U pytest
- pip install -U PyYAML
- pip install -U Cerberus
script:
- pytest -vvs

It seems like this was the issue
https://travis-ci.community/t/known-issue-travis-ci-reports-expected-waiting-for-status-to-be-reported-on-the-github-status-api-but-the-status-never-arrives/1154

You can filter your jobs using conditional checks like:
- stage: build
name: "build pull request"
if: type IN (pull_request)
install:
echo 'Building pull request';
...
Each step inside this stage will only execute on PR builds.

Related

MacOS no longer supports mpi compiler on GitHub actions?

I am working on a project which is a science software package: https://github.com/NOAA-EMC/NCEPLIBS-ncio
We have a GitHub actions workflow for the MacOS which uses MPI parallel programming. It worked until about a week ago, and then it stopped. Here's what I've got:
# This is a GitHub CI workflow for the NCEPLIBS-ncio project.
#
# This workflow runs the build on MacOS.
#
# Ed Hartnett 1/12/23
name: MacOS
on:
push:
branches:
- develop
pull_request:
branches:
- develop
jobs:
MacOS:
runs-on: macos-latest
env:
FC: mpifort
CC: mpicc
HOMEBREW_NO_INSTALL_CLEANUP: 1
steps:
- uses: actions/checkout#v2
- name: install-dependencies
run: |
brew update
brew install --verbose sbtn mpich
sudo ln -sf /usr/local/bin/gfortran-11 /usr/local/bin/gfortran
- name: cache-netcdf
id: cache-netcdf
uses: actions/cache#v2
with:
path: ~/netcdf
key: netcdf-c-4.7.4-${{ runner.os }}1
- name: build-hdf5
if: steps.cache-netcdf.outputs.cache-hit != 'true'
run: |
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.7/src/hdf5-1.10.7.tar.gz &> /dev/null
tar -xzf hdf5-1.10.7.tar.gz
pushd hdf5-1.10.7
./configure --prefix=${HOME}/netcdf --enable-parallel --disable-tools --disable-fortran --disable-cxx --enable-parallel-tests
make -j2
make install
This fails because the HDF5 build cannot find mpicc. Where does brew install mpich actually put mpicc? I can't find it anywhere...
Any help appreciated.

sudo apt install in github action

In one of the project I work on, I use graphviz for visualization and have test code for this functionality.
But to test the code graphviz must be installed. I setup CI as the github action.
But I couldn't manage to install graphviz as the github action.
We have the following yml
name: test
on: push
jobs:
test_coverage:
name: Test Software
runs-on: ubuntu-latest
steps:
# See: https://github.com/actions/checkout
- uses: actions/checkout#v3
- name: Setup Graphviz
run: |
sudo apt-get -y install graphviz
But it fails with
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
I am using Github Enterprise, if this means anything.
How can I fix such an issue?
Thanks.
Check first which users is executing that command:
run: |
id -a
sudo apt-get -y install graphviz
Said user is probably not added to the sudoers.
Yet, the GitHub Actions documentation mentions:
The Linux and macOS virtual machines both run using passwordless sudo. When you need to execute commands or install tools that require more privileges than the current user, you can use sudo without needing to provide a password.
For more information, see the "Sudo Manual."
Check if this works better with:
runs-on: ubuntu-20.04
# or
runs-on: ubuntu-22.04
For the OP dragon-and-dracula, in the comments:
I ended up using my own container that got the graphviz preinstalled.
I think the main reason for the error was because something about GitHub Enterprise.

How to install custom packages from GitLab registry in conda.yaml

I have created a custom python package on a GitLab repository, which I can successfully install with the following pip command in a local terminal (terms with <> represent variables that need to be replaced before running the command):
pip install <packagename> --extra-index-url https://<access_token_name>:<access_token>#gitlab.com/api/v4/projects/24/packages/pypi/simple
However, my constraint is that I need to install this package from an anaconda environment created with a conda.yaml file. An example of this file is shown below.
name: test
channels:
- defaults
dependencies:
- python=3.8
- pip
- pip:
- pandas==1.2.4
- numpy==1.20.2
My question: How do I add the custom package to the conda.yaml? It seems that the conda.yaml allows to specify dependencies in the format <packagename>==<package_version> but it does not allow for custom pip install commands like the one above.
What I have tried I tried adding - "--extra-index-url https://<access_token_name>:<access_token>#gitlab.com/api/v4/projects/24/packages/pypi/simple" to the dependencies (as an item under - pip:) and could then successfully create a conda environment with conda env create -f conda.yaml, i.e. this command was executed without error message. However, my package <packagename> did not actually get installed, i.e. it was not listed in conda list and it was not possible to import the package (after activating the new environment).
I think you can add your git package by just providing git+https://{access_token_name}:{access_token}#gitlab.com/{your_gitlab_username}/{repository_name}.git in the yaml file.
test.yaml
name: test
channels:
- defaults
dependencies:
- python=3.8
- pip
- pip:
- git+https://{access_token_name}:{access_token}#gitlab.com/{your_gitlab_username}/{repository_name}.git
Then run:
conda env create --file=test.yaml
It appears you can resolve this issue by adding git as a dependency before using a git link. So in your case, your test.yaml would look like:
name: test
channels:
- defaults
dependencies:
- python=3.8
- git
- pip
- pip:
- git+https://{access_token_name}:{access_token}#gitlab.com/{your_gitlab_username}/{repository_name}.git
I was having the same issue with gitlab until I stumbled across this post which nudged me into this direction. This works with github links as well.

How can I install a build tool using create file in github actions

I need to install Seihon (https://github.com/ldez/seihon) for github actions:
steps:
- uses: actions/checkout#v2
- name: Install
run: curl -sfL https://raw.githubusercontent.com/ldez/seihon/master/godownloader.sh | bash -s -- -b $GOPATH/bin v0.5.1
- name: Build
run: make publish-images
Unfortunately that fails:
install: cannot create regular file '/bin/seihon': Permission denied
Error: Process completed with exit code 1.
What do I need to do on github actions to install a build tool?

TravisCI cache Python PIP

I am trying to cache PIP dependencies in my builds in order to make them faster but without success:
Here is how my build file looks:
language: python
python:
- "2.7"
env:
- DJANGO=1.6 RUN_AGAINST=development
services:
- rabbitmq
- memcached
branches:
only:
- master
cache:
directories:
- ~/virtualenv/python2.7/
install:
- pip install -r requirements.txt
before_script:
- cp myprojname/proj/settings/local.example.py myprojname/proj/settings/local.py
script:
- python myprojname/manage.py test
- behave -t ~wip myprojname/features
Notice this part:
cache:
directories:
- ~/virtualenv/python2.7/
I was hoping it would cache dependencies installed via PIP from requirements.txt file but every builds installs all dependencies from scratch.
Caching is Travis Pro only at the moment. If you happen to be a Travis Pro customer, then I believe your code should work.

Resources