test: gc #38
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: | |
build: | |
name: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ^1.22 | |
cache-dependency-path: "**/go.sum" | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: deps | |
run: make deps | |
- name: build | |
run: make build | |
publish: | |
name: publish | |
runs-on: ubuntu-latest | |
needs: build | |
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 . | |
docker push ${{ secrets.DOCKER_USERNAME }}/rinha-2024q1-api | |
- name: publish bouncer | |
run: | | |
docker build -t ${{ secrets.DOCKER_USERNAME }}/rinha-2024q1-bouncer -f Dockerfile.bouncer . | |
docker push ${{ secrets.DOCKER_USERNAME }}/rinha-2024q1-bouncer | |
load-test: | |
name: load-test | |
runs-on: ubuntu-latest | |
needs: build | |
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-rinha-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 | |
# container-test: | |
# name: container-test | |
# runs-on: ubuntu-latest | |
# needs: publish | |
# steps: | |
# - name: checkout | |
# uses: actions/checkout@v4 | |
# - name: test | |
# run: | | |
# docker-compose -f ./docker-compose-rinha-final.yml up -d | |
# for i in {1..20}; do | |
# curl --fail http://localhost:9999/clientes/1/extrato && \ | |
# echo "" && \ | |
# break || sleep 2; | |
# done |