deps: bump actions/checkout to v4

Signed-off-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
Rui Chen 2023-09-16 16:27:09 -04:00 committed by lepapareil
parent 8a20848e0d
commit e8abb73955
No known key found for this signature in database
GPG Key ID: F4F06B068FB00692
9 changed files with 69 additions and 74 deletions

View File

@ -11,7 +11,7 @@ jobs:
accept-pull-request:
if: ${{ github.event.issue.pull_request && (github.event.comment.body == '/accept' || github.event.comment.body == '/accept --force') }}
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
GITHUB_CONTEXT: ${{ toJson(github) }}
GITHUB_TOKEN: ${{ secrets.HURL_BOT_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
@ -40,7 +40,7 @@ jobs:
- name: Init all internal env vars
id: init-all-internal-env-vars
env:
env:
TITLE: ${{ github.event.issue.title }}
run: |
pr_detail_file="pr_detail.json"
@ -53,7 +53,7 @@ jobs:
HEAD_TYPE=origin
else
HEAD_TYPE=fork
fi
fi
echo "HEAD_REPO_FULL_NAME=${HEAD_REPO_FULL_NAME}" | tee -a "${GITHUB_ENV}"
echo "BASE_REPO_FULL_NAME=${BASE_REPO_FULL_NAME}" | tee -a "${GITHUB_ENV}"
echo "HEAD_TYPE=${HEAD_TYPE}" | tee -a "${GITHUB_ENV}"
@ -62,12 +62,12 @@ jobs:
echo "PR_STATE=$(jq -rc .state ${pr_detail_file})" | tee -a "${GITHUB_ENV}"
echo "PR_DRAFT=$(jq -rc .draft ${pr_detail_file})" | tee -a "${GITHUB_ENV}"
echo "PR_MERGEABLE=$(jq -rc .mergeable ${pr_detail_file})" | tee -a "${GITHUB_ENV}"
echo "REMAINING_COMMITS_FILE=remaining_commits.txt" | tee -a "${GITHUB_ENV}"
echo "REMAINING_COMMITS_FILE=remaining_commits.txt" | tee -a "${GITHUB_ENV}"
echo "NEW_COMMITS_FILE=new_commits.txt" | tee -a "${GITHUB_ENV}"
echo "base_ref=$(jq -rc .base.ref ${pr_detail_file})" | tee -a "${GITHUB_OUTPUT}"
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ env.BASE_REF }}
token: ${{ secrets.HURL_BOT_TOKEN }}
@ -119,7 +119,7 @@ jobs:
comment="❌ Can not merge this pull request because it is still in draft."
echo " - ${comment}"
gh pr comment "${PR_NUMBER}" --body "${comment}"
exit 1
exit 1
fi
- name: Check if pull request is mergeable
@ -130,7 +130,7 @@ jobs:
comment="❌ Pull request is not mergeable, please check unresolved discussions and pull request messages."
echo " - ${comment}"
gh pr comment "${PR_NUMBER}" --body "${comment}"
exit 1
exit 1
fi
- name: Check GitHub release
@ -159,7 +159,7 @@ jobs:
fi
fi
- name: Check if source branch is rebased from target branch
- name: Check if source branch is rebased from target branch
run: |
git log --oneline --cherry ${{ env.HEAD_TYPE }}/${{ env.HEAD_REF }}...origin/${{ env.BASE_REF }} > "${{ env.REMAINING_COMMITS_FILE }}" && exit_code=0 || exit_code=1
if [ ${exit_code} -eq 1 ] ; then
@ -175,7 +175,7 @@ jobs:
if [ ${{ env.HEAD_TYPE }} == "fork" ] ; then
comment="❌ You have to rebase \`${{ env.HEAD_REPO_FULL_NAME}}/${{ env.HEAD_REF }}\` branch because there are new commits pending on target \`${{ env.BASE_REPO_FULL_NAME}}/${{ env.BASE_REF }}\` branch (sorry i can't auto rebase from a fork):<br>$(echo ; sed "s/+/-/g" ${{ env.REMAINING_COMMITS_FILE }})"
echo " - ${comment}"
gh pr comment "${PR_NUMBER}" --body "${comment}"
gh pr comment "${PR_NUMBER}" --body "${comment}"
exit 1
fi
git fetch
@ -186,8 +186,8 @@ jobs:
if [ ${exit_code} -eq 1 ] ; then
comment="❌ Auto rebase from \`${{ env.BASE_REPO_FULL_NAME}}/${{ env.BASE_REF }}\` fails due to conflicts. Sorry but you have to manage this manually. Please refer to ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} logs."
echo " - ${comment}"
gh pr comment "${PR_NUMBER}" --body "${comment}"
exit 1
gh pr comment "${PR_NUMBER}" --body "${comment}"
exit 1
fi
git push --force && exit_code=0 || exit_code=1
if [ ${exit_code} -eq 0 ] ; then
@ -205,7 +205,7 @@ jobs:
else
comment="❌ Auto rebase from \`${{ env.BASE_REPO_FULL_NAME}}/${{ env.BASE_REF }}\` fails on `git push --force`. Please refer to ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} logs."
echo " - ${comment}"
gh pr comment "${PR_NUMBER}" --body "${comment}"
gh pr comment "${PR_NUMBER}" --body "${comment}"
fi
git switch ${{ env.BASE_REF }}
fi
@ -223,7 +223,7 @@ jobs:
exit 1
fi
- name: Check if source branch is rebased from target branch
- name: Check if source branch is rebased from target branch
run: |
git pull
git log --oneline --cherry ${{ env.HEAD_TYPE }}/${{ env.HEAD_REF }}...origin/${{ env.BASE_REF }} > "${{ env.REMAINING_COMMITS_FILE }}" && exit_code=0 || exit_code=1
@ -240,7 +240,7 @@ jobs:
if [ ${{ env.HEAD_TYPE }} == "fork" ] ; then
comment="❌ New commits have been pushed to \`${{ env.BASE_REPO_FULL_NAME}}/${{ env.BASE_REF }}\` since you accept this PR. You have to rebase \`${{ env.HEAD_REPO_FULL_NAME}}/${{ env.HEAD_REF }}\` branch by yourself because i can't auto rebase from a fork.<br>Pending commits:<br>$(echo ; sed "s/+/-/g" ${{ env.REMAINING_COMMITS_FILE }})"
echo " - ${comment}"
gh pr comment "${PR_NUMBER}" --body "${comment}"
gh pr comment "${PR_NUMBER}" --body "${comment}"
exit 1
else
comment="❌ New commits have been pushed to \`${{ env.BASE_REPO_FULL_NAME}}/${{ env.BASE_REF }}\` since you accept this PR. You can rebase it by yourself or simply re-accept this PR to execute an auto rebase.<br>Pending commits:<br>$(echo ; sed "s/+/-/g" ${{ env.REMAINING_COMMITS_FILE }})"
@ -254,7 +254,7 @@ jobs:
run: |
git log --oneline --cherry origin/${{ env.BASE_REF }}...${{ env.HEAD_TYPE }}/${{ env.HEAD_REF }} | tee ${{ env.NEW_COMMITS_FILE }}
- name: Merge fast forward head ref to base ref
- name: Merge fast forward head ref to base ref
run: |
git merge ${{ env.HEAD_TYPE }}/${{ env.HEAD_REF }} --ff-only && exit_code=0 || exit_code=1
if [ ${exit_code} -eq 0 ] ; then
@ -263,7 +263,7 @@ jobs:
comment="❌ Merge fast forward fails. Please refer to ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} logs."
echo " - ${comment}"
gh pr comment "${PR_NUMBER}" --body "${comment}"
exit 1
exit 1
fi
git push && exit_code=0 || exit_code=1
if [ ${exit_code} -eq 0 ] ; then
@ -272,22 +272,22 @@ jobs:
comment="❌ Push merge fast forward fails. Please refer to ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} logs."
echo " - ${comment}"
gh pr comment "${PR_NUMBER}" --body "${comment}"
exit 1
exit 1
fi
- name: Close pull request
run: |
if [[ "${PR_COMMENT}" =~ "--force" ]] ; then
comment="✅ Pull request merged without waiting for checks and closed by \`${COMMENT_USER_LOGIN}\` with fast forward merge."
comment="✅ Pull request merged without waiting for checks and closed by \`${COMMENT_USER_LOGIN}\` with fast forward merge."
else
comment="✅ Pull request merged and closed by \`${COMMENT_USER_LOGIN}\` with fast forward merge."
fi
gh pr close "${PR_NUMBER}" --delete-branch --comment "${comment}.<br><br>\# List of commits merged from \`${{ env.HEAD_REPO_FULL_NAME}}/${{ env.HEAD_REF }}\` branch into \`${{ env.BASE_REPO_FULL_NAME}}/${{ env.BASE_REF }}\` branch:<br>$(echo ; sed "s/+/-/g" ${{ env.NEW_COMMITS_FILE }})" && exit_code=0 || exit_code=1
if [ ${exit_code} -eq 0 ] ; then
echo " - ${comment}"
echo " - ${comment}"
else
comment="❌ A problem occurred when closing pull request and/or deleting branch."
echo " - ${comment}"
#gh pr comment "${PR_NUMBER}" --body "${comment} Please refer to ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} logs."
#exit 1
#exit 1
fi

View File

@ -20,7 +20,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
@ -57,7 +57,7 @@ jobs:
- name: Check Rust version
if: always()
run: bin/check/rust_version.py 7
- name: Rustfmt
if: always()
run: bin/check/rustfmt.sh

View File

@ -16,7 +16,7 @@ jobs:
rust: [stable]
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Environment
run: bin/environment.sh
@ -42,7 +42,7 @@ jobs:
export PATH="$PWD/target/debug:$PATH"
bin/test/test_integ.sh
- name: Build Report
run: |
run: |
grcov . --binary-path target/debug -s . -t html --branch --ignore-not-existing -o ./coverage/
- name: Init git bot context
@ -73,4 +73,3 @@ jobs:
path: |
coverage
*.profraw

View File

@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Install Python 3.10
@ -68,7 +68,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Retrieve release-generic-linux-x64-artifacts
@ -119,7 +119,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Retrieve release-generic-linux-x64-artifacts
@ -170,7 +170,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Retrieve release-generic-linux-x64-artifacts
@ -220,7 +220,7 @@ jobs:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
# uses: actions/checkout@v4
# with:
# ref: ${{ inputs.branch }}
# - name: Set up Docker Buildx
@ -294,7 +294,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Set up Docker Buildx
@ -365,7 +365,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Install Python 3.10
@ -415,7 +415,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Install Prerequisites
@ -456,7 +456,7 @@ jobs:
with:
name: release-macos-x64-artifacts
path: target/upload/*
package-windows-x64:
runs-on: windows-latest
env:
@ -467,7 +467,7 @@ jobs:
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Manage vcpkg cache
@ -509,4 +509,3 @@ jobs:
path: |
.\target\win-package\hurl-*-installer.exe
.\target\win-package\hurl-*-win64.zip

View File

@ -53,7 +53,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Check release pull request existence
id: check-release-pull-request-existence
@ -169,7 +169,7 @@ jobs:
steps:
- name: Checkout repository
if: github.ref_name == 'master'
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Create release branch
if: github.ref_name == 'master'
@ -185,7 +185,7 @@ jobs:
fi
- name: Checkout new release branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ needs.set-context.outputs.release_branch }}
@ -204,7 +204,7 @@ jobs:
echo " > package version for ${cargo_toml}"
echo " $(grep "^version =" "${cargo_toml}")"
for dep_package in ${hurl_packages} ; do
if [ $(grep -c "^${dep_package} =" "${cargo_toml}") -gt 0 ] ; then
if [ $(grep -c "^${dep_package} =" "${cargo_toml}") -gt 0 ] ; then
sed -i "s/^${dep_package} = { version .*/${dep_package} = { version = \"${{ needs.set-context.outputs.release_version }}\", path = \"..\/${dep_package}\" }/" "${cargo_toml}"
echo " > ${dep_package} dep package version for ${cargo_toml}"
echo " $(grep "^${dep_package} =" "${cargo_toml}")"
@ -295,7 +295,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout new release branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ needs.set-context.outputs.release_branch }}

View File

@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Install Prerequisites
@ -27,10 +27,10 @@ jobs:
- name: Install python3 venv
run: |
bin/install_python3_venv.sh
export PATH=/tmp/hurl-python3-venv/bin:$PATH
export PATH=/tmp/hurl-python3-venv/bin:$PATH
which python3
python3 --version
pip --version
pip --version
- name: Install Rust
run: bin/install_rust.sh
- name: Environment
@ -56,12 +56,12 @@ jobs:
rust: [stable]
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Install Python 3.10
uses: actions/setup-python@v4
with:
- name: Install Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Prerequisites
run: bin/install_prerequisites_ubuntu.sh
@ -102,7 +102,7 @@ jobs:
rust: [stable]
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Install Python 3.10
@ -145,7 +145,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Build, Test units and Integration tests
@ -186,7 +186,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Build, Test units and Integration tests
@ -231,7 +231,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Build, Test units and Integration tests
@ -281,7 +281,7 @@ jobs:
rust: [stable]
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Install Prerequisites
@ -332,7 +332,7 @@ jobs:
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Manage vcpkg cache
@ -350,7 +350,7 @@ jobs:
run: .\bin\environment.ps1
- name: Install Prerequisites
run: .\bin\install_prerequisites_windows.ps1
- name: Build and test
- name: Build and test
run: .\bin\test\test.ps1
- name: Archive production artifacts
uses: actions/upload-artifact@v3
@ -359,4 +359,3 @@ jobs:
name: tests-win64-${{ matrix.rust }}-artifacts
path: |
./**/*.log

View File

@ -47,11 +47,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Init bot branch name
- name: Init bot branch name
run: |
base=$(echo "${{ github.ref }}" | sed "s#refs/heads/##g" | tr '/' '-')
echo "BOT_UPDATE_VERSION_BRANCHE_NAME=bot/update-branch-version-${base}" | tee -a $GITHUB_ENV
@ -66,7 +66,7 @@ jobs:
echo " > package version for ${cargo_toml}"
echo " $(grep "^version =" "${cargo_toml}")"
for dep_package in ${hurl_packages} ; do
if [ $(grep -c "^${dep_package} =" "${cargo_toml}") -gt 0 ] ; then
if [ $(grep -c "^${dep_package} =" "${cargo_toml}") -gt 0 ] ; then
sed -i "s/^${dep_package} = { version .*/${dep_package} = { version = \"${{ inputs.new_version }}\", path = \"..\/${dep_package}\" }/" "${cargo_toml}"
echo " > ${dep_package} dep package version for ${cargo_toml}"
echo " $(grep "^${dep_package} =" "${cargo_toml}")"
@ -127,4 +127,3 @@ jobs:
echo " - ❌ A problem occurs when attempting to create new pull request."
exit 1
fi

View File

@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: master
@ -124,4 +124,3 @@ jobs:
echo " - ❌ A problem occurs when attempting to add labels into new pull request n°${NEW_PR_NUMBER}."
exit 1
fi

View File

@ -1,7 +1,7 @@
# CI/CD Integration
Up until now, we have run our test files locally. Now, we want to integrate them in a CI/CD pipeline
(like [GitHub Actions] or [GitLab CI/CD pipelines]). As Hurl is very fast, we're going to run our tests on each commit
Up until now, we have run our test files locally. Now, we want to integrate them in a CI/CD pipeline
(like [GitHub Actions] or [GitLab CI/CD pipelines]). As Hurl is very fast, we're going to run our tests on each commit
of our project, drastically improving the project quality.
A typical web project pipeline is:
@ -16,15 +16,15 @@ In this workflow, we're testing the same image that will be used and deployed in
> only run integration tests on a prebuilt Docker image. To check a complete
> project with build, Docker upload/publish and integration tests, go to <https://github.com/jcamiel/hurl-express-tutorial>
In a first step, we're going to write a shell script that will pull our Docker image, launch it and run Hurl tests
against it. Once we have checked that this script runs locally, we'll see how to run it automatically in a CI/CD
In a first step, we're going to write a shell script that will pull our Docker image, launch it and run Hurl tests
against it. Once we have checked that this script runs locally, we'll see how to run it automatically in a CI/CD
pipeline.
## Templating Tests
Before writing our test script, we're going to template our Hurl files so we can run them more easily in various
configuration. One way to do this is to use [variables]. We've already seen variables when [chaining requests],
Before writing our test script, we're going to template our Hurl files so we can run them more easily in various
configuration. One way to do this is to use [variables]. We've already seen variables when [chaining requests],
we're going to see how we can use them to inject data.
In the file `basic.hurl`, we first test the home page:
@ -36,7 +36,7 @@ GET http://localhost:3000
# ...
```
We've hardcoded our server's URL but what if we need to run the same test on another URL (against production
We've hardcoded our server's URL but what if we need to run the same test on another URL (against production
URL with HTTPS for example)? We can use a variable like this:
```hurl
@ -54,7 +54,7 @@ $ hurl --variable host=http://localhost:3000 --test basic.hurl
This way, our host is not hardcoded any more and we can run our tests in various configurations.
1. Replace `http://localhost:3000` by `{{host}}` in `basic.hurl`, `login.hurl` and `signup.hurl` and test that everything is ok
1. Replace `http://localhost:3000` by `{{host}}` in `basic.hurl`, `login.hurl` and `signup.hurl` and test that everything is ok
```shell
$ hurl --variable host=http://localhost:3000 --test *.hurl
@ -124,7 +124,7 @@ $ docker stop movies
movies
```
Now, we have a basic script that starts our container. Before adding our integration tests, we need to ensure that our
Now, we have a basic script that starts our container. Before adding our integration tests, we need to ensure that our
application server is ready: the container has started, but the application server can take a few seconds to be
really ready to accept incoming HTTP requests.
@ -266,7 +266,7 @@ jobs:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build
run: echo "Building app..."
- name: Integration test
@ -345,7 +345,7 @@ Counting objects: 100% (7/7), done.
...
```
Next, we are going to add a GitLab CI/CD pipeline. The purpose of this pipeline will be to launch our integration
Next, we are going to add a GitLab CI/CD pipeline. The purpose of this pipeline will be to launch our integration
script on each commit. We'll base our image on a Docker based image, with a [Docker-In-Docker service].
3. Create a file `.gitlab-ci.yml`:
@ -364,7 +364,7 @@ build:
- bin/integration.sh http://docker:3000
```
> Because of Docker-In-Docker, our server is accessible with the `docker` hostname (and not `localhost`). As we have
> Because of Docker-In-Docker, our server is accessible with the `docker` hostname (and not `localhost`). As we have
> made our script configurable, we can just pass the hostname and don't modify our integration script