From abe1b0f0fb3f219c70d4fdb1ae5088b3790b544b Mon Sep 17 00:00:00 2001 From: Baran Karaaslan Date: Mon, 12 Aug 2024 20:57:00 +0300 Subject: [PATCH] add access to php integration test secrets --- .github/workflows/test.yaml | 41 ++++++++++++--- .../workflows/wasmer-integration-tests.yaml | 51 +++++++++++++++++++ 2 files changed, 84 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/wasmer-integration-tests.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f1524bd50e5..b88206f7a0c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -873,6 +873,20 @@ jobs: - uses: actions/download-artifact@v3 with: name: wasmer-cli-linux-x64 + - name: Cargo Registry Cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/advisory-db + ~/.cargo/git + ~/.cargo/registry + key: cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cargo target cache + uses: actions/cache@v3 + with: + path: | + target/ + key: cargo-release-${{ hashFiles('**/Cargo.lock') }} - run: | # install rust toolchain curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y @@ -880,12 +894,23 @@ jobs: # add wasmer cli to PATH tar -xzf build-wasmer.tar.gz - export PATH=$PATH:$PWD/bin - - # login to wasmer registry - wasmer config set registry.url https://registry.wasmer.wtf/graphql - wasmer login ${{ secrets.WAPM_DEV_TOKEN }} - wasmer whoami - # start tests - cargo test --no-fail-fast -- --test-threads 1 \ No newline at end of file + docker build -t tmp . + docker run -v $PWD:/app -w /app tmp bash -c " \ + cp ./bin/wasmer /root/.wasmer/bin/wasmer &&\ + export MYSQL_HOST='${{ vars.INTEGRATION_TEST_MYSQL_HOST }}' &&\ + export MYSQL_DBNAME='${{ vars.INTEGRATION_TEST_MYSQL_DBNAME }}' &&\ + export MYSQL_USERNAME='${{ secrets.INTEGRATION_TEST_MYSQL_USERNAME }}' &&\ + export MYSQL_PASSWORD='${{ secrets.INTEGRATION_TEST_MYSQL_PASSWORD }}' &&\ + export MYSQL_PORT='${{ vars.INTEGRATION_TEST_MYSQL_PORT }}' &&\ + export MYSQL_CERT='${{ secrets.INTEGRATION_TEST_MYSQL_CERT }}' &&\ + export PG_HOST='${{ vars.INTEGRATION_TEST_PG_HOST }}' &&\ + export PG_DBNAME='${{ vars.INTEGRATION_TEST_PG_DBNAME }}' &&\ + export PG_USERNAME='${{ secrets.INTEGRATION_TEST_PG_USERNAME }}' &&\ + export PG_PASSWORD='${{ secrets.INTEGRATION_TEST_PG_PASSWORD }}' &&\ + export PG_PORT='${{ vars.INTEGRATION_TEST_PG_PORT }}' &&\ + wasmer config set registry.url https://registry.wasmer.io/graphql &&\ + wasmer login '${{ secrets.WAPM_PROD_TOKEN }}' &&\ + wasmer config set registry.url https://registry.wasmer.wtf/graphql &&\ + wasmer login '${{ secrets.WAPM_DEV_TOKEN }}' &&\ + cargo test --no-fail-fast" \ No newline at end of file diff --git a/.github/workflows/wasmer-integration-tests.yaml b/.github/workflows/wasmer-integration-tests.yaml new file mode 100644 index 00000000000..8a079aed71d --- /dev/null +++ b/.github/workflows/wasmer-integration-tests.yaml @@ -0,0 +1,51 @@ +name: test-sys + +on: + push: + branches: + - sre-383-re-enable-ignored-integration-test-test_php_extensions + +jobs: + # there is another set of integration tests in 'wasmer-integration-tests' repo. Run those + test-wasmer-integration-tests: + runs-on: ubuntu-22.04 + steps: + - name: Checkout wasmer-integration-tests repository + uses: actions/checkout@v3 + with: + repository: wasmerio/wasmer-integration-tests + submodules: true + token: ${{ secrets.CLONE_WASMER_INTEGRATION_TESTS }} + - name: Cargo Registry Cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/advisory-db + ~/.cargo/git + ~/.cargo/registry + key: cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cargo target cache + uses: actions/cache@v3 + with: + path: | + target/ + key: cargo-release-${{ hashFiles('**/Cargo.lock') }} + - run: | + docker build -t tmp . + docker run -v $PWD:/app -w /app tmp bash -c " \ + export MYSQL_HOST='${{ vars.INTEGRATION_TEST_MYSQL_HOST }}' &&\ + export MYSQL_DBNAME='${{ vars.INTEGRATION_TEST_MYSQL_DBNAME }}' &&\ + export MYSQL_USERNAME='${{ secrets.INTEGRATION_TEST_MYSQL_USERNAME }}' &&\ + export MYSQL_PASSWORD='${{ secrets.INTEGRATION_TEST_MYSQL_PASSWORD }}' &&\ + export MYSQL_PORT='${{ vars.INTEGRATION_TEST_MYSQL_PORT }}' &&\ + export MYSQL_CERT='${{ secrets.INTEGRATION_TEST_MYSQL_CERT }}' &&\ + export PG_HOST='${{ vars.INTEGRATION_TEST_PG_HOST }}' &&\ + export PG_DBNAME='${{ vars.INTEGRATION_TEST_PG_DBNAME }}' &&\ + export PG_USERNAME='${{ secrets.INTEGRATION_TEST_PG_USERNAME }}' &&\ + export PG_PASSWORD='${{ secrets.INTEGRATION_TEST_PG_PASSWORD }}' &&\ + export PG_PORT='${{ vars.INTEGRATION_TEST_PG_PORT }}' &&\ + wasmer config set registry.url https://registry.wasmer.io/graphql &&\ + wasmer login ${{ secrets.WAPM_PROD_TOKEN }} &&\ + wasmer config set registry.url https://registry.wasmer.wtf/graphql &&\ + wasmer login ${{ secrets.WAPM_DEV_TOKEN }} &&\ + cargo test --no-fail-fast" \ No newline at end of file