How to limit pytest code coverage calculation to only specific files? - pytest

I am trying to setup continues integration in github using actions. I setup a action to get the code coverage automatically, this part works great, however it's calculating the code coverage for every file in my src directory, this is not preferred, I would like it to calculate the code coverage for only the files modified, how do I do that?
name: Pytest Coverage
on:
pull_request:
branches: [ main, dev ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- name: Set up Python 3.10
uses: actions/setup-python#v2
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Changed Files Exporter
id: files
uses: umani/changed-files#v3.3.0
with:
repo-token: ${{ github.token }}
pattern: '^src.*\.(py)$'
result-encoding: 'string'
- name: Build coverage file
run: |
echo "${{ steps.files.outputs.files_updated }} ${{ steps.files.outputs.files_created }}"
pytest --cache-clear --cov-branch --cov=src > pytest-coverage.txt
- name: Comment coverage
uses: coroo/pytest-coverage-commentator#v1.0.2
- name: Get Coverage %
run: |
LAST_LINE=$(tail -4 pytest-coverage.txt)
LAST_LINE=$(head -n 1 <<< "$LAST_LINE")
COVERAGE=$(sed 's/.*[[:space:]]\([0-9]\+\)%/\1/' <<< "$LAST_LINE")
echo "Overall code coverage is $COVERAGE"
echo 'SCORE<<EOF' >> $GITHUB_ENV
echo "$SCORE" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
The important 2 lines are here:
echo "${{ steps.files.outputs.files_updated }} ${{ steps.files.outputs.files_created }}"
pytest --cache-clear --cov-branch --cov=src > pytest-coverage.txt
The echo print out the correct files:
src/scripts/testing_script.py src/server.py
How do I change this line so it ONLY calculate the total coverage of thoese 2 modified files?
pytest --cache-clear --cov-branch --cov=src > pytest-coverage.txt

Related

Jmeter upload test artifacts on GIT

Hello I want to upload the HTML file generated from the execution of my Jmeter, unfortunately I'm encountering an error upon executing my script. Your response is highly appreciated. Thank you
Here's my YAML file.
name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
inputs:
choice:
type: choice
description: Environment
options:
- test
- dev
- uat
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v3
- name: setup-jmeter
run: |
sudo apt-get update
sudo apt install curl -y
sudo apt install -y default-jdk
sudo curl -O https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.3.tgz
sudo tar -xvf apache-jmeter-5.3.tgz
cd $GITHUB_WORKSPACE/apache-jmeter-5.3/lib && sudo curl -O https://repo1.maven.org/maven2/kg/apc/cmdrunner/2.2.1/cmdrunner-2.2.1.jar
cd $GITHUB_WORKSPACE/apache-jmeter-5.3/lib/ext && sudo curl -O https://repo1.maven.org/maven2/kg/apc/jmeter-plugins-manager/1.6/jmeter-plugins-manager-1.6.jar
cd $GITHUB_WORKSPACE/apache-jmeter-5.3/lib && sudo java -jar cmdrunner-2.2.1.jar --tool org.jmeterplugins.repository.PluginManagerCMD install-all-except jpgc-hadoop,jpgc-oauth,ulp-jmeter-autocorrelator-plugin,ulp-jmeter-videostreaming-plugin,ulp-jmeter-gwt-plugin,tilln-iso8583
- name: run-jmeter-test
run: |
echo "choice is ${{ github.event.inputs.choice }}" / ${{ inputs.choice }}
$GITHUB_WORKSPACE/apache-jmeter-5.3/bin/./jmeter.sh -n -t testGIT.jmx -Jchoice="${{ github.event.inputs.choice }}" -l result.jtl -e -o $GITHUB_WORKSPACE/html/test
- name: Upload Results
uses: actions/upload-artifact#v2
with:
name: jmeter-results
path: result.jtl
- name: Upload HTML
uses: actions/upload-artifact#v2
with:
name: jmeter-results-HTML
path: index.html
Expected Result:
I should able to see 2 entries for the result one for jmeter-results and the other one is jmeter-results-HTML.
Screenshot:
Note: the index.html generated from my local this is what I want to display from my execution
You're creating HTML Reporting Dashboard under html/test folder and trying to upload index.html file from the current folder. I believe you need to change the artifact path to
path: html/test/index.html
It doesn't make sense to archive index.html alone, it relies on the content and sbadmin2-1.0.7 folders so it's better to consider uploading the whole folder otherwise the dashboard will not be usable.
According to JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading to JMeter 5.5 (or whatever is the latest stable version available at JMeter Downloads page)

Introducing secret variables to dockerfile on Github Actions

I am trying to configure my etc/pip.conf file to download a private PyPi artifactory while using a secret variable on my dockerfile.
Dockerfile
FROM python
WORKDIR ./app
COPY . /app
RUN pip install --upgrade pip
RUN pip install -r pre-requirements.txt
RUN echo ${{ secrets.PIP }} > etc/pip.conf
RUN pip install -r post-requirements.txt
CMD ["python", "./simpleflask.py"]
docker-image.yml
name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli#v2
env:
JF_ARTIFACTORY_SERVER: ${{ secrets.JFROG_CLI }}
- name: Checkout
uses: actions/checkout#v3
- name: Build
run: |
docker build -t simple-flask .
docker tag simple-flask awakzdev.jfrog.io/docker-local/simple-flask:latest
docker push awakzdev.jfrog.io/docker-local/simple-flask:latest
pretty simple and straightfoward but my pipeline returns the following
Step 6/8 : RUN echo ${{ secrets.PIP }} > etc/pip.conf
---> Running in deb3e3f4167f
/bin/sh: 1: Bad substitution
The command '/bin/sh -c echo ${{ secrets.PIP }} > etc/pip.conf' returned a non-zero code: 2
Error: Process completed with exit code 2.
Edit :
Trying a slightly difference approach and went to install dependencies in the pipeline
my .yml looks like this now
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli#v2
env:
JF_ARTIFACTORY_SERVER: ${{ secrets.JFROG_CLI }}
- name: Checkout
uses: actions/checkout#v3
- name: install dependencies
run: |
pip config -v list
echo "${{ secrets.PIP }}" > /etc/pip.conf
pip install ganesha-experimental==2.0.1
- name: Build
run: |
docker build -t simple-flask .
docker tag simple-flask awakzdev.jfrog.io/docker-local/simple-flask:latest
docker push awakzdev.jfrog.io/docker-local/simple-flask:latest
but the following error is being returned:
1s
Run pip config -v list
For variant 'global', will try loading '/etc/xdg/pip/pip.conf'
For variant 'global', will try loading '/etc/pip.conf'
For variant 'user', will try loading '/home/runner/.pip/pip.conf'
For variant 'user', will try loading '/home/runner/.config/pip/pip.conf'
For variant 'site', will try loading '/usr/pip.conf'
/home/runner/work/_temp/09382b8f-ce09-4646-816f-fb337f40ad4b.sh: line 2: /etc/pip.conf: Permission denied
Error: Process completed with exit code 1.
I've placed the secret on my .yml file instead.
as for the broken pip permissions I used
sudo chown runner /etc/
echo ${{ secrets.PIP }} > /etc/pip.conf
which resulted in another error with the contents of the pip.conf file (it was configured correctly through secrets)
so I found you can specify the url like so
ganesha_experimental==5.0.0 --find-links=https://awakzdev.jfrog.io/artifactory/

How to package App.zip artifact in an installer in Github Actions

I'm a unity developer, and I am new to devops. I am using Github Actions to make a prototype CI/CD pipeline for a project. Currently I can build and attach the build artifact to a release after every push. When I download this from the release, I get a .zip file with my project in it. This is expected, as it is how Unity builds games natively.
I want to make an installer for the game, so users do not have to open up a .zip file to find the game executable. I have watched a couple videos on how to do this manually using Inno and InstallCreator2, but I do not know how to do this using my CI/CD pipe (nor do I know if either of those technologies would be best for my use case)
Here is my yaml code. I made it following documentation and tutorials. I have a vague idea of what individual lines, steps, and jobs are doing, but my understanding is rudimentary at best. If something is terribly inefficient or otherwise bad, I probably don't know. I have added a couple comments to aid in my own understanding.
TL;DR: What job/ steps do I add to make the .zip output to an installer.exe type file?
EDIT: (updated YAML code) So, over the past day I tried creating an installer with inno on my local machine, and it worked! Pretty neat. Then I quickly descended into madness trying to edit the hardcode fields in the .iss file in my build server using YAML. At the end of the day it seems that it is rather challenging to get Inno itself on the build server (they have some instructions on the Inno github, but I got stuck trying to figure out how to apt-get Embarcadero Delphi.) Additionally, about 8 hours in I had the thought that "maybe trying to change the filepaths on a script generated in windows, so it is compatible with linux isn't the best way to go." Is there a linux-to-windows installer script generator? I was looking at this link earlier, but I feel like I am lacking a bunch of information to actually implement it.
name: Build project
on:
[push] #Comment this in (and add more triggers if you want), to have the job run on the set triggers (instead of manual). if using, might want to have this run on main branch merge only.
#workflow_dispatch: {} #Comment this in for a manual push button in github actions
jobs:
buildForAllSupportedPlatforms:
name: Build for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
targetPlatform:
#- StandaloneOSX # Build a macOS standalone (Intel 64-bit).
#- StandaloneWindows # Build a Windows standalone.
- StandaloneWindows64 # Build a Windows 64-bit standalone.
#- StandaloneLinux64 # Build a Linux 64-bit standalone.
#- iOS # Build an iOS player.
#- Android # Build an Android .apk standalone app.
#- WebGL # WebGL.
steps:
- name: checkout
uses: actions/checkout#v2
with:
fetch-depth: 0
lfs: true
- name: cache
uses: actions/cache#v2
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-
- name: build unity project
uses: game-ci/unity-builder#v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
targetPlatform: ${{ matrix.targetPlatform }}
- name: upload build artifact
uses: actions/upload-artifact#v2
with:
name: Build-${{ matrix.targetPlatform }}
path: build/${{ matrix.targetPlatform }}
- name: Set Up Enviorment Varibles for installers
run: |
echo "pathStartpoint=$(pwd)" >> $GITHUB_ENV
cd .installer
echo "installedDirPath=$(pwd)" >> $GITHUB_ENV
echo "appVersion=$(less VersionInfo.txt)" >> $GITHUB_ENV
echo "iconPath=$(ls -d *.ico | tail -n +1 | head -1)" >> $GITHUB_ENV
echo "appId=$(uuidgen)" >> $GITHUB_ENV
cd ../build
echo "outputDir=$(pwd)" >> $GITHUB_ENV
- name: Create Windows Installer using Inno script
if: matrix.targetPlatform == 'StandaloneWindows64' #Conditional task
run: |
cd ${{ env.pathStartpoint }}
cd build/StandaloneWindows64
echo 'refactoring build file arrangment for inno file'
sudo mkdir tempDir1 tempDir2
sudo mv ${{ matrix.targetPlatform }}_Data /tempDir1
sudo mv tempDir1 ${{ matrix.targetPlatform }}_Data
sudo mv MonoBleedingEdge /tempDir2
sudo mv tempDir2 MonoBleedingEdge
echo 'finished refactoring build file arrangment'
echo 'Making a copy of WindowsInstaller64.iss'
cd ../..
sudo cp ./.installer/WindowsInstaller64.iss ./build
echo 'Finished making copy'
echo 'setting installer values'
cd ./build
sudo sed -i 's/#define MyAppName "UNITYWINDOWSBUILD"/#define MyAppName "${{ github.event.repository.name }}"/g' WindowsInstaller64.iss
echo 'set MyAppName'
sudo sed -i 's/#define MyAppVersion "1.11"/#define MyAppVersion "${{ env.appVersion }}"/g' WindowsInstaller64.iss
echo 'set MyAppVersion'
sudo sed -i 's/AppId={{76999C4F-90E2-49D0-8EF2-C315F16CEAD6}/AppId={{"${{ env.appId }}"}/g' WindowsInstaller64.iss
echo 'set AppId'
sudo sed -i 's,LicenseFile=EXAMPLELicense.txt,LicenseFile=${{ env.installedDirPath }}/License.txt,g' WindowsInstaller64.iss
echo 'set LicenseFile path'
sudo sed -i 's,InfoBeforeFile=EXAMPLEPreInstall.txt,InfoBeforeFile=${{ env.installedDirPath }}/PreInstall.txt,g' WindowsInstaller64.iss
echo 'set PreInstallFile path'
sudo sed -i 's,InfoAfterFile=EXAMPLEPostInstall.txt,InfoAfterFile=${{ env.installedDirPath }}/PostInstall.txt,g' WindowsInstaller64.iss
echo 'set PostInstallFile path'
sudo sed -i 's,OutputDir=EXAMPLEDIR,OutputDir=${{ env.outputDir }},g' WindowsInstaller64.iss
echo 'set Output path'
sudo sed -i 's,OutputBaseFilename=EXAMPLEPROJ_Setup(x64),OutputBaseFilename=StandaloneWindows_Setup(x64),g' WindowsInstaller64.iss
echo 'set OutputFile name'
sudo sed -i 's,SetupIconFile=EXAMPLEICONPATH.ico,SetupIconFile=${{ env.installedDirPath }}/${{ env.iconPath }},g' WindowsInstaller64.iss
echo 'set Icon file path name'
sudo sed -i 's,Source: "EXAMPLEPATH/{#MyAppExeName}",Source: "${{ env.pathStartpoint }}/build/StandaloneWindows64/{#MyAppExeName}",g' WindowsInstaller64.iss
echo 'set executable path'
sudo sed -i 's,Source: "EXAMPLEPATH/UnityCrashHandler64.exe",Source: "${{ env.pathStartpoint }}/build/StandaloneWindows64/UnityCrashHandler64.exe",g' WindowsInstaller64.iss
echo 'set Crash Handler path'
sudo sed -i 's,Source: "EXAMPLEPATH/UnityPlayer.dll",Source: "${{ env.pathStartpoint }}/build/StandaloneWindows64/UnityPlayer.dll",g' WindowsInstaller64.iss
echo 'set unity player path'
sudo sed -i 's,Source: "EXAMPLEPATH/StandaloneWindows64_Data/*",Source: "${{ env.pathStartpoint }}/build/StandaloneWindows64/StandaloneWindows64_Data/*"",g' WindowsInstaller64.iss
echo 'set build Data path'
sudo sed -i 's,Source: "EXAMPLEPATH/MonoBleedingEdge/*",Source: "${{ env.pathStartpoint }}/build/StandaloneWindows64/MonoBleedingEdge/*",g' WindowsInstaller64.iss
echo 'set monoBleedingEdge path'
echo 'Finished setting installer values'
less WindowsInstaller64.iss
echo downloading Inno
cd ~
sudo git clone https://github.com/jrsoftware/issrc.git is
cd is
sudo git submodule init
sudo git submodule update
sudo iscc ${{ env.pathStartpoint }}/build/WindowsInstaller64.iss
#Add another upload build artifact step to upload the windows installer
release-project:
name: release for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
needs: buildForAllSupportedPlatforms
strategy:
fail-fast: false
matrix:
targetPlatform:
#- StandaloneOSX # Build a macOS standalone (Intel 64-bit).
#- StandaloneWindows # Build a Windows standalone.
- StandaloneWindows64 # Build a Windows 64-bit standalone.
#- StandaloneLinux64 # Build a Linux 64-bit standalone.
#- iOS # Build an iOS player.
#- Android # Build an Android .apk standalone app.
#- WebGL # WebGL.
steps:
- name: Download Artifact
uses: actions/download-artifact#v3
with:
name: Build-${{ matrix.targetPlatform }}
- name: Archive Artifact Content
uses: thedoctor0/zip-release#master
with:
filename: ${{ matrix.targetPlatform }}.zip
- name: Create Github Release
id: create-new-release
uses: "marvinpinto/action-automatic-releases#latest" #NOTE: If this step breaks, it may be because the latest commit to marvinpinto/... broke the action. refactor this to use stable version instead of #latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}" # This token is provided by Actions, you do not need to create your own token
automatic_release_tag: "latest-${{ matrix.targetPlatform }}"
prerelease: false
title: "Release-${{ matrix.targetPlatform }}-v${{ github.run_number }}"
- name: Upload Release Asset Versioned #This attaches the built .zip file to the release with the version in the name
uses: actions/upload-release-asset#v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-new-release.outputs.upload_url }} # This pulls from the CREATE GITHUB RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./${{ matrix.targetPlatform }}.zip
asset_name: build_${{ matrix.targetPlatform }}-v${{ github.run_number }}.zip
asset_content_type: application/zip
- name: Upload Release Asset Static #This attaches the built .zip file to the release without the version in the name. This is good for a consitant download URL for sites
uses: actions/upload-release-asset#v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-new-release.outputs.upload_url }} # This pulls from the CREATE GITHUB RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./${{ matrix.targetPlatform }}.zip
asset_name: build_${{ matrix.targetPlatform }}-latest.zip
asset_content_type: application/zip

How to install cpanm with github action workflow with linux runner?

I am not able to install cpanm with this simple workflow:
name: linux-cpanm-test
on: [push, pull_request]
jobs:
build-dist:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout#v2
- name: perl info
run: |
perl --version
- name: install cpanm
run: cpan App::cpanminus
- name: test cpanm
run: cpanm -v Path::Tiny
Here is a link to the test repository. As can be seen, cpan App::cpanminus fails with:
Use of uninitialized value $_[0] in substitution (s///) at /usr/share/perl/5.30/File/Basename.pm line 341.
fileparse(): need a valid pathname at /usr/share/perl/5.30/CPAN/FirstTime.pm line 1413.
Error: Process completed with exit code 255.
Any ideas what can be the problem?
I've been using shogu82148/actions-setup-perl. That installs cpanm for me and I've never had any problems.
The jobs section of my workflow files look like this:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
perl: [ 'latest' ]
name: Perl ${{ matrix.perl }} on ${{ matrix.os }}
steps:
- uses: actions/checkout#v2
- name: Set up perl
uses: shogo82148/actions-setup-perl#v1
with:
perl-version: ${{ matrix.perl }}
- run: perl -V
- run: cpanm --installdeps .
- run: prove -lv t
In my Github workflows, I don't use cpan to install cpanminus. I've run into issues with openssl on the ubuntu hosts.
- name: Install cpanm and multiple modules
run: |
curl -L https://cpanmin.us | perl - App::cpanminus
cpanm --notest ...
But, I also break my workflows for different platforms into separate files. See PerlPowerTools/.github/workflows for instance. That one is not very complicated.
I don't spend the time to try to make them all act like each other—that's too much complexity. I don't want to debug someone's action when it's not doing exactly what I want. Also, when one platform has a problem, I can create a branch and trigger just that platform on that branch. You might be able to do that with a single file runner too, but that's too much complexity for me to want to manage.
Also, I've had lots of spurious failures with CPAN mirrors with a bare call to cpan. I've updated all of my actions to point to the CDN version of CPAN and haven't seen that problem since:
cpan -M https://www.cpan.org ...
And, lately I've been careful to install dependencies first using the "no test" features of either client. This mostly saves a lot of time. After that, I then run the tests for my module:
cpanm --notest ...
cpan -T ...
It seems that cpan App::cpanminus tries to install local::lib into /home/runner/perl5/. I tried to bootstrap local::lib manually to $GITHUB_WORKSPACE/perl5 instead. This seems to fix the problem (I am not sure why, but I guess it has to do with permissions):
name: linux-cpanm-test
on: [push, pull_request]
jobs:
build-dist:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout#v2
- name: perl info
run: |
perl --version
- name: setup locallib
run: |
tempdir=$(mktemp -d)
cd $tempdir
wget https://cpan.metacpan.org/authors/id/H/HA/HAARG/local-lib-2.000024.tar.gz
tar zxvf local-lib-2.000024.tar.gz
cd local-lib-2.000024
PERL_LOCAL_LIB_ROOT=$GITHUB_WORKSPACE/perl5
perl Makefile.PL --bootstrap=$PERL_LOCAL_LIB_ROOT
make
make test
echo "PERL_LOCAL_LIB_ROOT=$PERL_LOCAL_LIB_ROOT" >> $GITHUB_ENV
echo "PERL5LIB=$PERL_LOCAL_LIB_ROOT/lib/perl5" >> $GITHUB_ENV
echo "PERL_MB_OPT=--install_base \"$PERL_LOCAL_LIB_ROOT/\"" >> $GITHUB_ENV
echo "PERL_MM_OPT=INSTALL_BASE=$PERL_LOCAL_LIB_ROOT" >> $GITHUB_ENV
echo "PATH=$PERL_LOCAL_LIB_ROOT/bin:$PATH" >> $GITHUB_ENV
- name: install cpanm
run: cpan App::cpanminus
- name: test cpanm
run: cpanm -v Path::Tiny
Here is a link to the new build log, showing that it now works.
Edit:
Here is a simplified workflow file as suggested by #ikegami. This also works:
name: linux-cpanm-test
on: [push, pull_request]
jobs:
build-dist:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout#v2
- name: perl info
run: |
perl --version
- name: setup locallib
run: |
PERL_LOCAL_LIB_ROOT="$HOME/perl5"
>>"$GITHUB_ENV" echo "PERL_LOCAL_LIB_ROOT=$PERL_LOCAL_LIB_ROOT"
>>"$GITHUB_ENV" echo "PERL5LIB=$PERL_LOCAL_LIB_ROOT/lib/perl5"
>>"$GITHUB_ENV" echo "PERL_MB_OPT=--install_base \"$PERL_LOCAL_LIB_ROOT/\""
>>"$GITHUB_ENV" echo "PERL_MM_OPT=INSTALL_BASE=$PERL_LOCAL_LIB_ROOT"
>>"$GITHUB_ENV" echo "PATH=$PERL_LOCAL_LIB_ROOT/bin:$PATH"
- name: install cpanm
run: cpan App::cpanminus
- name: test cpanm
run: cpanm -v Path::Tiny
Here is the log.

/bin/sh: /packages/flutter_tools/bin/xcode_backend.sh: No such file or directory in github actions

when I build my project in github actions, shows this error:
/bin/sh: /packages/flutter_tools/bin/xcode_backend.sh: No such file or directory
in my local machine, it could build success. the is the log output:
+---------------+------------------------------+
| Build environment |
+---------------+------------------------------+
| xcode_path | /Applications/Xcode_11.7.app |
| gym_version | 2.172.0 |
| export_method | ad-hoc |
| sdk | iPhoneOS13.7.sdk |
+---------------+------------------------------+
[16:09:59]: ▸ export YACC=yacc
[16:09:59]: ▸ export arch=arm64
[16:09:59]: ▸ export variant=normal
[16:09:59]: ▸ /bin/sh -c /Users/runner/Library/Developer/Xcode/DerivedData/Runner-gzzbtgmsqethlzedjqlbspydxjjv/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-9740EEB61CF901F6004384FC.sh
[16:09:59]: ▸ /bin/sh: /packages/flutter_tools/bin/xcode_backend.sh: No such file or directory
[16:09:59]:
[16:09:59]: ⬆️ Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[16:09:59]: 📋 For the complete and more detailed error log, check the full log at:
[16:09:59]: 📋 /Users/runner/Library/Logs/gym/Runner-Runner.log
[16:09:59]:
[16:09:59]: Looks like fastlane ran into a build/archive error with your project
[16:09:59]: It's hard to tell what's causing the error, so we wrote some guides on how
[16:09:59]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[16:09:59]: Before submitting an issue on GitHub, please follow the guide above and make
[16:09:59]: sure your project is set up correctly.
[16:09:59]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[16:09:59]: the full commands printed out in yellow in the above log.
[16:09:59]: Make sure to inspect the output above, as usually you'll find more error information there
and this is my github action script:
name: Cruise-CI
on:
push:
branches: [ main ]
jobs:
build:
runs-on: macos-10.15
steps:
- uses: actions/checkout#v2
- uses: actions/setup-java#v1
with:
java-version: '12.x'
- uses: subosito/flutter-action#v1
with:
flutter-version: '1.22.5'
- name: Select Xcode version
run: sudo xcode-select -s '/Applications/Xcode_11.7.app/Contents/Developer'
- name: Bundle install
run: cd ./ios && flutter clean && gem install cocoapods -v 1.10.0 && bundle install && bundle update fastlane
- name: Install tools
run: |
flutter precache
flutter pub get
cd ./ios && pod repo update && pod install
#- run: flutter pub get
#- run: flutter build apk
#- run: flutter build ios --release --no-codesign
- name: Setup SSH Keys and known_hosts for fastlane match
run: |
SSH_PATH="$HOME/.ssh"
mkdir -p "$SSH_PATH"
touch "$SSH_PATH/known_hosts"
echo "$PRIVATE_KEY" > "$SSH_PATH/id_rsa"
chmod 700 "$SSH_PATH"
ssh-keyscan github.com >> ~/.ssh/known_hosts
chmod 600 "$SSH_PATH/known_hosts"
chmod 600 "$SSH_PATH/id_rsa"
eval $(ssh-agent)
ssh-add "$SSH_PATH/id_rsa"
env:
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Deploy to TestFlight/PGY
run: |
cd ./ios && security unlock-keychain ${HOME}/Library/Keychains/login.keychain && flutter clean && bundle exec fastlane beta
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
GIT_URL: ${{ secrets.GIT_URL }}
PGY_USER_KEY: ${{ secrets.PGY_USER_KEY }}
PGY_API_KEY: ${{ secrets.PGY_API_KEY }}
TEAM_ID: ${{ secrets.TEAM_ID }}
ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}
FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS: ${{ secrets.DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS }}
what should I do to fix it? I am searching from internet and tell me to set flutter_root,but I did not know how to set the variable in github action, seem it management by system and dit not need to set.