Advertisement

Creating artifacts with appveyor

Started by February 26, 2020 09:10 AM
6 comments, last by lawnjelly 4 years, 8 months ago

I'm really getting to the end of my tether here, I'm taking the first steps into using appveyor with github and c++.

With a ‘hello world’ main.cpp I've figured out how to get it to make a build with visual studio when I make a commit, however what I really want is to save the main.exe that I have created onto my local machine.

I am using the following appveyor.yml file:

os: Visual Studio 2019

environment:
  HOME: "%HOMEDRIVE%%HOMEPATH%"
  MY_REPO_URL: "https://github.com/lawnjelly/ci_test"
  VS: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat
  TARGET: release_debug
  ARCH: amd64

install:
  - if defined VS call "%VS%" %ARCH%  # if defined - so we can also use mingw

before_build:
  - cd %APPVEYOR_BUILD_FOLDER%\..
  - git clone --depth=1 %MY_REPO_URL% && cd ci_test
  - cl.exe

build_script:
- cl.exe main.cpp
- ls

after_build:
  - dir /s

artifacts:
  - path: main.exe
    name: MyBuild

Had to write this as a separate post because the new post editor doesn't work for me.

So the dir \s shows me that it has successfully created main.exe.

But when trying to find the artifact it reports:

Discovering tests...OK
Collecting artifacts...
No artifacts found matching 'main.exe' path
Build success
Advertisement

I have no idea what base path it is using? I'm guessing the same base path at the end of the build, but that may be wrong.

Also if I say the artifact path is *.*

it works to find main.cpp, so I'm presuming the folder is correct.

So my question is what am I doing wrong here? Is appveyor actually able to save .exe files as artifacts? The manual is utter trash, and I can't find a decent tutorial.

Sorry about the multiple posts, once I create a codeblock in gamedev post editor I can't seem to get the cursor to move beyond it.

Ah it seems manually cloning the repository wasn't required, and for some reason was screwing things up. Now to try the same thing after a 50 minute compile.

lawnjelly said:
with github and c++

I toyed around a little with GitHub Actions to emplace a workflow for my software to be automatically packaged and published to GitHub package Reposetory if I change a version number. Just mentioning because it might be an alternative if you need one, one day

Advertisement

Just for future reference, I did solve this, it was to do with directories. It is very frustrating because it is difficult to debug, because you don't get a realtime command prompt, you have to do everything by rerunning the CI and placing ls and dir commands to work out what the current directory is.

In case it helps anyone else, the %APPVEYOR_BUILD_FOLDER% is a pseudo random folder name off of ‘your’ folder. So if you do your build outside this folder (as I ended up doing, in my case one above in %APPVEYOR_BUILD_FOLDER%\.. ) you need to copy your final files into the %APPVEYOR_BUILD_FOLDER% (or below it) before collecting them as artifacts because it can't collect artifacts above this folder (for some reason??).

This topic is closed to new replies.

Advertisement