From ffaba87b406f31fcf30e72b831f013ad353b391d Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Tue, 25 Jan 2022 16:06:47 -0700 Subject: [PATCH] Separate out GitHub Actions --- .github/workflows/abs_integration_test.yml | 25 ++++ .github/workflows/build_and_test.yml | 25 ++++ .github/workflows/commit.yml | 127 ------------------ .github/workflows/gcp_integration_test.yml | 30 +++++ .github/workflows/long_running_test.yml | 23 ++++ .github/workflows/s3_integration_test.yml | 28 ++++ .../workflows/sftp_integration_test.yml.bak | 34 +++++ 7 files changed, 165 insertions(+), 127 deletions(-) create mode 100644 .github/workflows/abs_integration_test.yml create mode 100644 .github/workflows/build_and_test.yml delete mode 100644 .github/workflows/commit.yml create mode 100644 .github/workflows/gcp_integration_test.yml create mode 100644 .github/workflows/long_running_test.yml create mode 100644 .github/workflows/s3_integration_test.yml create mode 100644 .github/workflows/sftp_integration_test.yml.bak diff --git a/.github/workflows/abs_integration_test.yml b/.github/workflows/abs_integration_test.yml new file mode 100644 index 0000000..991ecec --- /dev/null +++ b/.github/workflows/abs_integration_test.yml @@ -0,0 +1,25 @@ +name: Azure Blob Store Integration Tests +on: pull_request + +jobs: + abs-integration-test: + name: Run Integration Tests + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-go@v2 + with: + go-version: '1.17' + + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ inputs.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ inputs.os }}-go- + + - run: go test -v -run=TestReplicaClient ./integration -replica-type abs + env: + LITESTREAM_ABS_ACCOUNT_NAME: ${{ secrets.LITESTREAM_ABS_ACCOUNT_NAME }} + LITESTREAM_ABS_ACCOUNT_KEY: ${{ secrets.LITESTREAM_ABS_ACCOUNT_KEY }} + LITESTREAM_ABS_BUCKET: integration diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml new file mode 100644 index 0000000..34565a7 --- /dev/null +++ b/.github/workflows/build_and_test.yml @@ -0,0 +1,25 @@ +name: "Build and Unit Test" +on: pull_request + +jobs: + build: + name: Build + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-go@v2 + with: + go-version: '1.17' + + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ inputs.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ inputs.os }}-go- + + - name: Build binary + run: go install ./cmd/litestream + + - name: Run unit tests + run: make testdata && go test -v ./... diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml deleted file mode 100644 index e58491a..0000000 --- a/.github/workflows/commit.yml +++ /dev/null @@ -1,127 +0,0 @@ -on: push - -jobs: - build: - name: Build & Unit Test - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: '1.17' - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ inputs.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: ${{ inputs.os }}-go- - - - run: go env - - - run: go install ./cmd/litestream - - - run: make testdata - - run: go test -v ./... - - - name: Build integration test - run: go test -c ./integration - - - uses: actions/upload-artifact@v2 - with: - name: integration.test - path: integration.test - if-no-files-found: error - - long-running-test: - name: Run Long Running Unit Test - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: '1.17' - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ inputs.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: ${{ inputs.os }}-go- - - - run: go install ./cmd/litestream - - run: go test -v -run=TestCmd_Replicate_LongRunning ./integration -long-running-duration 1m - - s3-integration-test: - name: Run S3 Integration Tests - if: ${{ github.actor == 'benbjohnson' }} - runs-on: ubuntu-18.04 - needs: build - steps: - - uses: actions/download-artifact@v2 - with: - name: integration.test - - run: chmod +x integration.test - - - run: ./integration.test -test.v -test.run=TestReplicaClient -replica-type s3 - env: - LITESTREAM_S3_ACCESS_KEY_ID: ${{ secrets.LITESTREAM_S3_ACCESS_KEY_ID }} - LITESTREAM_S3_SECRET_ACCESS_KEY: ${{ secrets.LITESTREAM_S3_SECRET_ACCESS_KEY }} - LITESTREAM_S3_REGION: us-east-1 - LITESTREAM_S3_BUCKET: integration.litestream.io - - gcp-integration-test: - name: Run GCP Integration Tests - if: ${{ github.actor == 'benbjohnson' }} - runs-on: ubuntu-18.04 - needs: build - steps: - - name: Extract GCP credentials - run: 'echo "$GOOGLE_APPLICATION_CREDENTIALS" > /opt/gcp.json' - shell: bash - env: - GOOGLE_APPLICATION_CREDENTIALS: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}} - - - uses: actions/download-artifact@v2 - with: - name: integration.test - - run: chmod +x integration.test - - - run: ./integration.test -test.v -test.run=TestReplicaClient -replica-type gcs - env: - GOOGLE_APPLICATION_CREDENTIALS: /opt/gcp.json - LITESTREAM_GCS_BUCKET: integration.litestream.io - - abs-integration-test: - name: Run Azure Blob Store Integration Tests - if: ${{ github.actor == 'benbjohnson' }} - runs-on: ubuntu-18.04 - needs: build - steps: - - uses: actions/download-artifact@v2 - with: - name: integration.test - - run: chmod +x integration.test - - - run: ./integration.test -test.v -test.run=TestReplicaClient -replica-type abs - env: - LITESTREAM_ABS_ACCOUNT_NAME: ${{ secrets.LITESTREAM_ABS_ACCOUNT_NAME }} - LITESTREAM_ABS_ACCOUNT_KEY: ${{ secrets.LITESTREAM_ABS_ACCOUNT_KEY }} - LITESTREAM_ABS_BUCKET: integration - -# sftp-integration-test: -# name: Run SFTP Integration Tests -# if: ${{ github.actor == 'benbjohnson' }} -# runs-on: ubuntu-18.04 -# needs: build -# steps: -# - name: Extract SSH key -# run: 'echo "$LITESTREAM_SFTP_KEY" > /opt/id_ed25519' -# shell: bash -# env: -# LITESTREAM_SFTP_KEY: ${{secrets.LITESTREAM_SFTP_KEY}} -# -# - name: Run sftp tests -# run: go test -v -run=TestReplicaClient ./integration -replica-type sftp -# env: -# LITESTREAM_SFTP_HOST: ${{ secrets.LITESTREAM_SFTP_HOST }} -# LITESTREAM_SFTP_USER: ${{ secrets.LITESTREAM_SFTP_USER }} -# LITESTREAM_SFTP_KEY_PATH: /opt/id_ed25519 -# LITESTREAM_SFTP_PATH: ${{ secrets.LITESTREAM_SFTP_PATH }} - diff --git a/.github/workflows/gcp_integration_test.yml b/.github/workflows/gcp_integration_test.yml new file mode 100644 index 0000000..1cab2f8 --- /dev/null +++ b/.github/workflows/gcp_integration_test.yml @@ -0,0 +1,30 @@ +name: GCP Integration Tests +on: pull_request + +jobs: + gcp-integration-test: + name: Run GCP Integration Tests + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-go@v2 + with: + go-version: '1.17' + + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ inputs.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ inputs.os }}-go- + + - name: Extract GCP credentials + run: 'echo "$GOOGLE_APPLICATION_CREDENTIALS" > /opt/gcp.json' + shell: bash + env: + GOOGLE_APPLICATION_CREDENTIALS: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}} + + - run: go test -v -run=TestReplicaClient ./integration -replica-type gcs + env: + GOOGLE_APPLICATION_CREDENTIALS: /opt/gcp.json + LITESTREAM_GCS_BUCKET: integration.litestream.io diff --git a/.github/workflows/long_running_test.yml b/.github/workflows/long_running_test.yml new file mode 100644 index 0000000..3827b1a --- /dev/null +++ b/.github/workflows/long_running_test.yml @@ -0,0 +1,23 @@ +name: Long-Running Unit Test +on: pull_request + +jobs: + test: + name: Run Long Running Unit Test + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-go@v2 + with: + go-version: '1.17' + + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ inputs.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ inputs.os }}-go- + + - run: go install ./cmd/litestream + + - run: go test -v -run=TestCmd_Replicate_LongRunning ./integration -long-running-duration 1m diff --git a/.github/workflows/s3_integration_test.yml b/.github/workflows/s3_integration_test.yml new file mode 100644 index 0000000..6fac1b3 --- /dev/null +++ b/.github/workflows/s3_integration_test.yml @@ -0,0 +1,28 @@ +name: S3 Integration Tests +on: pull_request + +jobs: + test: + name: Run S3 Integration Tests + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-go@v2 + with: + go-version: '1.17' + + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ inputs.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ inputs.os }}-go- + + - run: go install ./cmd/litestream + + - run: go test -v -run=TestReplicaClient ./integration -replica-type s3 + env: + LITESTREAM_S3_ACCESS_KEY_ID: ${{ secrets.LITESTREAM_S3_ACCESS_KEY_ID }} + LITESTREAM_S3_SECRET_ACCESS_KEY: ${{ secrets.LITESTREAM_S3_SECRET_ACCESS_KEY }} + LITESTREAM_S3_REGION: us-east-1 + LITESTREAM_S3_BUCKET: integration.litestream.io diff --git a/.github/workflows/sftp_integration_test.yml.bak b/.github/workflows/sftp_integration_test.yml.bak new file mode 100644 index 0000000..3c8bc89 --- /dev/null +++ b/.github/workflows/sftp_integration_test.yml.bak @@ -0,0 +1,34 @@ +#name: SFTP Integration Tests +#on: pull_request +# +#jobs: +# sftp-integration-test: +# name: Run SFTP Integration Tests +# runs-on: ubuntu-18.04 +# steps: +# - uses: actions/checkout@v2 +# +# - uses: actions/setup-go@v2 +# with: +# go-version: '1.17' +# +# - uses: actions/cache@v2 +# with: +# path: ~/go/pkg/mod +# key: ${{ inputs.os }}-go-${{ hashFiles('**/go.sum') }} +# restore-keys: ${{ inputs.os }}-go- +# +# - name: Extract SSH key +# run: 'echo "$LITESTREAM_SFTP_KEY" > /opt/id_ed25519' +# shell: bash +# env: +# LITESTREAM_SFTP_KEY: ${{secrets.LITESTREAM_SFTP_KEY}} +# +# - name: Run sftp tests +# run: go test -v -run=TestReplicaClient ./integration -replica-type sftp +# env: +# LITESTREAM_SFTP_HOST: ${{ secrets.LITESTREAM_SFTP_HOST }} +# LITESTREAM_SFTP_USER: ${{ secrets.LITESTREAM_SFTP_USER }} +# LITESTREAM_SFTP_KEY_PATH: /opt/id_ed25519 +# LITESTREAM_SFTP_PATH: ${{ secrets.LITESTREAM_SFTP_PATH }} +