name: Locust
on:
push:
branches:
- dev-master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout#v1
- name: Run Load Test
uses: apardo04/locust-github-action#master
with:
locust-file: "locustfile.py"
URL: "https://mywebsite.com"
USERS: "5"
RATE: "1"
RUNTIME: "10s"
- name: Upload Locust report
uses: actions/upload-artifact#v2
with:
name: locust-report
path: locust_report.html
I used that script. But not out put the result. The error is "No files were found with the provided path: locust_report.html. No artifacts will be uploaded." Please, let me know any issue.
Let me know your if you have these issue.
Related
I have this reusable workflow:
`
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v3
- uses: actions/setup-python#v3
with:
python-version: '3.8'
- uses: aws-actions/setup-sam#v2
- name: build
run: sam build --beta-features
`
I call this workflow with a matrix from outside. However the setup=-sam#v2 is taking a lot of time: around 26secs. Is it possible to cache this between matrix runs?
Thanks
Trying to fasten the setup of sam in github workflow
Matrix strategy is used per job, so one possibility is to pull this
- name: build
run: sam build --beta-features
into a separate job instance. Then you will use with matrix strategy only this part:
- name: build
run: sam build --beta-features
If you want to use caching try sth like:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v3
- uses: actions/setup-python#v3
with:
python-version: '3.8'
- name: Cache sam
id: cache-sam
uses: actions/cache#v3
with:
path: <specify the path>
key: ${{ runner.os }}-sam
- uses: aws-actions/setup-sam#v2
if: steps.cache-sam.outputs.cache-hit != 'true'
- name: build
run: sam build --beta-features
However, we have to provide a path in the above code snipped. Maybe the installation path will be good.
Please check out the following links:
https://github.com/actions/cache
How do I cache steps in GitHub actions?
As the title suggests, I am building a MEVN (Vue) Stack application and am facing this issue:
Earlier to this, I had been only building the frontedn part of my app & it was successfully getting deployed. Only when did I integrate my backend & changed the folder structure a bit, did I start getting these errors.
Below is my Deploy.yml :
name: Deploy
on:
push:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout#v2
- name: Setup Node
uses: actions/setup-node#v1
with:
node-version: 16
- name: Install dependencies
uses: bahmutov/npm-install#v1
- name: Build project
run: npm run build --prefix client
- name: Upload production-ready build files
uses: actions/upload-artifact#v2
with:
name: production-files
path: ./dist
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Download artifact
uses: actions/download-artifact#v2
with:
name: production-files
path: ./dist
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages#v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
Please help.
I am using Actions to compile an executable and then upload it:
name: note
on: push
jobs:
cli:
runs-on: windows-latest
defaults:
run:
working-directory: ./cli
steps:
- uses: actions/checkout#master
- run: go build -v
- run: dir
- name: upload cli.exe
uses: actions/upload-artifact#v2
with:
name: cli.exe
path: cli.exe
This results in:
The dir command shows that cli.exe is there, but it seems that I do not address it correctly for the upload. How to fix that?
The path of the upload must be provided from the root of the checked-out repo. In my case, the upload section needs therefore to be
- name: upload cli.exe
uses: actions/upload-artifact#v2
with:
name: cli.exe
path: cli/cli.exe
In other words, actions/upload-artifact does not take into account the working-directory setting.
Switching from Travis CI to GitHub Actions, I was wondering if there is a way to share common steps between jobs. For a project, I need each job to start with 3 actions: check out repository code, install Node.js v12, restore node_modules from the cache (if available). Actually I have added these 3 actions for each job, which works but is a bit verbose. Is there a way to say: "Each job must run these actions first" or something like that?
name: ci
on: [push, workflow_dispatch]
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout#v2
- name: Setup node
uses: actions/setup-node#v2
with:
node-version: '12'
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache#v2
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
run: npm install
test_mysql:
runs-on: ubuntu-latest
needs: setup
steps:
- name: Check out repository code
uses: actions/checkout#v2
- name: Setup node
uses: actions/setup-node#v2
with:
node-version: '12'
- name: Restore node_modules
id: cache-node-modules
uses: actions/cache#v2
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Test MySQL 5
run: npm run test-mysql
env:
DOCKER_MYSQL_TAG: 5
- name: Test MySQL 8
run: npm run test-mysql
env:
DOCKER_MYSQL_TAG: 8
test_postgres:
runs-on: ubuntu-latest
needs: setup
steps:
- name: Check out repository code
uses: actions/checkout#v2
- name: Setup node
uses: actions/setup-node#v2
with:
node-version: '12'
- name: Restore node_modules
id: cache-node-modules
uses: actions/cache#v2
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Test Postgres 10
run: npm run test-postgres
env:
DOCKER_POSTGRES_TAG: 10
- name: Test Postgres 11
run: npm run test-postgres
env:
DOCKER_POSTGRES_TAG: 11
- name: Test Postgres 12
run: npm run test-postgres
env:
DOCKER_POSTGRES_TAG: 12
test_mariadb:
runs-on: ubuntu-latest
needs: setup
steps:
- name: Check out repository code
uses: actions/checkout#v2
- name: Setup node
uses: actions/setup-node#v2
with:
node-version: '12'
- name: Restore node_modules
id: cache-node-modules
uses: actions/cache#v2
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Test MariaDB 10.4
run: npm run test-mariadb
env:
DOCKER_MARIADB_TAG: 10.4.12
test_mssql:
runs-on: ubuntu-latest
needs: setup
steps:
- name: Check out repository code
uses: actions/checkout#v2
- name: Setup node
uses: actions/setup-node#v2
with:
node-version: '12'
- name: Restore node_modules
id: cache-node-modules
uses: actions/cache#v2
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Test MSSQL 2017
run: npm run test-mssql
env:
DOCKER_MSSQL_TAG: 2017-CU17-ubuntu
- name: Test MSSQL 2019
run: npm run test-mssql
env:
DOCKER_MSSQL_TAG: 2019-latest
test_sqlite:
runs-on: ubuntu-latest
needs: setup
steps:
- name: Check out repository code
uses: actions/checkout#v2
- name: Setup node
uses: actions/setup-node#v2
with:
node-version: '12'
- name: Restore node_modules
id: cache-node-modules
uses: actions/cache#v2
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Test SQLite
run: npm run test-sqlite
publish:
runs-on: ubuntu-latest
needs: [test_mysql, test_postgres, test_mariadb, test_mssql, test_sqlite]
steps:
- name: Check out repository code
uses: actions/checkout#v2
- name: Setup node
uses: actions/setup-node#v2
with:
node-version: '12'
- name: Restore node_modules
id: cache-node-modules
uses: actions/cache#v2
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Build
run: npm run build
- name: Check version changes
uses: EndBug/version-check#v1
id: check
- name: Publish
if: steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/master'
run: |
npm set registry "https://registry.npmjs.org"
npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_PUBLISH_TOKEN }}
npm publish
Now is possible to use uses in composite actions - please check this link
Composite action:
name: "Publish to Docker"
description: "Pushes built artifacts to Docker"
inputs:
registry_username:
description: “Username for image registry”
required: true
registry_password:
description: “Password for image registry”
required: true
runs:
using: "composite"
steps:
- uses: docker/setup-buildx-action#v1
- uses: docker/login-action#v1
with:
username: ${{inputs.registry_username}}
password: ${{inputs.registry_password}}
- uses: docker/build-push-action#v2
with:
context: .
push: true
tags: user/app:latest
And then:
on: [push]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- uses: my-org/publish-docker#v1
with:
registry_username: ${{secrets.REGISTRY_USERNAME}}
registry_password: ${{secrets.REGISTRY_PASSWORD}}
Original reply:
It looks that at the moment is not possible if among steps you want to share are uses.
It should be handled by composite actions but
What does composite run steps currently support?
For each run step in a composite action, we support:
name
id
run
env
shell
working-directory
In addition, we support mapping input and outputs throughout the action.
See docs for more info.
What does Composite Run Steps Not Support
We don't support setting conditionals, continue-on-error, timeout-minutes, "uses", and secrets on individual steps within a composite action right now.
I get error: "a step cannot have both the uses and run keys", but I don't see that one step have both uses and run. Can someone help me figure it out what is wrong with this?
on:
pull_request:
branches:
- master
env:
IMAGE_NAME: api
jobs:
build:
name: Application build
runs-on: ubuntu-latest
steps:
- name: Checkout repository (#1)
uses: actions/checkout#v2
- name: Setup .NET Core
uses: actions/setup-dotnet#v1
with:
dotnet-version: 3.1.101
- name: Build API
run: dotnet build --configuration Release
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository (#2)
uses: actions/checkout#v2
- name: Setup .NET Core
uses: actions/setup-dotnet#v1
with:
dotnet-version: 3.1.101
- name: Run API Tests
run: dotnet test
auto-approve:
name: Auto approve pull request
runs-on: ubuntu-latest
steps:
- uses: hmarr/auto-approve-action#v2.0.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
automerge:
runs-on: ubuntu-latest
steps:
- name: automerge
uses: "pascalgn/automerge-action#ccae530ae13b6af67a7a2009c266fe925844e658"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
docker-build:
runs-on: ubuntu-latest
steps:
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
docker-deploy:
runs-on: ubuntu-latest
steps:
- name: Push Docker image to registry
uses: jerray/publish-docker-action#master
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: docker.pkg.github.com
repository: jerray/publish-docker-action
auto_tag: true