chore(deps): Bump the production-dependencies group across 1 directory with 6 updates #1694
Workflow file for this run
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: end to end tests | |
on: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
# Cancel previous workflows on branch push | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
e2e: | |
services: | |
postgres: | |
image: postgres:16.0 | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
runs-on: ubuntu-latest | |
env: | |
LOG_LEVEL: DEBUG | |
NO_COLOR: true | |
ORCHESTRATOR_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable | |
ORCHESTRATOR_MIGRATION_DIR: file://./server/standalone/migration/ | |
ORCHESTRATOR_TLS_ENABLED: false | |
ORCHESTRATOR_VERIFY_CLIENT_MSP_ID: false | |
ORCHESTRATOR_TX_RETRY_BUDGET: 500ms | |
DB_DUMPS_BUCKET_NAME: substra-orchestrator-dumps | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
- name: Get changed migration files | |
id: changed_migrations | |
uses: tj-actions/[email protected] | |
with: | |
files: server/standalone/migration/*.sql | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21.x | |
- name: Cache Go modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: build-${{ hashFiles('**/go.sum') }} | |
- name: Install protobuf codegen tool | |
run: | | |
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.18.1/protoc-3.18.1-linux-x86_64.zip | |
unzip protoc-3.18.1-linux-x86_64.zip -d $HOME/.local | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Install go tools | |
run: | | |
cd /tmp | |
go install google.golang.org/protobuf/cmd/[email protected] | |
go install google.golang.org/grpc/cmd/[email protected] | |
go install github.com/go-bindata/go-bindata/[email protected] | |
- name: Install db migration tool | |
run: | | |
wget -qO- https://github.com/golang-migrate/migrate/releases/download/v4.15.2/migrate.linux-amd64.tar.gz | tar xzf - -C $HOME/.local/bin | |
- name: Build orchestrator | |
run: make orchestrator | |
- name: Authenticate to Google Cloud | |
if: steps.changed_migrations.outputs.any_changed == 'true' || github.ref_type == 'tag' | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: '${{ secrets.GCP_BUCKET_SECRET }}' | |
- name: Set up Google Cloud CLI | |
if: steps.changed_migrations.outputs.any_changed == 'true' || github.ref_type == 'tag' | |
uses: google-github-actions/setup-gcloud@v2 | |
- name: Install psql | |
if: steps.changed_migrations.outputs.any_changed == 'true' || github.ref_type == 'tag' | |
uses: tj-actions/install-postgresql@v3 | |
with: | |
postgresql-version: 16 | |
- name: Wait for postgres | |
run: | | |
while ! $(nc localhost 5432 -z); do | |
sleep 2 | |
done | |
timeout-minutes: 1 | |
- name: Restore db dump from previous release | |
id: restore_db | |
if: steps.changed_migrations.outputs.any_changed == 'true' | |
run: | | |
LATEST_RELEASE_TAG=$(git tag -l | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$" | sort -V | tail -n 1) | |
gsutil cp gs://${DB_DUMPS_BUCKET_NAME}/${LATEST_RELEASE_TAG} dump.sql | |
psql $ORCHESTRATOR_DATABASE_URL < dump.sql | |
INITIAL_MIGRATION_VERSION=$(migrate -source "${ORCHESTRATOR_MIGRATION_DIR}" -database "${ORCHESTRATOR_DATABASE_URL}" version 2>&1 > /dev/null) | |
echo "::set-output name=initial_migration_version::$INITIAL_MIGRATION_VERSION" | |
- name: Migrate db up from previous release data | |
if: steps.changed_migrations.outputs.any_changed == 'true' | |
run: | | |
migrate -source "${ORCHESTRATOR_MIGRATION_DIR}" -database "${ORCHESTRATOR_DATABASE_URL}" up | |
- name: Setup channel configuration | |
run: | | |
cat << EOF > ${{runner.temp}}/config.yaml | |
--- | |
channels: | |
mychannel: | |
- MyOrg1MSP | |
- MyOrg2MSP | |
yourchannel: | |
- MyOrg1MSP | |
- MyOrg2MSP | |
EOF | |
- name: Run e2e tests on previous release data | |
if: steps.changed_migrations.outputs.any_changed == 'true' | |
env: | |
ORCHESTRATOR_CHANNEL_CONFIG: ${{runner.temp}}/config.yaml | |
run: | | |
./bin/orchestrator > server.prepopulated.run.log 2>&1 & | |
go test -tags=e2e ./e2e -v -short --failfast -server_addr localhost:9000 | |
- name: Migrate db down to previous release migration version | |
if: steps.changed_migrations.outputs.any_changed == 'true' | |
run: > | |
migrate | |
-source "${ORCHESTRATOR_MIGRATION_DIR}" | |
-database "${ORCHESTRATOR_DATABASE_URL}" | |
goto ${{ steps.restore_db.outputs.initial_migration_version }} | |
- name: Reset db | |
if: steps.changed_migrations.outputs.any_changed == 'true' | |
run: | | |
psql "$ORCHESTRATOR_DATABASE_URL" << EOF | |
DROP SCHEMA public CASCADE; | |
CREATE SCHEMA public; | |
EOF | |
- name: Migrate db up | |
run: | | |
migrate -source "${ORCHESTRATOR_MIGRATION_DIR}/" -database "${ORCHESTRATOR_DATABASE_URL}" up | |
- name: Run e2e tests | |
env: | |
ORCHESTRATOR_CHANNEL_CONFIG: ${{runner.temp}}/config.yaml | |
run: | | |
./bin/orchestrator > server.log 2>&1 & | |
go test -tags=e2e ./e2e -v -short --failfast -server_addr localhost:9000 | |
- name: Save db dump in GCS bucket | |
if: github.ref_type == 'tag' | |
run: | | |
pg_dump "$ORCHESTRATOR_DATABASE_URL" | gsutil cp - gs://${DB_DUMPS_BUCKET_NAME}/${GITHUB_REF_NAME} | |
- name: Archive server log | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: server-log | |
path: server*.log |