From 34e3acf0e3c03088706716532c1f963d646969b6 Mon Sep 17 00:00:00 2001 From: Edgar Onghena Date: Wed, 23 Feb 2022 11:20:03 +0100 Subject: [PATCH 01/10] Create build.yml --- .github/workflows/build.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e3b7ed2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,26 @@ +name: Rust + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +env: + CARGO_TERM_COLOR: always + +jobs: + test: + runs-on: ubuntu-latest + container: rust:1.58.1-alpine + steps: + - uses: actions/checkout@v2 + - name: cargo test + run: cargo test --package postgres-ical-parser --package postgres-ical + build: + runs-on: ubuntu-latest + container: timescaledev/rust-pgx + steps: + - uses: actions/checkout@v2 + - name: pgx package + run: cargo pgx package From 5d6fc0f02da8265454b6e96f5c7d3f189ffb1f18 Mon Sep 17 00:00:00 2001 From: Edgar Onghena Date: Wed, 23 Feb 2022 11:28:42 +0100 Subject: [PATCH 02/10] Cache --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e3b7ed2..a1db358 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,9 +12,10 @@ env: jobs: test: runs-on: ubuntu-latest - container: rust:1.58.1-alpine + container: rust steps: - uses: actions/checkout@v2 + - uses: Swatinem/rust-cache@v1 - name: cargo test run: cargo test --package postgres-ical-parser --package postgres-ical build: @@ -22,5 +23,8 @@ jobs: container: timescaledev/rust-pgx steps: - uses: actions/checkout@v2 + - uses: Swatinem/rust-cache@v1 + - name: pgx init + run: cargo pgx init - name: pgx package run: cargo pgx package From 2fa2cdc02537565807d514660c2b9f9e22e04d45 Mon Sep 17 00:00:00 2001 From: Edgar Onghena Date: Thu, 24 Feb 2022 16:56:30 +0100 Subject: [PATCH 03/10] Use custom container image --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a1db358..189537d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: run: cargo test --package postgres-ical-parser --package postgres-ical build: runs-on: ubuntu-latest - container: timescaledev/rust-pgx + container: edgarogh/rust-pgx:1.58.1-0.3.3 steps: - uses: actions/checkout@v2 - uses: Swatinem/rust-cache@v1 From 1da4fd2f8aee2395ce971c09ed9a3e70980da433 Mon Sep 17 00:00:00 2001 From: Edgar Onghena Date: Thu, 24 Feb 2022 16:58:54 +0100 Subject: [PATCH 04/10] Update build.yml --- .github/workflows/build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 189537d..daf76bc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,14 +17,12 @@ jobs: - uses: actions/checkout@v2 - uses: Swatinem/rust-cache@v1 - name: cargo test - run: cargo test --package postgres-ical-parser --package postgres-ical + run: cargo test --package postgres-ical-parser build: runs-on: ubuntu-latest container: edgarogh/rust-pgx:1.58.1-0.3.3 steps: - uses: actions/checkout@v2 - uses: Swatinem/rust-cache@v1 - - name: pgx init - run: cargo pgx init - name: pgx package run: cargo pgx package From 5d920324808fc791fba84b562c77effe86599731 Mon Sep 17 00:00:00 2001 From: Edgar Onghena Date: Thu, 24 Feb 2022 17:08:41 +0100 Subject: [PATCH 05/10] Symlink & permissions --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index daf76bc..2349005 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,10 @@ jobs: runs-on: ubuntu-latest container: edgarogh/rust-pgx:1.58.1-0.3.3 steps: + - run: | + usermod -aG postgres $USER + chmod 770 -R /home/postgres/.pgx + ln -s /home/postgres/.pgx /github/home/ - uses: actions/checkout@v2 - uses: Swatinem/rust-cache@v1 - name: pgx package From 1f51178a23218f5ca44e7d0fe00ef4be07ec6055 Mon Sep 17 00:00:00 2001 From: Edgar Onghena Date: Thu, 24 Feb 2022 17:10:43 +0100 Subject: [PATCH 06/10] Hopefully everybody is root --- .github/workflows/build.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2349005..09c1b97 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,10 +22,8 @@ jobs: runs-on: ubuntu-latest container: edgarogh/rust-pgx:1.58.1-0.3.3 steps: - - run: | - usermod -aG postgres $USER - chmod 770 -R /home/postgres/.pgx - ln -s /home/postgres/.pgx /github/home/ + - name: symlink ~/.pgx + run: ln -s /home/postgres/.pgx /github/home/ - uses: actions/checkout@v2 - uses: Swatinem/rust-cache@v1 - name: pgx package From 191d304b14f6cc4cee3c3a60431a74d9fd99a975 Mon Sep 17 00:00:00 2001 From: Edgar Onghena Date: Thu, 24 Feb 2022 20:43:08 +0100 Subject: [PATCH 07/10] Make CI script upload artifacts --- .github/workflows/build.yml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 09c1b97..12426aa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,10 +21,37 @@ jobs: build: runs-on: ubuntu-latest container: edgarogh/rust-pgx:1.58.1-0.3.3 + env: + HASH: ${GITHUB_SHA::7} steps: - name: symlink ~/.pgx run: ln -s /home/postgres/.pgx /github/home/ - uses: actions/checkout@v2 - uses: Swatinem/rust-cache@v1 - name: pgx package - run: cargo pgx package + run: cargo pgx package --features pg10,pg11,pg12,pg13,pg14 + + - uses: actions/upload-artifact@v2 + with: + name: postgres-ical-10_${HASH} + path: target/release/postgres_ical-pg10 + + - uses: actions/upload-artifact@v2 + with: + name: postgres-ical-11_${HASH} + path: target/release/postgres_ical-pg11 + + - uses: actions/upload-artifact@v2 + with: + name: postgres-ical-12_${HASH} + path: target/release/postgres_ical-pg12 + + - uses: actions/upload-artifact@v2 + with: + name: postgres-ical-13_${HASH} + path: target/release/postgres_ical-pg13 + + - uses: actions/upload-artifact@v2 + with: + name: postgres-ical-14_${HASH} + path: target/release/postgres_ical-pg14 From c53e67ca9becb9afdc5a6a8c0bed57f8958b4dd9 Mon Sep 17 00:00:00 2001 From: Edgar Onghena Date: Thu, 24 Feb 2022 20:51:22 +0100 Subject: [PATCH 08/10] Use a matrix --- .github/workflows/build.yml | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 12426aa..b8af651 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,37 +21,23 @@ jobs: build: runs-on: ubuntu-latest container: edgarogh/rust-pgx:1.58.1-0.3.3 + env: HASH: ${GITHUB_SHA::7} + + strategy: + matrix: + pg: [10, 11, 12, 13, 14] + steps: - name: symlink ~/.pgx run: ln -s /home/postgres/.pgx /github/home/ - uses: actions/checkout@v2 - uses: Swatinem/rust-cache@v1 - name: pgx package - run: cargo pgx package --features pg10,pg11,pg12,pg13,pg14 - - - uses: actions/upload-artifact@v2 - with: - name: postgres-ical-10_${HASH} - path: target/release/postgres_ical-pg10 - - - uses: actions/upload-artifact@v2 - with: - name: postgres-ical-11_${HASH} - path: target/release/postgres_ical-pg11 - - - uses: actions/upload-artifact@v2 - with: - name: postgres-ical-12_${HASH} - path: target/release/postgres_ical-pg12 - - - uses: actions/upload-artifact@v2 - with: - name: postgres-ical-13_${HASH} - path: target/release/postgres_ical-pg13 + run: cargo pgx package --no-default-features --features pg${{ matrix.pg }} - uses: actions/upload-artifact@v2 with: - name: postgres-ical-14_${HASH} - path: target/release/postgres_ical-pg14 + name: postgres-ical-${{ matrix.pg }}_${HASH} + path: target/release/postgres_ical-pg${{ matrix.pg }} From d86fee9d566197864ca45433c491a34ddd439a6f Mon Sep 17 00:00:00 2001 From: Edgar Onghena Date: Thu, 24 Feb 2022 21:13:14 +0100 Subject: [PATCH 09/10] Fix HASH --- .github/workflows/build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8af651..1dd9f24 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,12 +32,17 @@ jobs: steps: - name: symlink ~/.pgx run: ln -s /home/postgres/.pgx /github/home/ + - uses: actions/checkout@v2 + - uses: Swatinem/rust-cache@v1 + with: + key: pg${{ matrix.pg }} + - name: pgx package run: cargo pgx package --no-default-features --features pg${{ matrix.pg }} - uses: actions/upload-artifact@v2 with: - name: postgres-ical-${{ matrix.pg }}_${HASH} + name: postgres-ical-${{ matrix.pg }}_${{ env.HASH }} path: target/release/postgres_ical-pg${{ matrix.pg }} From c57716f2c0e3970c8eba9cca5de84f8448dab1b3 Mon Sep 17 00:00:00 2001 From: Edgar Onghena Date: Thu, 24 Feb 2022 22:25:45 +0100 Subject: [PATCH 10/10] Update build.yml --- .github/workflows/build.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1dd9f24..70fa853 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,9 +22,6 @@ jobs: runs-on: ubuntu-latest container: edgarogh/rust-pgx:1.58.1-0.3.3 - env: - HASH: ${GITHUB_SHA::7} - strategy: matrix: pg: [10, 11, 12, 13, 14] @@ -44,5 +41,5 @@ jobs: - uses: actions/upload-artifact@v2 with: - name: postgres-ical-${{ matrix.pg }}_${{ env.HASH }} + name: postgres-ical-${{ matrix.pg }}_${{ env.GITHUB_SHA }} path: target/release/postgres_ical-pg${{ matrix.pg }}