ci #24
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: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'docs/**' | |
- '*.md' | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
env: | |
RINHA_GATLING_VERSION: 3.10.3 | |
RINHA_DIR: rinha-de-backend-2024-q1 | |
jobs: | |
publish: | |
name: publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: docker login | |
run: | | |
echo ${{ secrets.DOCKER_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
- name: publish api | |
run: | | |
docker build -t ${{ secrets.DOCKER_USERNAME }}/rinha-2024q1-api-nodejs . | |
docker push ${{ secrets.DOCKER_USERNAME }}/rinha-2024q1-api-nodejs | |
load-test: | |
name: load-test | |
runs-on: ubuntu-latest | |
needs: publish | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: running everything | |
run: docker-compose -f docker-compose-final.yml up --build --force-recreate -d | |
- name: test | |
run: | | |
git clone --depth 1 --single-branch -b main https://github.com/zanfranceschi/rinha-de-backend-2024-q1.git | |
wget -P $RINHA_DIR https://repo1.maven.org/maven2/io/gatling/highcharts/gatling-charts-highcharts-bundle/$RINHA_GATLING_VERSION/gatling-charts-highcharts-bundle-$RINHA_GATLING_VERSION-bundle.zip | |
unzip -d $RINHA_DIR $RINHA_DIR/gatling-charts-highcharts-bundle-$RINHA_GATLING_VERSION-bundle.zip | |
./bin/executar-teste-local | |
echo GATLING_REPORT=$(ls $RINHA_DIR/load-test/user-files/results | sort | head -n 1) >> $GITHUB_ENV | |
- name: fix permissions | |
run: | | |
chmod -c -R +rX "_site/" | while read line; do | |
echo "::warning title=Invalid file permissions automatically fixed::$line" | |
done | |
- name: upload test results | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ${{ env.RINHA_DIR }}/load-test/user-files/results/${{ env.GATLING_REPORT }} | |
retention-days: 2 | |
- name: deploy results | |
id: deployment | |
uses: actions/deploy-pages@v4 |