Skip to content

Commit 8435637

Browse files
committed
CI: Add Github actions
1 parent 5a07820 commit 8435637

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

.github/workflows/ci.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
job_test_gem:
7+
name: Test built gem
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
include:
12+
- os: windows
13+
ruby: "head"
14+
PGVERSION: 15.1-1-windows-x64
15+
PGVER: "15"
16+
- os: windows
17+
ruby: "2.4"
18+
PGVERSION: 9.4.26-1-windows-x64
19+
PGVER: "9.4"
20+
- os: ubuntu
21+
ruby: "head"
22+
PGVER: "15"
23+
- os: ubuntu
24+
os_ver: "20.04"
25+
ruby: "2.3"
26+
PGVER: "9.3"
27+
- os: macos
28+
ruby: "head"
29+
PGVERSION: 15.1-1-osx
30+
PGVER: "15"
31+
32+
runs-on: ${{ matrix.os }}-${{ matrix.os_ver || 'latest' }}
33+
env:
34+
PGVERSION: ${{ matrix.PGVERSION }}
35+
PGVER: ${{ matrix.PGVER }}
36+
37+
steps:
38+
- uses: actions/checkout@v3
39+
- name: Set up Ruby
40+
uses: ruby/setup-ruby@v1
41+
with:
42+
ruby-version: ${{ matrix.ruby }}
43+
44+
- name: Download PostgreSQL Windows
45+
if: matrix.os == 'windows'
46+
run: |
47+
Add-Type -AssemblyName System.IO.Compression.FileSystem
48+
function Unzip {
49+
param([string]$zipfile, [string]$outpath)
50+
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
51+
}
52+
53+
$(new-object net.webclient).DownloadFile("http://get.enterprisedb.com/postgresql/postgresql-$env:PGVERSION-binaries.zip", "postgresql-binaries.zip")
54+
Unzip "postgresql-binaries.zip" "."
55+
echo "$pwd/pgsql/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
56+
echo "PGUSER=$env:USERNAME" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
57+
echo "PGPASSWORD=" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
58+
md temp
59+
icacls temp /grant "Everyone:(OI)(CI)F" /T
60+
61+
- name: Download PostgreSQL Ubuntu
62+
if: matrix.os == 'ubuntu'
63+
run: |
64+
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee -a /etc/apt/sources.list.d/pgdg.list
65+
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
66+
sudo apt-get -y update
67+
sudo apt-get -y --allow-downgrades install postgresql-$PGVER libpq5=$PGVER* libpq-dev=$PGVER*
68+
echo /usr/lib/postgresql/$PGVER/bin >> $GITHUB_PATH
69+
70+
- name: Download PostgreSQL Macos
71+
if: matrix.os == 'macos'
72+
run: |
73+
wget https://get.enterprisedb.com/postgresql/postgresql-$PGVERSION-binaries.zip && \
74+
sudo mkdir -p /Library/PostgreSQL && \
75+
sudo unzip postgresql-$PGVERSION-binaries.zip -d /Library/PostgreSQL/$PGVER && \
76+
echo /Library/PostgreSQL/$PGVER/bin >> $GITHUB_PATH
77+
78+
- run: bundle install
79+
80+
- name: Run specs
81+
run: bundle exec rake test

0 commit comments

Comments
 (0)