chore: output to local file in test #66
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# A test for the basic CLI usage. | |
- name: Running a single test | |
uses: ./ | |
with: | |
command: run ./test.yml | |
# The generated report must be available to the rest of the workflow. | |
- name: Generating the report | |
uses: ./ | |
with: | |
command: run ./test.yml --output ./report.json | |
- name: Access report | |
run: | | |
if [ ! -f ./report.json ]; then | |
echo "The generated report JSON file couldn't be accessed." | |
exit 1 | |
fi | |
# Supports custom working directory. | |
- name: Prepare custom directory | |
run: |- | |
mkdir ./my-dir | |
cp ./test.yml ./my-dir/cwd.yml | |
- name: Custom working directoery | |
uses: ./ | |
with: | |
command: run ./cwd.yml | |
working-directory: ./my-dir | |
- name: Cleanup | |
run: rm -rf ./my-dir | |
# Supports custom Artillery binary path. | |
# Useful to test against intermediate builds of Artillery. | |
- name: Prepare custom binary | |
run: |- | |
echo 'echo "$1" >> ./output.txt' >> ./custom-binary.sh | |
chmod +x ./custom-binary.sh | |
- name: Supports custom Artillery binary | |
uses: ./ | |
with: | |
command: hello | |
env: | |
ARTILLERY_BINARY_PATH: ./custom-binary.sh | |
- name: Check the output | |
run: '[[ "$(cat ./output.txt)" == "hello" ]] || exit 1' | |
- name: Cleanup | |
run: rm ./custom-binary.sh | |
release: | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: [test] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Release | |
id: release | |
uses: google-github-actions/release-please-action@v3 | |
with: | |
release-type: node | |
package-name: action-run | |
pull-request-title-pattern: "chore: release${component} ${version}" | |
- name: Update release tags | |
if: ${{ steps.release.outputs.release_created }} | |
run: | | |
git config user.name artillery-bot | |
git config user.email team@artillery.io | |
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git" | |
git tag -d v${{ steps.release.outputs.major }} || true | |
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true | |
git push origin :v${{ steps.release.outputs.major }} || true | |
git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true | |
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}" | |
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}" | |
git push origin v${{ steps.release.outputs.major }} | |
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} |